1Screen class
2############
3
4The Screen class handles all infrastructure needed for each
5monitor/video card pair. The Workspace class holds data and supplies
6the infrastructure for drawing the screen.
7
8Member Functions
9================
10
11Screen(DisplayDriver \*gfxmodule, uint8 workspaces)
12---------------------------------------------------
13
141. Set driver pointer to gfxmodule
152. If driver pointer is non-NULL and driver->Initialize() is true, set
16   initialized flag to true
173. If initialized, get the appropriate display driver info and save it
18   internally
194. Create and populate workspace list
205. Clear all workspaces
21
22
23~Screen(void)
24-------------
25
261. Remove all workspaces from the list and delete them
272. Delete the workspace list
28
29void AddWorkspace(int32 index=-1)
30---------------------------------
31
32Adds a workspace to the screen object, setting its settings to the
33default, and adding it to the list in the specified index or the end
34of the list if the index is -1
35
36
371. Create a workspace object
382. Add it to the workspace list - to the end if the index is -1, and to
39   the particular index if not
40
41void DeleteWorkspace(int32 index)
42---------------------------------
43
44Deletes the workspace at the specified index.
45
46
471. Remove the item at the specified index and if non-NULL, delete it.
48
49int32 CountWorkspaces(void)
50---------------------------
51
52Returns the number of workspaces kept by the particular Screen objects
53
541. Return the workspace list's CountItems() value
55
56void SetWorkspaceCount(int32 count)
57-----------------------------------
58
59Sets the number of workspaces available to count. If count is less
60than the number of current workspaces, the last workspaces are deleted
61first. Workspaces are added to the end of the list. If a delete
62workspace should include the active workspace, then the workspace with
63the index count-1 is activated. There must be at least one workspace.
64
651. if count equals the workspace list's CountItems value, return
662. If count is less than 1, set count to 1. If greater than 32, set to 32.
673. If active workspace index is greater than count-1, call SetWorkspace(count-1)
684. If count is greater than the workspace list's CountItems value, call
69   AddWorkspace the appropriate number of times.
705. If count is less than the workspace list's CountItems, call
71   RemoveWorkspace the appropriate number of times
72
73int32 CurrentWorkspace(void)
74----------------------------
75
76Returns the active workspace index
77
78void SetWorkspace(int32 workspace)
79----------------------------------
80
81void Activate(bool active=true)
82-------------------------------
83
84DisplayDriver \*GetDriver(void)
85-------------------------------
86
87status_t SetSpace(int32 index, int32 res, bool stick=true)
88----------------------------------------------------------
89
90void AddWindow(ServerWindow \*win, int32 workspace=B_CURRENT_WORKSPACE)
91-----------------------------------------------------------------------
92
93void RemoveWindow(ServerWindow \*win)
94-------------------------------------
95
96ServerWindow \*ActiveWindow(void)
97---------------------------------
98
99void SetActiveWindow(ServerWindow \*win)
100----------------------------------------
101
102Layer \*GetRootLayer(int32 workspace=B_CURRENT_WORKSPACE)
103---------------------------------------------------------
104
105bool IsInitialized(void)
106------------------------
107
108Workspace \*GetActiveWorkspace(void)
109------------------------------------
110
111Workspace class members
112=======================
113
114Workspace(void)
115---------------
116
1171. Set background color to RGB(51,102,160)
1182. Copy frame_buffer_info and graphics_card_info structure values
1193. Create a RootLayer object using the values from the two structures
120
121~Workspace(void)
122----------------
123
1241. Call the RootLayer object's PruneTree method and delete it
125
126void SetBGColor(const RGBColor &c)
127----------------------------------
128
129Sets the particular color for the workspace. Note that this does not
130refresh the display.
131
1321. Set the internal background RGBColor object to the color parameter
133
134RGBColor BGColor(void)
135----------------------
136
137Returns the internal background color
138
139
140RootLayer \*GetRoot(void)
141-------------------------
142
143Returns the pointer to the RootLayer object
144
145
146void SetData(graphics_card_info \*gcinfo, frame_buffer_info \*fbinfo)
147---------------------------------------------------------------------
148
149Changes the graphics data and resizes the RootLayer accordingly.
150
151
1521. Copy the two structures to the internal one
1532. Resize the RootLayer
1543. If the RootLayer was resized larger, Invalidate the new areas
155
156
157void GetData(graphics_card_info \*gcinfo, frame_buffer_info \*fbinfo)
158---------------------------------------------------------------------
159
160Copies the two data structures into the parameters passed.
161
162RootLayer class members
163=======================
164
165RootLayer(BRect frame, const char \*name)
166
167
1681. passes B_FOLLOW_NONE to Layer constructor
1692. set level to 0
1703. set the background color to the color for the workspace set in the
171   system preferences
172
173
174~RootLayer(void)
175----------------
176
177Does nothing.
178
179
180void RequestDraw(const BRect &r)
181--------------------------------
182
183Requests that the layer be drawn on screen. The rectangle passed is in
184the layer's own coordinates.
185
186
1871. call the display driver's FillRect on the rectangle, filling with
188   the layer's background color
1892. recurse through each child and call its RequestDraw() function if it
190   intersects the child's frame
191
192void MoveBy(BPoint pt), void MoveBy(float x, float y)
193-----------------------------------------------------
194
195Made empty so that the root layer cannot be moved
196
197void SetDriver(DisplayDriver \*d)
198---------------------------------
199
200Assigns a particular display driver object to the root layer if
201non-NULL.
202
203
204void RebuildRegions(bool recursive=false)
205-----------------------------------------
206
207Rebuilds the visible and invalid layers based on the layer hierarchy.
208Used to update the regions after a call to remove or add a child layer
209is made or when a layer is hidden or shown.
210
211
2121. get the frame
2132. set full and visible regions to frame
2143. iterate through each child and exclude its full region from the
215   visible region if the child is visible.
216
217