1*a5061eceSAdrien DestuguesScreen class 2*a5061eceSAdrien Destugues############ 3*a5061eceSAdrien Destugues 4*a5061eceSAdrien DestuguesThe Screen class handles all infrastructure needed for each 5*a5061eceSAdrien Destuguesmonitor/video card pair. The Workspace class holds data and supplies 6*a5061eceSAdrien Destuguesthe infrastructure for drawing the screen. 7*a5061eceSAdrien Destugues 8*a5061eceSAdrien DestuguesMember Functions 9*a5061eceSAdrien Destugues================ 10*a5061eceSAdrien Destugues 11*a5061eceSAdrien DestuguesScreen(DisplayDriver \*gfxmodule, uint8 workspaces) 12*a5061eceSAdrien Destugues--------------------------------------------------- 13*a5061eceSAdrien Destugues 14*a5061eceSAdrien Destugues1. Set driver pointer to gfxmodule 15*a5061eceSAdrien Destugues2. If driver pointer is non-NULL and driver->Initialize() is true, set 16*a5061eceSAdrien Destugues initialized flag to true 17*a5061eceSAdrien Destugues3. If initialized, get the appropriate display driver info and save it 18*a5061eceSAdrien Destugues internally 19*a5061eceSAdrien Destugues4. Create and populate workspace list 20*a5061eceSAdrien Destugues5. Clear all workspaces 21*a5061eceSAdrien Destugues 22*a5061eceSAdrien Destugues 23*a5061eceSAdrien Destugues~Screen(void) 24*a5061eceSAdrien Destugues------------- 25*a5061eceSAdrien Destugues 26*a5061eceSAdrien Destugues1. Remove all workspaces from the list and delete them 27*a5061eceSAdrien Destugues2. Delete the workspace list 28*a5061eceSAdrien Destugues 29*a5061eceSAdrien Destuguesvoid AddWorkspace(int32 index=-1) 30*a5061eceSAdrien Destugues--------------------------------- 31*a5061eceSAdrien Destugues 32*a5061eceSAdrien DestuguesAdds a workspace to the screen object, setting its settings to the 33*a5061eceSAdrien Destuguesdefault, and adding it to the list in the specified index or the end 34*a5061eceSAdrien Destuguesof the list if the index is -1 35*a5061eceSAdrien Destugues 36*a5061eceSAdrien Destugues 37*a5061eceSAdrien Destugues1. Create a workspace object 38*a5061eceSAdrien Destugues2. Add it to the workspace list - to the end if the index is -1, and to 39*a5061eceSAdrien Destugues the particular index if not 40*a5061eceSAdrien Destugues 41*a5061eceSAdrien Destuguesvoid DeleteWorkspace(int32 index) 42*a5061eceSAdrien Destugues--------------------------------- 43*a5061eceSAdrien Destugues 44*a5061eceSAdrien DestuguesDeletes the workspace at the specified index. 45*a5061eceSAdrien Destugues 46*a5061eceSAdrien Destugues 47*a5061eceSAdrien Destugues1. Remove the item at the specified index and if non-NULL, delete it. 48*a5061eceSAdrien Destugues 49*a5061eceSAdrien Destuguesint32 CountWorkspaces(void) 50*a5061eceSAdrien Destugues--------------------------- 51*a5061eceSAdrien Destugues 52*a5061eceSAdrien DestuguesReturns the number of workspaces kept by the particular Screen objects 53*a5061eceSAdrien Destugues 54*a5061eceSAdrien Destugues1. Return the workspace list's CountItems() value 55*a5061eceSAdrien Destugues 56*a5061eceSAdrien Destuguesvoid SetWorkspaceCount(int32 count) 57*a5061eceSAdrien Destugues----------------------------------- 58*a5061eceSAdrien Destugues 59*a5061eceSAdrien DestuguesSets the number of workspaces available to count. If count is less 60*a5061eceSAdrien Destuguesthan the number of current workspaces, the last workspaces are deleted 61*a5061eceSAdrien Destuguesfirst. Workspaces are added to the end of the list. If a delete 62*a5061eceSAdrien Destuguesworkspace should include the active workspace, then the workspace with 63*a5061eceSAdrien Destuguesthe index count-1 is activated. There must be at least one workspace. 64*a5061eceSAdrien Destugues 65*a5061eceSAdrien Destugues1. if count equals the workspace list's CountItems value, return 66*a5061eceSAdrien Destugues2. If count is less than 1, set count to 1. If greater than 32, set to 32. 67*a5061eceSAdrien Destugues3. If active workspace index is greater than count-1, call SetWorkspace(count-1) 68*a5061eceSAdrien Destugues4. If count is greater than the workspace list's CountItems value, call 69*a5061eceSAdrien Destugues AddWorkspace the appropriate number of times. 70*a5061eceSAdrien Destugues5. If count is less than the workspace list's CountItems, call 71*a5061eceSAdrien Destugues RemoveWorkspace the appropriate number of times 72*a5061eceSAdrien Destugues 73*a5061eceSAdrien Destuguesint32 CurrentWorkspace(void) 74*a5061eceSAdrien Destugues---------------------------- 75*a5061eceSAdrien Destugues 76*a5061eceSAdrien DestuguesReturns the active workspace index 77*a5061eceSAdrien Destugues 78*a5061eceSAdrien Destuguesvoid SetWorkspace(int32 workspace) 79*a5061eceSAdrien Destugues---------------------------------- 80*a5061eceSAdrien Destugues 81*a5061eceSAdrien Destuguesvoid Activate(bool active=true) 82*a5061eceSAdrien Destugues------------------------------- 83*a5061eceSAdrien Destugues 84*a5061eceSAdrien DestuguesDisplayDriver \*GetDriver(void) 85*a5061eceSAdrien Destugues------------------------------- 86*a5061eceSAdrien Destugues 87*a5061eceSAdrien Destuguesstatus_t SetSpace(int32 index, int32 res, bool stick=true) 88*a5061eceSAdrien Destugues---------------------------------------------------------- 89*a5061eceSAdrien Destugues 90*a5061eceSAdrien Destuguesvoid AddWindow(ServerWindow \*win, int32 workspace=B_CURRENT_WORKSPACE) 91*a5061eceSAdrien Destugues----------------------------------------------------------------------- 92*a5061eceSAdrien Destugues 93*a5061eceSAdrien Destuguesvoid RemoveWindow(ServerWindow \*win) 94*a5061eceSAdrien Destugues------------------------------------- 95*a5061eceSAdrien Destugues 96*a5061eceSAdrien DestuguesServerWindow \*ActiveWindow(void) 97*a5061eceSAdrien Destugues--------------------------------- 98*a5061eceSAdrien Destugues 99*a5061eceSAdrien Destuguesvoid SetActiveWindow(ServerWindow \*win) 100*a5061eceSAdrien Destugues---------------------------------------- 101*a5061eceSAdrien Destugues 102*a5061eceSAdrien DestuguesLayer \*GetRootLayer(int32 workspace=B_CURRENT_WORKSPACE) 103*a5061eceSAdrien Destugues--------------------------------------------------------- 104*a5061eceSAdrien Destugues 105*a5061eceSAdrien Destuguesbool IsInitialized(void) 106*a5061eceSAdrien Destugues------------------------ 107*a5061eceSAdrien Destugues 108*a5061eceSAdrien DestuguesWorkspace \*GetActiveWorkspace(void) 109*a5061eceSAdrien Destugues------------------------------------ 110*a5061eceSAdrien Destugues 111*a5061eceSAdrien DestuguesWorkspace class members 112*a5061eceSAdrien Destugues======================= 113*a5061eceSAdrien Destugues 114*a5061eceSAdrien DestuguesWorkspace(void) 115*a5061eceSAdrien Destugues--------------- 116*a5061eceSAdrien Destugues 117*a5061eceSAdrien Destugues1. Set background color to RGB(51,102,160) 118*a5061eceSAdrien Destugues2. Copy frame_buffer_info and graphics_card_info structure values 119*a5061eceSAdrien Destugues3. Create a RootLayer object using the values from the two structures 120*a5061eceSAdrien Destugues 121*a5061eceSAdrien Destugues~Workspace(void) 122*a5061eceSAdrien Destugues---------------- 123*a5061eceSAdrien Destugues 124*a5061eceSAdrien Destugues1. Call the RootLayer object's PruneTree method and delete it 125*a5061eceSAdrien Destugues 126*a5061eceSAdrien Destuguesvoid SetBGColor(const RGBColor &c) 127*a5061eceSAdrien Destugues---------------------------------- 128*a5061eceSAdrien Destugues 129*a5061eceSAdrien DestuguesSets the particular color for the workspace. Note that this does not 130*a5061eceSAdrien Destuguesrefresh the display. 131*a5061eceSAdrien Destugues 132*a5061eceSAdrien Destugues1. Set the internal background RGBColor object to the color parameter 133*a5061eceSAdrien Destugues 134*a5061eceSAdrien DestuguesRGBColor BGColor(void) 135*a5061eceSAdrien Destugues---------------------- 136*a5061eceSAdrien Destugues 137*a5061eceSAdrien DestuguesReturns the internal background color 138*a5061eceSAdrien Destugues 139*a5061eceSAdrien Destugues 140*a5061eceSAdrien DestuguesRootLayer \*GetRoot(void) 141*a5061eceSAdrien Destugues------------------------- 142*a5061eceSAdrien Destugues 143*a5061eceSAdrien DestuguesReturns the pointer to the RootLayer object 144*a5061eceSAdrien Destugues 145*a5061eceSAdrien Destugues 146*a5061eceSAdrien Destuguesvoid SetData(graphics_card_info \*gcinfo, frame_buffer_info \*fbinfo) 147*a5061eceSAdrien Destugues--------------------------------------------------------------------- 148*a5061eceSAdrien Destugues 149*a5061eceSAdrien DestuguesChanges the graphics data and resizes the RootLayer accordingly. 150*a5061eceSAdrien Destugues 151*a5061eceSAdrien Destugues 152*a5061eceSAdrien Destugues1. Copy the two structures to the internal one 153*a5061eceSAdrien Destugues2. Resize the RootLayer 154*a5061eceSAdrien Destugues3. If the RootLayer was resized larger, Invalidate the new areas 155*a5061eceSAdrien Destugues 156*a5061eceSAdrien Destugues 157*a5061eceSAdrien Destuguesvoid GetData(graphics_card_info \*gcinfo, frame_buffer_info \*fbinfo) 158*a5061eceSAdrien Destugues--------------------------------------------------------------------- 159*a5061eceSAdrien Destugues 160*a5061eceSAdrien DestuguesCopies the two data structures into the parameters passed. 161*a5061eceSAdrien Destugues 162*a5061eceSAdrien DestuguesRootLayer class members 163*a5061eceSAdrien Destugues======================= 164*a5061eceSAdrien Destugues 165*a5061eceSAdrien DestuguesRootLayer(BRect frame, const char \*name) 166*a5061eceSAdrien Destugues 167*a5061eceSAdrien Destugues 168*a5061eceSAdrien Destugues1. passes B_FOLLOW_NONE to Layer constructor 169*a5061eceSAdrien Destugues2. set level to 0 170*a5061eceSAdrien Destugues3. set the background color to the color for the workspace set in the 171*a5061eceSAdrien Destugues system preferences 172*a5061eceSAdrien Destugues 173*a5061eceSAdrien Destugues 174*a5061eceSAdrien Destugues~RootLayer(void) 175*a5061eceSAdrien Destugues---------------- 176*a5061eceSAdrien Destugues 177*a5061eceSAdrien DestuguesDoes nothing. 178*a5061eceSAdrien Destugues 179*a5061eceSAdrien Destugues 180*a5061eceSAdrien Destuguesvoid RequestDraw(const BRect &r) 181*a5061eceSAdrien Destugues-------------------------------- 182*a5061eceSAdrien Destugues 183*a5061eceSAdrien DestuguesRequests that the layer be drawn on screen. The rectangle passed is in 184*a5061eceSAdrien Destuguesthe layer's own coordinates. 185*a5061eceSAdrien Destugues 186*a5061eceSAdrien Destugues 187*a5061eceSAdrien Destugues1. call the display driver's FillRect on the rectangle, filling with 188*a5061eceSAdrien Destugues the layer's background color 189*a5061eceSAdrien Destugues2. recurse through each child and call its RequestDraw() function if it 190*a5061eceSAdrien Destugues intersects the child's frame 191*a5061eceSAdrien Destugues 192*a5061eceSAdrien Destuguesvoid MoveBy(BPoint pt), void MoveBy(float x, float y) 193*a5061eceSAdrien Destugues----------------------------------------------------- 194*a5061eceSAdrien Destugues 195*a5061eceSAdrien DestuguesMade empty so that the root layer cannot be moved 196*a5061eceSAdrien Destugues 197*a5061eceSAdrien Destuguesvoid SetDriver(DisplayDriver \*d) 198*a5061eceSAdrien Destugues--------------------------------- 199*a5061eceSAdrien Destugues 200*a5061eceSAdrien DestuguesAssigns a particular display driver object to the root layer if 201*a5061eceSAdrien Destuguesnon-NULL. 202*a5061eceSAdrien Destugues 203*a5061eceSAdrien Destugues 204*a5061eceSAdrien Destuguesvoid RebuildRegions(bool recursive=false) 205*a5061eceSAdrien Destugues----------------------------------------- 206*a5061eceSAdrien Destugues 207*a5061eceSAdrien DestuguesRebuilds the visible and invalid layers based on the layer hierarchy. 208*a5061eceSAdrien DestuguesUsed to update the regions after a call to remove or add a child layer 209*a5061eceSAdrien Destuguesis made or when a layer is hidden or shown. 210*a5061eceSAdrien Destugues 211*a5061eceSAdrien Destugues 212*a5061eceSAdrien Destugues1. get the frame 213*a5061eceSAdrien Destugues2. set full and visible regions to frame 214*a5061eceSAdrien Destugues3. iterate through each child and exclude its full region from the 215*a5061eceSAdrien Destugues visible region if the child is visible. 216*a5061eceSAdrien Destugues 217