diff --git a/docs/develop/servers/app_server/CursorManager.htm b/docs/develop/servers/app_server/CursorManager.htm index 366e47585d..286d3a6c3d 100644 --- a/docs/develop/servers/app_server/CursorManager.htm +++ b/docs/develop/servers/app_server/CursorManager.htm @@ -29,59 +29,83 @@ Member Functions


- +
- - - - - - - - - - - - + + + +
+

CursorManager(void)

+

~CursorManager(void)

+

int32 AddCursor(ServerCursor *c)

+

void DeleteCursor(int32 token)

+

void RemoveAppCursors(ServerApp *a)

+

void ShowCursor(void)

+

void HideCursor(void)

+

void ObscureCursor(void)

+

void SetCursor(int32 token)

+

ServerCursor *GetCursor(cursor_which which)

+

void SetCursor(cursor_which which)

+

void ChangeCursor(cursor_which which,

int32 token)

+

cursor_which GetCursorWhich(void)

+
+   +



+Enumerated Types:

+


+cursor_which {

+

CURSOR_ARROW

+

CURSOR_TEXT

+

CURSOR_MOVE

+

CURSOR_DRAG

+

CURSOR_RESIZE

+

CURSOR_RESIZE_NW

+

CURSOR_RESIZE_SE

+

CURSOR_RESIZE_NS

+

CURSOR_RESIZE_EW

+

CURSOR_OTHER

+

}

+


+


CursorManager(void)

@@ -146,11 +170,13 @@ These set the current cursor for the graphics driver to the passed cursor, eithe


Token version:

2) Find the cursor in the cursor list and call the graphics driver if non-NULL

+

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.


cursor_which version:

2) determine which cursor to use via a switch statement and call the graphics driver with the internal pointer for the appropriate cursor

+

3) set the internal cursor_which to the one passed to the function


-3) Release cursor lock

+4) Release cursor lock



ServerCursor *GetCursor(cursor_which which)

@@ -172,6 +198,16 @@ Calling ChangeCursor will allow a user to change a system cursor's appearance. N

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.

4) If active flag is true, call SetCursor()

5) Release cursor lock

+


+
+cursor_which GetCursorWhich(void)

+


+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.

+


+1) Acquire cursor lock

+

2) Create a local cursor_which and assign it the value of the CursorManager's cursor_which

+

3) Release cursor lock

+

4) Return the local copy

diff --git a/docs/develop/servers/app_server/DesktopClasses.htm b/docs/develop/servers/app_server/DesktopClasses.htm new file mode 100644 index 0000000000..d851a41b7e --- /dev/null +++ b/docs/develop/servers/app_server/DesktopClasses.htm @@ -0,0 +1,259 @@ + + +DesktopClasses.htm + + + +
+

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.

+
+
+
+ + diff --git a/docs/develop/servers/app_server/Layer.htm b/docs/develop/servers/app_server/Layer.htm new file mode 100644 index 0000000000..78f06d9a0a --- /dev/null +++ b/docs/develop/servers/app_server/Layer.htm @@ -0,0 +1,384 @@ + + +Layer.htm + + + +
+

Layer class

+


+

+

The Layer class is responsible for working with invalid regions and serves as the shadow class for BViews.

+


+


+ +Member Functions

+


+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Layer(BRect frame, const char *name, int32 resize, int32 flags, ServerWindow *win)

+
+

~Layer(void)

+
+

void AddChild(Layer *child, Layer *before=NULL, bool rebuild=true)

+
+

RemoveChild(Layer *child, bool rebuild=true)

+
+

void RemoveSelf(bool rebuild=true)

+
+

void Invalidate(BRect r)

+
+

void Invalidate(BRegion *region)

+
+

BRect Frame(void)

+
+

BRect Bounds(void)

+
+

void MoveBy(BPoint pt)

+
+

void MoveBy(float x, float y)

+
+

void ResizeBy(BPoint pt)

+
+

void ResizeBy(float x, float y)

+
+

int32 CountChildren(void)

+
+

bool IsDirty(void)

+
+

BRect ConvertToTop(const BRect &r)

+
+

BRegion ConvertToTop(const BRegion &r)

+
+

BRect ConvertFromTop(const BRect &r)

+
+

BRegion ConvertFromTop(const BRegion &r)

