Screen class############The Screen class handles all infrastructure needed for eachmonitor/video card pair. The Workspace class holds data and suppliesthe infrastructure for drawing the screen.Member Functions================Screen(DisplayDriver \*gfxmodule, uint8 workspaces)---------------------------------------------------1. Set driver pointer to gfxmodule2. If driver pointer is non-NULL and driver->Initialize() is true, setinitialized flag to true3. If initialized, get the appropriate display driver info and save itinternally4. Create and populate workspace list5. Clear all workspaces~Screen(void)-------------1. Remove all workspaces from the list and delete them2. Delete the workspace listvoid AddWorkspace(int32 index=-1)---------------------------------Adds a workspace to the screen object, setting its settings to thedefault, and adding it to the list in the specified index or the endof the list if the index is -11. Create a workspace object2. Add it to the workspace list - to the end if the index is -1, and tothe particular index if notvoid DeleteWorkspace(int32 index)---------------------------------Deletes the workspace at the specified index.1. Remove the item at the specified index and if non-NULL, delete it.int32 CountWorkspaces(void)---------------------------Returns the number of workspaces kept by the particular Screen objects1. Return the workspace list's CountItems() valuevoid SetWorkspaceCount(int32 count)-----------------------------------Sets the number of workspaces available to count. If count is lessthan the number of current workspaces, the last workspaces are deletedfirst. Workspaces are added to the end of the list. If a deleteworkspace should include the active workspace, then the workspace withthe index count-1 is activated. There must be at least one workspace.1. if count equals the workspace list's CountItems value, return2. If count is less than 1, set count to 1. If greater than 32, set to 32.3. If active workspace index is greater than count-1, call SetWorkspace(count-1)4. If count is greater than the workspace list's CountItems value, callAddWorkspace the appropriate number of times.5. If count is less than the workspace list's CountItems, callRemoveWorkspace the appropriate number of timesint32 CurrentWorkspace(void)----------------------------Returns the active workspace indexvoid SetWorkspace(int32 workspace)----------------------------------void Activate(bool active=true)-------------------------------DisplayDriver \*GetDriver(void)-------------------------------status_t SetSpace(int32 index, int32 res, bool stick=true)----------------------------------------------------------void AddWindow(ServerWindow \*win, int32 workspace=B_CURRENT_WORKSPACE)-----------------------------------------------------------------------void RemoveWindow(ServerWindow \*win)-------------------------------------ServerWindow \*ActiveWindow(void)---------------------------------void SetActiveWindow(ServerWindow \*win)----------------------------------------Layer \*GetRootLayer(int32 workspace=B_CURRENT_WORKSPACE)---------------------------------------------------------bool IsInitialized(void)------------------------Workspace \*GetActiveWorkspace(void)------------------------------------Workspace class members=======================Workspace(void)---------------1. Set background color to RGB(51,102,160)2. Copy frame_buffer_info and graphics_card_info structure values3. Create a RootLayer object using the values from the two structures~Workspace(void)----------------1. Call the RootLayer object's PruneTree method and delete itvoid SetBGColor(const RGBColor &c)----------------------------------Sets the particular color for the workspace. Note that this does notrefresh the display.1. Set the internal background RGBColor object to the color parameterRGBColor BGColor(void)----------------------Returns the internal background colorRootLayer \*GetRoot(void)-------------------------Returns the pointer to the RootLayer objectvoid SetData(graphics_card_info \*gcinfo, frame_buffer_info \*fbinfo)---------------------------------------------------------------------Changes the graphics data and resizes the RootLayer accordingly.1. Copy the two structures to the internal one2. Resize the RootLayer3. If the RootLayer was resized larger, Invalidate the new areasvoid GetData(graphics_card_info \*gcinfo, frame_buffer_info \*fbinfo)---------------------------------------------------------------------Copies the two data structures into the parameters passed.RootLayer class members=======================RootLayer(BRect frame, const char \*name)1. passes B_FOLLOW_NONE to Layer constructor2. set level to 03. set the background color to the color for the workspace set in thesystem preferences~RootLayer(void)----------------Does nothing.void RequestDraw(const BRect &r)--------------------------------Requests that the layer be drawn on screen. The rectangle passed is inthe layer's own coordinates.1. call the display driver's FillRect on the rectangle, filling withthe layer's background color2. recurse through each child and call its RequestDraw() function if itintersects the child's framevoid MoveBy(BPoint pt), void MoveBy(float x, float y)-----------------------------------------------------Made empty so that the root layer cannot be movedvoid SetDriver(DisplayDriver \*d)---------------------------------Assigns a particular display driver object to the root layer ifnon-NULL.void RebuildRegions(bool recursive=false)-----------------------------------------Rebuilds the visible and invalid layers based on the layer hierarchy.Used to update the regions after a call to remove or add a child layeris made or when a layer is hidden or shown.1. get the frame2. set full and visible regions to frame3. iterate through each child and exclude its full region from thevisible region if the child is visible.