haiku/docs/develop/servers/app_server/DesktopClasses.htm

344 lines
15 KiB
HTML

<HTML>
<HEAD>
<TITLE>DesktopClasses.htm</TITLE>
<style type="text/css">
<!--
.Default {background-color: rgb(255,255,255); color: rgb(0,0,0); font-family: 'Dutch801 Rm BT'; font-size: 12pt}
.OBOS-Function-Def {background-color: rgb(255,255,255); color: rgb(0,0,0); font-family: 'Dutch801 Rm BT'; font-size: 16pt}
.OBOS-Title {background-color: rgb(255,255,255); color: rgb(0,128,0); font-family: 'Dutch801 Rm BT'; font-size: 24pt}
.Text-Background {background-color: rgb(255,255,255)}
.GR-Default {}
.Body {margin: 0px}
.Footer {margin: 0px}
.Header {margin: 0px}
.WP-Default {text-align: left; text-indent: 0px; margin-left: 0px; margin-right: 0px}
-->
</style>
</HEAD>
<BODY BGCOLOR="#ffffff">
<DIV class="sheet" id="Sheet 1">
<P class="Body" style="margin: 0px"><span class="OBOS-Title">Screen class</span><span style="color: rgb(0,0,0); font-size: 24pt"></span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Title">Workspace class</span><span style="color: rgb(0,0,0); font-size: 24pt"></span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Title">RootLayer class</span><span style="color: rgb(0,0,0); font-size: 24pt"></span></P>
<P class="Body" style="margin: 0px"><BR>
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.</P>
<P class="Body" style="margin: 0px"><BR>
<HR>
</P>
<P class="Body" style="margin: 0px"><BR>
Member Functions</P>
<P class="Body" style="margin: 0px"><BR>
</P>
<TABLE WIDTH=616 HEIGHT=264 BORDER=1 CELLPADDING=1 CELLSPACING=2>
<TR>
<TD WIDTH=227 HEIGHT=32>
<P class="Body" style="margin: 0px">Screen(DisplayDriver *gfxmodule, uint8 workspaces)</P>
</TD>
<TD WIDTH=235 HEIGHT=32>
<P class="Body" style="margin: 0px">~Screen(void)</P>
</TD>
</TR>
<TR>
<TD WIDTH=227 HEIGHT=17>
<P class="Body" style="margin: 0px">void AddWorkspace(int32 index=-1)</P>
</TD>
<TD WIDTH=235 HEIGHT=17>
<P class="Body" style="margin: 0px">void DeleteWorkspace(int32 index)</P>
</TD>
</TR>
<TR>
<TD WIDTH=227 HEIGHT=17>
<P class="Body" style="margin: 0px">int32 CountWorkspaces(void)</P>
</TD>
<TD WIDTH=235 HEIGHT=17>
<P class="Body" style="margin: 0px">void SetWorkspaceCount(int32 count)</P>
</TD>
</TR>
<TR>
<TD WIDTH=227 HEIGHT=17>
<P class="Body" style="margin: 0px">int32 CurrentWorkspace(void)</P>
</TD>
<TD WIDTH=235 HEIGHT=17>
<P class="Body" style="margin: 0px">void SetWorkspace(int32 workspace)</P>
</TD>
</TR>
<TR>
<TD WIDTH=227 HEIGHT=17>
<P class="Body" style="margin: 0px">void Activate(bool active=true)</P>
</TD>
<TD WIDTH=235 HEIGHT=17>
<P class="Body" style="margin: 0px">DisplayDriver *GetDriver(void)</P>
</TD>
</TR>
<TR>
<TD WIDTH=227 HEIGHT=32>
<P class="Body" style="margin: 0px">status_t SetSpace(int32 index, int32 res, bool stick=true)</P>
</TD>
<TD WIDTH=235 HEIGHT=32>
<P class="Body" style="margin: 0px">void AddWindow(ServerWindow *win, int32 workspace=B_CURRENT_WORKSPACE)</P>
</TD>
</TR>
<TR>
<TD WIDTH=227 HEIGHT=17>
<P class="Body" style="margin: 0px">void RemoveWindow(ServerWindow *win)</P>
</TD>
<TD WIDTH=235 HEIGHT=17>
<P class="Body" style="margin: 0px">ServerWindow *ActiveWindow(void)</P>
</TD>
</TR>
<TR>
<TD WIDTH=227 HEIGHT=32>
<P class="Body" style="margin: 0px">void SetActiveWindow(ServerWindow *win)</P>
</TD>
<TD WIDTH=235 HEIGHT=32>
<P class="Body" style="margin: 0px">Layer *GetRootLayer(int32 workspace=B_CURRENT_WORKSPACE)</P>
</TD>
</TR>
<TR>
<TD WIDTH=227 HEIGHT=17>
<P class="Body" style="margin: 0px">bool IsInitialized(void)</P>
</TD>
<TD WIDTH=235 HEIGHT=17>
<P class="Body" style="margin: 0px">Workspace *GetActiveWorkspace(void)</P>
</TD>
</TR>
</TABLE>
<P class="Body" style="margin: 0px"><BR>
<BR>
<BR>
<HR>
</P>
<P class="Body" style="margin: 0px"><BR>
<span class="OBOS-Function-Def">Screen(DisplayDriver *gfxmodule, uint8 workspaces)</span></P>
<P class="Body" style="margin: 0px"><BR>
1) Set driver pointer to gfxmodule</P>
<P class="Body" style="margin: 0px">2) If driver pointer is non-NULL and driver-&gt;Initialize() is true, set initialized flag to true</P>
<P class="Body" style="margin: 0px">3) If initialized, get the appropriate display driver info and save it internally</P>
<P class="Body" style="margin: 0px">4) Create and populate workspace list</P>
<P class="Body" style="margin: 0px">5) Clear all workspaces</P>
<P class="Body" style="margin: 0px"><BR>
<span class="OBOS-Function-Def">~Screen(void)</span></P>
<P class="Body" style="margin: 0px"><BR>
1) Remove all workspaces from the list and delete them</P>
<P class="Body" style="margin: 0px">2) Delete the workspace list</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">void AddWorkspace(int32 index=-1)</span></P>
<P class="Body" style="margin: 0px"><BR>
Adds a workspace to the screen object, setting its settings to the default, and adding it to the list in the specified index or the end of the list if the index is -1</P>
<P class="Body" style="margin: 0px"><BR>
1) Create a workspace object</P>
<P class="Body" style="margin: 0px">2) Add it to the workspace list - to the end if the index is -1, and to the particular index if not</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">void DeleteWorkspace(int32 index)</span></P>
<P class="Body" style="margin: 0px"><BR>
Deletes the workspace at the specified index.</P>
<P class="Body" style="margin: 0px"><BR>
1) Remove the item at the specified index and if non-NULL, delete it.</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">int32 CountWorkspaces(void)</span></P>
<P class="Body" style="margin: 0px"><BR>
Returns the number of workspaces kept by the particular Screen objects</P>
<P class="Body" style="margin: 0px"><BR>
1) Return the workspace list's CountItems() value</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">void SetWorkspaceCount(int32 count)</span></P>
<P class="Body" style="margin: 0px"><BR>
Sets the number of workspaces available to <span style="font-style: italic">count</span>. If <span style="font-style: italic">count</span> is less than the number of current workspaces, the last workspaces are deleted first. Workspaces are added to the end of the list. If a delete workspace should include the active workspace, then the workspace with the index <span style="font-style: italic">count-1</span> is activated. There must be at least one workspace.</P>
<P class="Body" style="margin: 0px"><BR>
1) if count equals the workspace list's CountItems value, return</P>
<P class="Body" style="margin: 0px">2) If count is less than 1, set count to 1. If greater than 32, set to 32.</P>
<P class="Body" style="margin: 0px">3) If active workspace index is greater than count-1, call SetWorkspace(count-1)</P>
<P class="Body" style="margin: 0px">4) If count is greater than the workspace list's CountItems value, call AddWorkspace the appropriate number of times.</P>
<P class="Body" style="margin: 0px">5) If count is less than the workspace list's CountItems, call RemoveWorkspace the appropriate number of times</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">int32 CurrentWorkspace(void)</span></P>
<P class="Body" style="margin: 0px"><BR>
Returns the active workspace index</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
void SetWorkspace(int32 workspace)</P>
<P class="Body" style="margin: 0px">void Activate(bool active=true)</P>
<P class="Body" style="margin: 0px">DisplayDriver *GetDriver(void)</P>
<P class="Body" style="margin: 0px">status_t SetSpace(int32 index, int32 res, bool stick=true)</P>
<P class="Body" style="margin: 0px">void AddWindow(ServerWindow *win, int32 workspace=B_CURRENT_WORKSPACE)</P>
<P class="Body" style="margin: 0px">void RemoveWindow(ServerWindow *win)</P>
<P class="Body" style="margin: 0px">ServerWindow *ActiveWindow(void)</P>
<P class="Body" style="margin: 0px">void SetActiveWindow(ServerWindow *win)</P>
<P class="Body" style="margin: 0px">Layer *GetRootLayer(int32 workspace=B_CURRENT_WORKSPACE)</P>
<P class="Body" style="margin: 0px">bool IsInitialized(void)</P>
<P class="Body" style="margin: 0px">Workspace *GetActiveWorkspace(void)</P>
<P class="Body" style="margin: 0px"><BR>
<HR>
</P>
<P class="Body" style="margin: 0px">Workspace class members</P>
<P class="Body" style="margin: 0px"><BR>
</P>
<TABLE WIDTH=610 HEIGHT=150 BORDER=1 CELLPADDING=1 CELLSPACING=2>
<TR>
<TD WIDTH=225 HEIGHT=32>
<P class="Body" style="margin: 0px">Workspace(graphics_card_info *gcinfo, frame_buffer_info *fbinfo)</P>
</TD>
<TD WIDTH=232 HEIGHT=32>
<P class="Body" style="margin: 0px">~Workspace(void)</P>
</TD>
</TR>
<TR>
<TD WIDTH=225 HEIGHT=17>
<P class="Body" style="margin: 0px">void SetBGColor(const RGBColor &amp;c)</P>
</TD>
<TD WIDTH=232 HEIGHT=17>
<P class="Body" style="margin: 0px">RGBColor BGColor(void)</P>
</TD>
</TR>
<TR>
<TD WIDTH=225 HEIGHT=32>
<P class="Body" style="margin: 0px">RootLayer *GetRoot(void)</P>
</TD>
<TD WIDTH=232 HEIGHT=32>
<P class="Body" style="margin: 0px">void SetData(graphics_card_info *gcinfo, frame_buffer_info *fbinfo)</P>
</TD>
</TR>
<TR>
<TD WIDTH=225 HEIGHT=32>
<P class="Body" style="margin: 0px">void GetData(graphics_card_info *gcinfo, frame_buffer_info *fbinfo)</P>
</TD>
<TD WIDTH=232 HEIGHT=32>
&nbsp;
</TD>
</TR>
</TABLE>
<P class="Body" style="margin: 0px"><BR>
<BR>
<BR>
<span class="OBOS-Function-Def">Workspace(void)</span></P>
<P class="Body" style="margin: 0px"><BR>
1) Set background color to RGB(51,102,160)</P>
<P class="Body" style="margin: 0px">2) Copy frame_buffer_info and graphics_card_info structure values</P>
<P class="Body" style="margin: 0px">3) Create a RootLayer object using the values from the two structures</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">~Workspace(void)</span></P>
<P class="Body" style="margin: 0px"><BR>
1) Call the RootLayer object's PruneTree method and delete it</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">void SetBGColor(const RGBColor &amp;c)</span></P>
<P class="Body" style="margin: 0px"><BR>
Sets the particular color for the workspace. Note that this does not refresh the display.</P>
<P class="Body" style="margin: 0px"><BR>
1) Set the internal background RGBColor object to the color parameter</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">RGBColor BGColor(void)</span></P>
<P class="Body" style="margin: 0px"><BR>
Returns the internal background color</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">RootLayer *GetRoot(void)</span></P>
<P class="Body" style="margin: 0px"><BR>
Returns the pointer to the RootLayer object</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">void SetData(graphics_card_info *gcinfo, frame_buffer_info *fbinfo)</span></P>
<P class="Body" style="margin: 0px"><BR>
Changes the graphics data and resizes the RootLayer accordingly.</P>
<P class="Body" style="margin: 0px"><BR>
1) Copy the two structures to the internal one</P>
<P class="Body" style="margin: 0px">2) Resize the RootLayer</P>
<P class="Body" style="margin: 0px">3) If the RootLayer was resized larger, Invalidate the new areas</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">void GetData(graphics_card_info *gcinfo, frame_buffer_info *fbinfo)</span></P>
<P class="Body" style="margin: 0px"><BR>
Copies the two data structures into the parameters passed.</P>
<P class="Body" style="margin: 0px"><BR>
<HR>
</P>
<P class="Body" style="margin: 0px">RootLayer class members</P>
<P class="Body" style="margin: 0px"><BR>
</P>
<TABLE WIDTH=618 HEIGHT=91 BORDER=1 CELLPADDING=1 CELLSPACING=2>
<TR>
<TD WIDTH=231 HEIGHT=17>
<P class="Body" style="margin: 0px">RootLayer(BRect frame, const char *name)</P>
</TD>
<TD WIDTH=232 HEIGHT=17>
<P class="Body" style="margin: 0px">~RootLayer(void)</P>
</TD>
</TR>
<TR>
<TD WIDTH=231 HEIGHT=17>
<P class="Body" style="margin: 0px">void RequestDraw(const BRect &amp;r)</P>
</TD>
<TD WIDTH=232 HEIGHT=17>
<P class="Body" style="margin: 0px">void MoveBy(float x, float y)</P>
</TD>
</TR>
<TR>
<TD WIDTH=231 HEIGHT=17>
<P class="Body" style="margin: 0px">void MoveBy(BPoint pt)</P>
</TD>
<TD WIDTH=232 HEIGHT=17>
<P class="Body" style="margin: 0px">void SetDriver(DisplayDriver *d)</P>
</TD>
</TR>
<TR>
<TD WIDTH=231 HEIGHT=17>
<P class="Body" style="margin: 0px">void RebuildRegions(bool recursive=false)</P>
</TD>
<TD WIDTH=232 HEIGHT=17>
&nbsp;
</TD>
</TR>
</TABLE>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">RootLayer(BRect frame, const char *name)</span></P>
<P class="Body" style="margin: 0px"><BR>
1) passes B_FOLLOW_NONE to Layer constructor</P>
<P class="Body" style="margin: 0px">2) set level to 0</P>
<P class="Body" style="margin: 0px">3) set the background color to the color for the workspace set in the system preferences</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">~RootLayer(void)</span></P>
<P class="Body" style="margin: 0px"><BR>
Does nothing.</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">void RequestDraw(const BRect &amp;r)</span></P>
<P class="Body" style="margin: 0px"><BR>
Requests that the layer be drawn on screen. The rectangle passed is in the layer's own coordinates.</P>
<P class="Body" style="margin: 0px"><BR>
1) call the display driver's FillRect on the rectangle, filling with the layer's background color</P>
<P class="Body" style="margin: 0px">2) recurse through each child and call its RequestDraw() function if it intersects the child's frame</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">void MoveBy(BPoint pt)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void MoveBy(float x, float y)</span></P>
<P class="Body" style="margin: 0px"><BR>
Made empty so that the root layer cannot be moved</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">void SetDriver(DisplayDriver *d)</span></P>
<P class="Body" style="margin: 0px"><BR>
Assigns a particular display driver object to the root layer if non-NULL.</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">void RebuildRegions(bool recursive=false)</span></P>
<P class="Body" style="margin: 0px"><BR>
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.</P>
<P class="Body" style="margin: 0px"><BR>
1) get the frame</P>
<P class="Body" style="margin: 0px">2) set full and visible regions to frame</P>
<P class="Body" style="margin: 0px">3) iterate through each child and exclude its full region from the visible region if the child is visible.</P>
<DIV class="layer" id="Layer 1">
</DIV>
</DIV>
</BODY>
</HTML>