Added system cursor support to CursorManager

Added some more classes to server for redraw and desktop management


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1504 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm
2002-10-12 23:31:49 +00:00
parent c890b606e6
commit 7be1a1b833
4 changed files with 695 additions and 16 deletions
@@ -29,59 +29,83 @@
Member Functions</P>
<P class="Body" style="margin: 0px"><BR>
</P>
<TABLE WIDTH=634 HEIGHT=156 BORDER=1 CELLPADDING=1 CELLSPACING=2>
<TABLE WIDTH=620 HEIGHT=178 BORDER=1 CELLPADDING=1 CELLSPACING=2>
<TR>
<TD WIDTH=216 HEIGHT=17>
<TD WIDTH=215 HEIGHT=17>
<P class="Body" style="margin: 0px">CursorManager(void)</P>
</TD>
<TD WIDTH=260 HEIGHT=17>
<TD WIDTH=250 HEIGHT=17>
<P class="Body" style="margin: 0px">~CursorManager(void)</P>
</TD>
</TR>
<TR>
<TD WIDTH=216 HEIGHT=17>
<TD WIDTH=215 HEIGHT=17>
<P class="Body" style="margin: 0px">int32 AddCursor(ServerCursor *c)</P>
</TD>
<TD WIDTH=260 HEIGHT=17>
<TD WIDTH=250 HEIGHT=17>
<P class="Body" style="margin: 0px">void DeleteCursor(int32 token)</P>
</TD>
</TR>
<TR>
<TD WIDTH=216 HEIGHT=17>
<TD WIDTH=215 HEIGHT=17>
<P class="Body" style="margin: 0px">void RemoveAppCursors(ServerApp *a)</P>
</TD>
<TD WIDTH=260 HEIGHT=17>
<TD WIDTH=250 HEIGHT=17>
<P class="Body" style="margin: 0px">void ShowCursor(void)</P>
</TD>
</TR>
<TR>
<TD WIDTH=216 HEIGHT=17>
<TD WIDTH=215 HEIGHT=17>
<P class="Body" style="margin: 0px">void HideCursor(void)</P>
</TD>
<TD WIDTH=260 HEIGHT=17>
<TD WIDTH=250 HEIGHT=17>
<P class="Body" style="margin: 0px">void ObscureCursor(void)</P>
</TD>
</TR>
<TR>
<TD WIDTH=216 HEIGHT=17>
<TD WIDTH=215 HEIGHT=17>
<P class="Body" style="margin: 0px">void SetCursor(int32 token)</P>
</TD>
<TD WIDTH=260 HEIGHT=17>
<TD WIDTH=250 HEIGHT=17>
<P class="Body" style="margin: 0px">ServerCursor *GetCursor(cursor_which which)</P>
</TD>
</TR>
<TR>
<TD WIDTH=216 HEIGHT=32>
<TD WIDTH=215 HEIGHT=32>
<P class="Body" style="margin: 0px">void SetCursor(cursor_which which)</P>
</TD>
<TD WIDTH=260 HEIGHT=32>
<TD WIDTH=250 HEIGHT=32>
<P class="Body" style="margin: 0px">void ChangeCursor(cursor_which which,</P>
<P class="Body" style="margin: 0px">int32 token)</P>
</TD>
</TR>
<TR>
<TD WIDTH=215 HEIGHT=17>
<P class="Body" style="margin: 0px">cursor_which GetCursorWhich(void)</P>
</TD>
<TD WIDTH=250 HEIGHT=17>
&nbsp;
</TD>
</TR>
</TABLE>
<P class="Body" style="margin: 0px"><BR>
<BR>
Enumerated Types:</P>
<P class="Body" style="margin: 0px"><BR>
cursor_which {</P>
<P class="Body" style="margin: 0px"> CURSOR_ARROW</P>
<P class="Body" style="margin: 0px"> CURSOR_TEXT</P>
<P class="Body" style="margin: 0px"> CURSOR_MOVE</P>
<P class="Body" style="margin: 0px"> CURSOR_DRAG</P>
<P class="Body" style="margin: 0px"> CURSOR_RESIZE</P>
<P class="Body" style="margin: 0px"> CURSOR_RESIZE_NW</P>
<P class="Body" style="margin: 0px"> CURSOR_RESIZE_SE</P>
<P class="Body" style="margin: 0px"> CURSOR_RESIZE_NS</P>
<P class="Body" style="margin: 0px"> CURSOR_RESIZE_EW</P>
<P class="Body" style="margin: 0px"> CURSOR_OTHER</P>
<P class="Body" style="margin: 0px">}</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<HR>
</P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">CursorManager(void)</span><span style="font-size: 16pt"></span></P>
@@ -146,11 +170,13 @@ These set the current cursor for the graphics driver to the passed cursor, eithe
<P class="Body" style="margin: 0px"><BR>
Token version:</P>
<P class="Body" style="margin: 0px">2) Find the cursor in the cursor list and call the graphics driver if non-NULL</P>
<P class="Body" style="margin: 0px">3) Iterate through list of system cursor tokens and see if there's a match. If so, set the internal cursor_which to the match.</P>
<P class="Body" style="margin: 0px"><BR>
cursor_which version:</P>
<P class="Body" style="margin: 0px">2) determine which cursor to use via a switch statement and call the graphics driver with the internal pointer for the appropriate cursor</P>
<P class="Body" style="margin: 0px">3) set the internal cursor_which to the one passed to the function</P>
<P class="Body" style="margin: 0px"><BR>
3) Release cursor lock</P>
4) Release cursor lock</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">ServerCursor *GetCursor(cursor_which which)</span></P>
@@ -172,6 +198,16 @@ Calling ChangeCursor will allow a user to change a system cursor's appearance. N
<P class="Body" style="margin: 0px">3) Look up the pointer for the system cursor in question and check to see if it is active. If active, then set the local active flag to true. Set the system cursor pointer to the one looked up.</P>
<P class="Body" style="margin: 0px">4) If active flag is true, call SetCursor()</P>
<P class="Body" style="margin: 0px">5) Release cursor lock</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">cursor_which GetCursorWhich(void)</span></P>
<P class="Body" style="margin: 0px"><BR>
Returns the current cursor_which attribute which describes the currently active cursor. If the active cursor is not a system cursor, it will return CURSOR_OTHER.</P>
<P class="Body" style="margin: 0px"><BR>
1) Acquire cursor lock</P>
<P class="Body" style="margin: 0px">2) Create a local cursor_which and assign it the value of the CursorManager's cursor_which</P>
<P class="Body" style="margin: 0px">3) Release cursor lock</P>
<P class="Body" style="margin: 0px">4) Return the local copy</P>
<DIV class="layer" id="Layer 1">
</DIV>
</DIV>
@@ -0,0 +1,259 @@
<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 Delete Workspace(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, create and populate workspace list</P>
<P class="Body" style="margin: 0px">4) Clear all workspaces</P>
<P class="Body" style="margin: 0px"><BR>
~Screen(void)</P>
<P class="Body" style="margin: 0px">void AddWorkspace(int32 index=-1)</P>
<P class="Body" style="margin: 0px">void Delete Workspace(int32 index)</P>
<P class="Body" style="margin: 0px">int32 CountWorkspaces(void)</P>
<P class="Body" style="margin: 0px">void SetWorkspaceCount(int32 count)</P>
<P class="Body" style="margin: 0px">int32 CurrentWorkspace(void)</P>
<P class="Body" style="margin: 0px">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=620 HEIGHT=69 BORDER=1 CELLPADDING=1 CELLSPACING=2>
<TR>
<TD WIDTH=232 HEIGHT=17>
<P class="Body" style="margin: 0px">Workspace(void)</P>
</TD>
<TD WIDTH=232 HEIGHT=17>
<P class="Body" style="margin: 0px">~Workspace(void)</P>
</TD>
</TR>
<TR>
<TD WIDTH=232 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=232 HEIGHT=17>
<P class="Body" style="margin: 0px">RootLayer *GetRoot(void)</P>
</TD>
<TD WIDTH=232 HEIGHT=17>
&nbsp;
</TD>
</TR>
</TABLE>
<P class="Body" style="margin: 0px"><BR>
<BR>
Workspace(void)</P>
<P class="Body" style="margin: 0px">~Workspace(void)</P>
<P class="Body" style="margin: 0px">void SetBGColor(const RGBColor &amp;c)</P>
<P class="Body" style="margin: 0px">RGBColor BGColor(void)</P>
<P class="Body" style="margin: 0px">RootLayer *GetRoot(void)</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>
+384
View File
@@ -0,0 +1,384 @@
<HTML>
<HEAD>
<TITLE>Layer.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">Layer class</span><span style="color: rgb(0,0,0); font-size: 24pt"></span></P>
<P class="Body" style="margin: 0px"><BR>
</P>
<P class="Body" style="margin: 0px">The Layer class is responsible for working with invalid regions and serves as the shadow class for BViews.</P>
<P class="Body" style="margin: 0px"><BR>
<HR>
Member Functions</P>
<P class="Body" style="margin: 0px"><BR>
</P>
<TABLE WIDTH=620 HEIGHT=479 BORDER=1 CELLPADDING=1 CELLSPACING=2>
<TR>
<TD WIDTH=307 HEIGHT=42>
<P class="Body" style="margin: 0px">Layer(BRect frame, const char *name, int32 resize, int32 flags, ServerWindow *win)</P>
</TD>
<TD WIDTH=312 HEIGHT=42>
<P class="Body" style="margin: 0px">~Layer(void)</P>
</TD>
</TR>
<TR>
<TD WIDTH=307 HEIGHT=42>
<P class="Body" style="margin: 0px">void AddChild(Layer *child, Layer *before=NULL, bool rebuild=true)</P>
</TD>
<TD WIDTH=312 HEIGHT=42>
<P class="Body" style="margin: 0px">RemoveChild(Layer *child, bool rebuild=true)</P>
</TD>
</TR>
<TR>
<TD WIDTH=307 HEIGHT=24>
<P class="Body" style="margin: 0px">void RemoveSelf(bool rebuild=true)</P>
</TD>
<TD WIDTH=312 HEIGHT=24>
<P class="Body" style="margin: 0px">void Invalidate(BRect r)</P>
</TD>
</TR>
<TR>
<TD WIDTH=307 HEIGHT=24>
<P class="Body" style="margin: 0px">void Invalidate(BRegion *region)</P>
</TD>
<TD WIDTH=312 HEIGHT=24>
<P class="Body" style="margin: 0px">BRect Frame(void)</P>
</TD>
</TR>
<TR>
<TD WIDTH=307 HEIGHT=24>
<P class="Body" style="margin: 0px">BRect Bounds(void)</P>
</TD>
<TD WIDTH=312 HEIGHT=24>
<P class="Body" style="margin: 0px">void MoveBy(BPoint pt)</P>
</TD>
</TR>
<TR>
<TD WIDTH=307 HEIGHT=24>
<P class="Body" style="margin: 0px">void MoveBy(float x, float y)</P>
</TD>
<TD WIDTH=312 HEIGHT=24>
<P class="Body" style="margin: 0px">void ResizeBy(BPoint pt)</P>
</TD>
</TR>
<TR>
<TD WIDTH=307 HEIGHT=24>
<P class="Body" style="margin: 0px">void ResizeBy(float x, float y)</P>
</TD>
<TD WIDTH=312 HEIGHT=24>
<P class="Body" style="margin: 0px">int32 CountChildren(void)</P>
</TD>
</TR>
<TR>
<TD WIDTH=307 HEIGHT=24>
<P class="Body" style="margin: 0px">bool IsDirty(void)</P>
</TD>
<TD WIDTH=312 HEIGHT=24>
<P class="Body" style="margin: 0px">BRect ConvertToTop(const BRect &amp;r)</P>
</TD>
</TR>
<TR>
<TD WIDTH=307 HEIGHT=24>
<P class="Body" style="margin: 0px">BRegion ConvertToTop(const BRegion &amp;r)</P>
</TD>
<TD WIDTH=312 HEIGHT=24>
<P class="Body" style="margin: 0px">BRect ConvertFromTop(const BRect &amp;r)</P>
</TD>
</TR>
<TR>
<TD WIDTH=307 HEIGHT=42>
<P class="Body" style="margin: 0px">BRegion ConvertFromTop(const BRegion &amp;r)</P>
</TD>
<TD WIDTH=312 HEIGHT=42>
<P class="Body" style="margin: 0px">BRect ConvertToParent(const BRect &amp;r)</P>
</TD>
</TR>
<TR>
<TD WIDTH=307 HEIGHT=42>
<P class="Body" style="margin: 0px">BRegion ConvertToParent(const BRegion &amp;r)</P>
</TD>
<TD WIDTH=312 HEIGHT=42>
<P class="Body" style="margin: 0px">BRect ConvertFromParent(const BRect &amp;r)</P>
</TD>
</TR>
<TR>
<TD WIDTH=307 HEIGHT=42>
<P class="Body" style="margin: 0px">BRegion ConvertFromParent(const BRegion &amp;r)</P>
</TD>
<TD WIDTH=312 HEIGHT=42>
<P class="Body" style="margin: 0px">void RebuildRegions(bool recursive=false)</P>
</TD>
</TR>
<TR>
<TD WIDTH=307 HEIGHT=24>
<P class="Body" style="margin: 0px">void MakeTopChild(void)</P>
</TD>
<TD WIDTH=312 HEIGHT=24>
<P class="Body" style="margin: 0px">void MakeBottomChild(void)</P>
</TD>
</TR>
<TR>
<TD WIDTH=307 HEIGHT=24>
<P class="Body" style="margin: 0px">void RequestDraw(const BRect &amp;r)</P>
</TD>
<TD WIDTH=312 HEIGHT=24>
<P class="Body" style="margin: 0px">Layer *FindLayer(int32 token)</P>
</TD>
</TR>
<TR>
<TD WIDTH=307 HEIGHT=42>
<P class="Body" style="margin: 0px">Layer *GetChildAt(BPoint pt, bool recursive=false)</P>
</TD>
<TD WIDTH=312 HEIGHT=42>
&nbsp;
</TD>
</TR>
</TABLE>
<P class="Body" style="margin: 0px"><BR>
<BR>
Global Functions</P>
<P class="Body" style="margin: 0px"><BR>
If there are any global functions associated with the class, they are listed here.</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<HR>
</P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">Layer(BRect frame, const char *name, int32 resize, int32 flags, ServerWindow *win)</span></P>
<P class="Body" style="margin: 0px"><BR>
1) acquire a new layer token</P>
<P class="Body" style="margin: 0px">2) validate (and fix, if necessary) parameters and assign to member objects</P>
<P class="Body" style="margin: 0px">3) initalize relation pointers to NULL</P>
<P class="Body" style="margin: 0px">4) set level to -1</P>
<P class="Body" style="margin: 0px">5) set invalid region to NULL</P>
<P class="Body" style="margin: 0px">6) set full and visible regions to bounds</P>
<P class="Body" style="margin: 0px">7) set child count to 0</P>
<P class="Body" style="margin: 0px">8) get ServerWindow's window port and create a PortLink pointed at it</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">~Layer(void)</span></P>
<P class="Body" style="margin: 0px"><BR>
1) if parent is non-NULL, call RemoveSelf()</P>
<P class="Body" style="margin: 0px">2) if topchild is non-NULL, iterate through children and delete them.</P>
<P class="Body" style="margin: 0px">3) delete invalid, full, and visible regions if non-NULL</P>
<P class="Body" style="margin: 0px">4) delete the internal PortLink</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">void AddChild(Layer *child, Layer *before=NULL, bool rebuild=true)</span></P>
<P class="Body" style="margin: 0px"><BR>
Function which corresponds to BView::AddChild</P>
<P class="Body" style="margin: 0px"><BR>
1) if child-&gt;parent is non-NULL, spew an error to stderr and return</P>
<P class="Body" style="margin: 0px">2) set child-&gt;parent to this</P>
<P class="Body" style="margin: 0px"><BR>
if before == NULL:</P>
<P class="Body" style="margin: 0px"> A) if topchild is non-NULL, set child-&gt;uppersibling to child</P>
<P class="Body" style="margin: 0px"> B) set child-&gt;lowersibling to topchild</P>
<P class="Body" style="margin: 0px"> C) if topchild is NULL, set bottomchild to child</P>
<P class="Body" style="margin: 0px"> D) set topchild to child</P>
<P class="Body" style="margin: 0px"><BR>
if before != NULL:</P>
<P class="Body" style="margin: 0px"> A) if before-&gt;upper is non-NULL, set child-&gt;upper to before-&gt;upper</P>
<P class="Body" style="margin: 0px"> B) set before-&gt;upper to child</P>
<P class="Body" style="margin: 0px"> C) set child-&gt;lower to before</P>
<P class="Body" style="margin: 0px"> D) if child-&gt;upper is non-NULL, set child-&gt;upper-&gt;lower to child</P>
<P class="Body" style="margin: 0px"> E) increment child's level</P>
<P class="Body" style="margin: 0px">3) increment the child count</P>
<P class="Body" style="margin: 0px">4) if rebuild flag is true, call RebuildRegions</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">RemoveChild(Layer *child, bool rebuild=true)</span></P>
<P class="Body" style="margin: 0px"><BR>
Function which corresponds to BView::RemoveChild</P>
<P class="Body" style="margin: 0px"><BR>
1) if child's parent != this, spew an error to stderr and return</P>
<P class="Body" style="margin: 0px">2) set child's parent to NULL</P>
<P class="Body" style="margin: 0px">3) set child's level to -1</P>
<P class="Body" style="margin: 0px">4) if top child matches child, set top child to child's lower sibling</P>
<P class="Body" style="margin: 0px">5) if bottom child matches child, set bottom child to child's upper sibilng</P>
<P class="Body" style="margin: 0px">6) if child-&gt;uppersibling is non-NULL, set its lowersibling to the child's lowersibling</P>
<P class="Body" style="margin: 0px">7) if child-&gt;lowersibling is non-NULL, set its uppersibling to the child's uppersibling</P>
<P class="Body" style="margin: 0px">8) decrement child count</P>
<P class="Body" style="margin: 0px">9) call RebuildRegions</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">void RemoveSelf(bool rebuild=true)</span></P>
<P class="Body" style="margin: 0px"><BR>
Function which corresponds to BView::RemoveSelf</P>
<P class="Body" style="margin: 0px"><BR>
1) if parent is NULL, spew an error to stderr and return</P>
<P class="Body" style="margin: 0px">2) call parent-&gt;RemoveChild(this)</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">void Invalidate(BRect r)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void Invalidate(BRegion *region)</span></P>
<P class="Body" style="margin: 0px"><BR>
Marks the area passed to the function as needing to be redrawn</P>
<P class="Body" style="margin: 0px"><BR>
1) if parent is NULL, return</P>
<P class="Body" style="margin: 0px">2) if the passed area intersects the layer's frame, add it to the invalid region, creating a new invalid object if necessary.</P>
<P class="Body" style="margin: 0px">3) Iterate through all child layers, calling child-&gt;Invalidate() on the area converted from the parent</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">BRect Frame(void)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">BRect Bounds(void)</span></P>
<P class="Body" style="margin: 0px"><BR>
Frame() returns the layer's frame in its parent coordinates. Bounds() returns the frame offset to (0,0).</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>
Moves the layer in its parent's coordinate space by the specified amount</P>
<P class="Body" style="margin: 0px"><BR>
1) offset the frame by the specified amount</P>
<P class="Body" style="margin: 0px">2) if parent is non-NULL, call parent-&gt;RebuildRegions()</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">void ResizeBy(BPoint pt)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void ResizeBy(float x, float y)</span></P>
<P class="Body" style="margin: 0px"><BR>
Resizes the layer by the specified amount and all children as appropriate.</P>
<P class="Body" style="margin: 0px"><BR>
1) resize the frame by the specified amount</P>
<P class="Body" style="margin: 0px">2) iterate through all children, checking the resize flags to see whether each should be resized and calling child-&gt;ResizeBy() by the appropriate amount if it is necessary.</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">int32 CountChildren(void)</span></P>
<P class="Body" style="margin: 0px"><BR>
Returns the number of children owned directly by the layer - grandchildren not included and some assembly required. Instructions are written in Yiddish.</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">bool IsDirty(void)</span></P>
<P class="Body" style="margin: 0px"><BR>
Returns true if the layer needs redrawn (if invalid region is non-NULL).</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">BRect ConvertToTop(const BRect &amp;r)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">BRegion ConvertToTop(const BRegion &amp;r)</span></P>
<P class="Body" style="margin: 0px"><BR>
Converts the given data to the coordinates of the root layer in the layer tree.</P>
<P class="Body" style="margin: 0px"><BR>
1) if parent is non-NULL, return the data.</P>
<P class="Body" style="margin: 0px">2) if parent is NULL, call this: return (parent-&gt;ConvertToTop( data_offset_by_frame.left_top ) )</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">BRect ConvertFromTop(const BRect &amp;r)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">BRegion ConvertFromTop(const BRegion &amp;r)</span></P>
<P class="Body" style="margin: 0px"><BR>
Converts the given data from the coordinates of the root layer in the layer tree.</P>
<P class="Body" style="margin: 0px"><BR>
1) if parent is non-NULL, return the layer's frame</P>
<P class="Body" style="margin: 0px">2) if parent is NULL, call this: return (parent-&gt;ConvertFromTop( data_offset_by_frame.left_and_top * -1 ) )</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">BRect ConvertToParent(const BRect &amp;r)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">BRegion ConvertToParent(const BRegion &amp;r)</span></P>
<P class="Body" style="margin: 0px"><BR>
Converts the given data to the coordinates of the parent layer</P>
<P class="Body" style="margin: 0px"><BR>
1) return the data offset by the layer's frame's top left point, i.e. frame.LeftTop()</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">BRect ConvertFromParent(const BRect &amp;r)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">BRegion ConvertFromParent(const BRegion &amp;r)</span></P>
<P class="Body" style="margin: 0px"><BR>
Converts the given data from the coordinates of the parent layer</P>
<P class="Body" style="margin: 0px"><BR>
1) operates exactly like ConvertToParent, except that the offset values are multiplied by -1</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>
<P class="Body" style="margin: 0px">4) iterate through each lowersibling and exclude its full region from the visible region if the it is visible and it intersects the layer's frame.</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">void MakeTopChild(void)</span></P>
<P class="Body" style="margin: 0px"><BR>
Makes the layer the top child owned by its parent. Note that the top child is "behind" other children on the screen.</P>
<P class="Body" style="margin: 0px"><BR>
1) if parent is NULL, spew an error to stderr and return</P>
<P class="Body" style="margin: 0px">2) if parent's top child equals this, return without doing anything</P>
<P class="Body" style="margin: 0px">3) if lowersibling and uppersibling are both NULL, return without doing anything</P>
<P class="Body" style="margin: 0px">4) save pointer to parent layer to a temporary variable</P>
<P class="Body" style="margin: 0px">5) call RemoveSelf and then the former parent's AddChild</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">void MakeBottomChild(void)</span></P>
<P class="Body" style="margin: 0px"><BR>
Makes the layer the bottom child owned by its parent. Note that the top child is "in front of" other children on the screen.</P>
<P class="Body" style="margin: 0px"><BR>
1) if parent is NULL, spew an error to stderr and return</P>
<P class="Body" style="margin: 0px">2) if parent's bottom child equals this, return without doing anything</P>
<P class="Body" style="margin: 0px">3) if lowersibling and uppersibling are both NULL, return without doing anything</P>
<P class="Body" style="margin: 0px">4) save pointer to parent layer to a temporary variable</P>
<P class="Body" style="margin: 0px">5) call RemoveSelf() with rebuild set to false</P>
<P class="Body" style="margin: 0px">6) call former parent's AddChild (rebuild is false), setting the before parameter to the former parent's bottomchild</P>
<P class="Body" style="margin: 0px">7) save lowersibling to a temporary variable</P>
<P class="Body" style="margin: 0px">8) call lowersibling-&gt;RemoveSelf() with no rebuild</P>
<P class="Body" style="margin: 0px">9) call the parent's AddChild() with the before set to this and rebuild set to true</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) if invalid is NULL, return</P>
<P class="Body" style="margin: 0px">2) set the PortLink opcode to B_DRAW</P>
<P class="Body" style="margin: 0px">3) create a BMessage(B_DRAW) and attach all invalid rectangles to it</P>
<P class="Body" style="margin: 0px">4) attach the view token to the message</P>
<P class="Body" style="margin: 0px">4) flatten the message to a buffer, attach it to the PortLink, and Flush() it.</P>
<P class="Body" style="margin: 0px">5) 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">Layer *FindLayer(int32 token)</span></P>
<P class="Body" style="margin: 0px"><BR>
Finds a child layer given an identifying token</P>
<P class="Body" style="margin: 0px"><BR>
1) iterate through children and check tokens. Return a match if found.</P>
<P class="Body" style="margin: 0px">2) iterate through children, calling its FindLayer function, return any non-NULL results</P>
<P class="Body" style="margin: 0px">3) return NULL - we got this far, so there is no match</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">Layer *GetChildAt(BPoint pt, bool recursive=false)</span></P>
<P class="Body" style="margin: 0px"><BR>
Gets the child at a given point. if recursive is true, all layers under the current one in the tree are searched. if the point is contained by the current layer's frame and no child is found, this function returns the current layer. if the point is outside the current layer's frame, it returns NULL</P>
<P class="Body" style="margin: 0px"><BR>
1) if frame does not contain the point, return NULL
</P>
<P class="Body" style="margin: 0px">if recursive is true:</P>
<P class="Body" style="margin: 0px"> A) start at the *bottom* child and iterate upward.</P>
<P class="Body" style="margin: 0px"> B) if the child has children, call the child's GetChildAt with the point converted to the child's coordinate space, returning any non-NULL results</P>
<P class="Body" style="margin: 0px"> C) if the child is hidden, continue to the next iteration</P>
<P class="Body" style="margin: 0px"> D) if the child's frame contains the point, return the child</P>
<P class="Body" style="margin: 0px"> E) if none of the children contain the point, return this</P>
<P class="Body" style="margin: 0px"><BR>
if recursive is false:</P>
<P class="Body" style="margin: 0px"> A) start at the *bottom* child and iterate upward.</P>
<P class="Body" style="margin: 0px"> B) if the child is hidden, continue to the next iteration</P>
<P class="Body" style="margin: 0px"> C) if the child's frame contains the point, return the child</P>
<P class="Body" style="margin: 0px"> D) if none of the children contain the point, return this</P>
<DIV class="layer" id="Layer 1">
</DIV>
</DIV>
</BODY>
</HTML>
+2 -2
View File
@@ -33,8 +33,8 @@
<dd>Font Infrastructure</dd>
<P>
<ul>
<li><a href="FontServer.htm">FontServer</li>
<li><a href="FontFamily.htm">FontFamily</li>
<li><a href="FontServer.htm">FontServer</a></li>
<li><a href="FontFamily.htm">FontFamily</a></li>
</ul>
<h3>Other Documents</h3>