+
+

BRect ConvertToParent(const BRect &r)

+
+

BRegion ConvertToParent(const BRegion &r)

+
+

BRect ConvertFromParent(const BRect &r)

+
+

BRegion ConvertFromParent(const BRegion &r)

+
+

void RebuildRegions(bool recursive=false)

+
+

void MakeTopChild(void)

+
+

void MakeBottomChild(void)

+
+

void RequestDraw(const BRect &r)

+
+

Layer *FindLayer(int32 token)

+
+

Layer *GetChildAt(BPoint pt, bool recursive=false)

+
+   +
+


+
+Global Functions

+


+If there are any global functions associated with the class, they are listed here.

+


+
+


+

+

Layer(BRect frame, const char *name, int32 resize, int32 flags, ServerWindow *win)

+


+1) acquire a new layer token

+

2) validate (and fix, if necessary) parameters and assign to member objects

+

3) initalize relation pointers to NULL

+

4) set level to -1

+

5) set invalid region to NULL

+

6) set full and visible regions to bounds

+

7) set child count to 0

+

8) get ServerWindow's window port and create a PortLink pointed at it

+


+
+~Layer(void)

+


+1) if parent is non-NULL, call RemoveSelf()

+

2) if topchild is non-NULL, iterate through children and delete them.

+

3) delete invalid, full, and visible regions if non-NULL

+

4) delete the internal PortLink

+


+
+void AddChild(Layer *child, Layer *before=NULL, bool rebuild=true)

+


+Function which corresponds to BView::AddChild

+


+1) if child->parent is non-NULL, spew an error to stderr and return

+

2) set child->parent to this

+


+ if before == NULL:

+

A) if topchild is non-NULL, set child->uppersibling to child

+

B) set child->lowersibling to topchild

+

C) if topchild is NULL, set bottomchild to child

+

D) set topchild to child

+


+if before != NULL:

+

A) if before->upper is non-NULL, set child->upper to before->upper

+

B) set before->upper to child

+

C) set child->lower to before

+

D) if child->upper is non-NULL, set child->upper->lower to child

+

E) increment child's level

+

3) increment the child count

+

4) if rebuild flag is true, call RebuildRegions

+


+
+RemoveChild(Layer *child, bool rebuild=true)

+


+Function which corresponds to BView::RemoveChild

+


+1) if child's parent != this, spew an error to stderr and return

+

2) set child's parent to NULL

+

3) set child's level to -1

+

4) if top child matches child, set top child to child's lower sibling

+

5) if bottom child matches child, set bottom child to child's upper sibilng

+

6) if child->uppersibling is non-NULL, set its lowersibling to the child's lowersibling

+

7) if child->lowersibling is non-NULL, set its uppersibling to the child's uppersibling

+

8) decrement child count

+

9) call RebuildRegions

+


+
+void RemoveSelf(bool rebuild=true)

+


+Function which corresponds to BView::RemoveSelf

+


+1) if parent is NULL, spew an error to stderr and return

+

2) call parent->RemoveChild(this)

+


+
+void Invalidate(BRect r)

+

void Invalidate(BRegion *region)

+


+Marks the area passed to the function as needing to be redrawn

+


+1) if parent is NULL, return

+

2) if the passed area intersects the layer's frame, add it to the invalid region, creating a new invalid object if necessary.

+

3) Iterate through all child layers, calling child->Invalidate() on the area converted from the parent

+


+
+BRect Frame(void)

+

BRect Bounds(void)

+


+Frame() returns the layer's frame in its parent coordinates. Bounds() returns the frame offset to (0,0).

+


+
+void MoveBy(BPoint pt)

+

void MoveBy(float x, float y)

+


+Moves the layer in its parent's coordinate space by the specified amount

+


+1) offset the frame by the specified amount

+

2) if parent is non-NULL, call parent->RebuildRegions()

+


+
+void ResizeBy(BPoint pt)

+

void ResizeBy(float x, float y)

+


+Resizes the layer by the specified amount and all children as appropriate.

+


+1) resize the frame by the specified amount

+

2) iterate through all children, checking the resize flags to see whether each should be resized and calling child->ResizeBy() by the appropriate amount if it is necessary.

+


+
+int32 CountChildren(void)

+


