Screen class

Workspace class

RootLayer class


The Screen class handles all infrastructure needed for each monitor/video card pair. The Workspace class holds data and supplies the infrastructure for drawing the screen.




Member Functions


Screen(DisplayDriver *gfxmodule, uint8 workspaces)

~Screen(void)

void AddWorkspace(int32 index=-1)

void Delete Workspace(int32 index)

int32 CountWorkspaces(void)

void SetWorkspaceCount(int32 count)

int32 CurrentWorkspace(void)

void 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)






Screen(DisplayDriver *gfxmodule, uint8 workspaces)


1) Set driver pointer to gfxmodule

2) If driver pointer is non-NULL and driver->Initialize() is true, set initialized flag to true

3) If initialized, create and populate workspace list

4) Clear all workspaces


~Screen(void)

void AddWorkspace(int32 index=-1)

void Delete Workspace(int32 index)

int32 CountWorkspaces(void)

void SetWorkspaceCount(int32 count)

int32 CurrentWorkspace(void)

void 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)

~Workspace(void)

void SetBGColor(const RGBColor &c)

RGBColor BGColor(void)

RootLayer *GetRoot(void)

 



Workspace(void)

~Workspace(void)

void SetBGColor(const RGBColor &c)

RGBColor BGColor(void)

RootLayer *GetRoot(void)



RootLayer class members


RootLayer(BRect frame, const char *name)

~RootLayer(void)

void RequestDraw(const BRect &r)

void MoveBy(float x, float y)

void MoveBy(BPoint pt)

void SetDriver(DisplayDriver *d)

void RebuildRegions(bool recursive=false)

 



RootLayer(BRect frame, const char *name)


1) passes B_FOLLOW_NONE to Layer constructor

2) set level to 0

3) set the background color to the color for the workspace set in the system preferences



~RootLayer(void)


Does nothing.



void RequestDraw(const BRect &r)


Requests that the layer be drawn on screen. The rectangle passed is in the layer's own coordinates.


1) call the display driver's FillRect on the rectangle, filling with the layer's background color

2) recurse through each child and call its RequestDraw() function if it intersects the child's frame



void MoveBy(BPoint pt)

void MoveBy(float x, float y)


Made empty so that the root layer cannot be moved



void SetDriver(DisplayDriver *d)


Assigns a particular display driver object to the root layer if non-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 layer is made or when a layer is hidden or shown.


1) get the frame

2) set full and visible regions to frame

3) iterate through each child and exclude its full region from the visible region if the child is visible.