+Returns the number of children owned directly by the layer - grandchildren not included and some assembly required. Instructions are written in Yiddish.

+


+
+bool IsDirty(void)

+


+Returns true if the layer needs redrawn (if invalid region is non-NULL).

+


+
+BRect ConvertToTop(const BRect &r)

+

BRegion ConvertToTop(const BRegion &r)

+


+Converts the given data to the coordinates of the root layer in the layer tree.

+


+1) if parent is non-NULL, return the data.

+

2) if parent is NULL, call this: return (parent->ConvertToTop( data_offset_by_frame.left_top ) )

+


+
+BRect ConvertFromTop(const BRect &r)

+

BRegion ConvertFromTop(const BRegion &r)

+


+Converts the given data from the coordinates of the root layer in the layer tree.

+


+1) if parent is non-NULL, return the layer's frame

+

2) if parent is NULL, call this: return (parent->ConvertFromTop( data_offset_by_frame.left_and_top * -1 ) )

+


+
+BRect ConvertToParent(const BRect &r)

+

BRegion ConvertToParent(const BRegion &r)

+


+Converts the given data to the coordinates of the parent layer

+


+1) return the data offset by the layer's frame's top left point, i.e. frame.LeftTop()

+


+
+BRect ConvertFromParent(const BRect &r)

+

BRegion ConvertFromParent(const BRegion &r)

+


+Converts the given data from the coordinates of the parent layer

+


+1) operates exactly like ConvertToParent, except that the offset values are multiplied by -1

+


+
+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.

+

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.

+


+
+void MakeTopChild(void)

+


+Makes the layer the top child owned by its parent. Note that the top child is "behind" other children on the screen.

+


+1) if parent is NULL, spew an error to stderr and return

+

2) if parent's top child equals this, return without doing anything

+

3) if lowersibling and uppersibling are both NULL, return without doing anything

+

4) save pointer to parent layer to a temporary variable

+

5) call RemoveSelf and then the former parent's AddChild

+


+
+void MakeBottomChild(void)

+


+Makes the layer the bottom child owned by its parent. Note that the top child is "in front of" other children on the screen.

+


+1) if parent is NULL, spew an error to stderr and return

+

2) if parent's bottom child equals this, return without doing anything

+

3) if lowersibling and uppersibling are both NULL, return without doing anything

+

4) save pointer to parent layer to a temporary variable

+

5) call RemoveSelf() with rebuild set to false

+

6) call former parent's AddChild (rebuild is false), setting the before parameter to the former parent's bottomchild

+

7) save lowersibling to a temporary variable

+

8) call lowersibling->RemoveSelf() with no rebuild

+

9) call the parent's AddChild() with the before set to this and rebuild set to true

+


+
+void RequestDraw(const BRect &r)

+


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

+


+1) if invalid is NULL, return

+

2) set the PortLink opcode to B_DRAW

+

3) create a BMessage(B_DRAW) and attach all invalid rectangles to it

+

4) attach the view token to the message

+

4) flatten the message to a buffer, attach it to the PortLink, and Flush() it.

+

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

+


+
+Layer *FindLayer(int32 token)

+


+Finds a child layer given an identifying token

+


+1) iterate through children and check tokens. Return a match if found.

+

2) iterate through children, calling its FindLayer function, return any non-NULL results

+

3) return NULL - we got this far, so there is no match

+


+
+Layer *GetChildAt(BPoint pt, bool recursive=false)

+


+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

+


+1) if frame does not contain the point, return NULL +

+

if recursive is true:

+

A) start at the *bottom* child and iterate upward.

+

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

+

C) if the child is hidden, continue to the next iteration

+

D) if the child's frame contains the point, return the child

+

E) if none of the children contain the point, return this

+


+if recursive is false:

+

A) start at the *bottom* child and iterate upward.

+

B) if the child is hidden, continue to the next iteration

+

C) if the child's frame contains the point, return the child

+

D) if none of the children contain the point, return this

+
+
+
+ + diff --git a/docs/develop/servers/app_server/toc.htm b/docs/develop/servers/app_server/toc.htm index 29f096ddf8..0107daa0ae 100644 --- a/docs/develop/servers/app_server/toc.htm +++ b/docs/develop/servers/app_server/toc.htm @@ -33,8 +33,8 @@
Font Infrastructure

Other Documents