2002-09-02 04:14:11 +04:00
< HTML >
< HEAD >
< TITLE > CursorManager.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" > CursorManager 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 CursorManager class handles token creation, calling the cursor-related graphics driver functions, and freeing heap memory for all ServerCursor instances.< / P >
< P class = "Body" style = "margin: 0px" > < BR >
< BR >
< HR >
< / P >
< P class = "Body" style = "margin: 0px" > < BR >
Member Functions< / P >
< P class = "Body" style = "margin: 0px" > < BR >
< / P >
2002-10-13 03:31:49 +04:00
< TABLE WIDTH = 620 HEIGHT = 178 BORDER = 1 CELLPADDING = 1 CELLSPACING = 2 >
2002-09-02 04:14:11 +04:00
< TR >
2002-10-13 03:31:49 +04:00
< TD WIDTH = 215 HEIGHT = 17 >
2002-09-02 04:14:11 +04:00
< P class = "Body" style = "margin: 0px" > CursorManager(void)< / P >
< / TD >
2002-10-13 03:31:49 +04:00
< TD WIDTH = 250 HEIGHT = 17 >
2002-09-02 04:14:11 +04:00
< P class = "Body" style = "margin: 0px" > ~CursorManager(void)< / P >
< / TD >
< / TR >
< TR >
2002-10-13 03:31:49 +04:00
< TD WIDTH = 215 HEIGHT = 17 >
2002-09-02 04:14:11 +04:00
< P class = "Body" style = "margin: 0px" > int32 AddCursor(ServerCursor *c)< / P >
< / TD >
2002-10-13 03:31:49 +04:00
< TD WIDTH = 250 HEIGHT = 17 >
2002-09-02 04:14:11 +04:00
< P class = "Body" style = "margin: 0px" > void DeleteCursor(int32 token)< / P >
< / TD >
< / TR >
< TR >
2002-10-13 03:31:49 +04:00
< TD WIDTH = 215 HEIGHT = 17 >
2002-09-02 04:14:11 +04:00
< P class = "Body" style = "margin: 0px" > void RemoveAppCursors(ServerApp *a)< / P >
< / TD >
2002-10-13 03:31:49 +04:00
< TD WIDTH = 250 HEIGHT = 17 >
2002-09-02 04:14:11 +04:00
< P class = "Body" style = "margin: 0px" > void ShowCursor(void)< / P >
< / TD >
< / TR >
< TR >
2002-10-13 03:31:49 +04:00
< TD WIDTH = 215 HEIGHT = 17 >
2002-09-02 04:14:11 +04:00
< P class = "Body" style = "margin: 0px" > void HideCursor(void)< / P >
< / TD >
2002-10-13 03:31:49 +04:00
< TD WIDTH = 250 HEIGHT = 17 >
2002-09-02 04:14:11 +04:00
< P class = "Body" style = "margin: 0px" > void ObscureCursor(void)< / P >
< / TD >
< / TR >
< TR >
2002-10-13 03:31:49 +04:00
< TD WIDTH = 215 HEIGHT = 17 >
2002-09-02 04:14:11 +04:00
< P class = "Body" style = "margin: 0px" > void SetCursor(int32 token)< / P >
< / TD >
2002-10-13 03:31:49 +04:00
< TD WIDTH = 250 HEIGHT = 17 >
2002-09-02 04:14:11 +04:00
< P class = "Body" style = "margin: 0px" > ServerCursor *GetCursor(cursor_which which)< / P >
< / TD >
< / TR >
< TR >
2002-10-13 03:31:49 +04:00
< TD WIDTH = 215 HEIGHT = 32 >
2002-09-02 04:14:11 +04:00
< P class = "Body" style = "margin: 0px" > void SetCursor(cursor_which which)< / P >
< / TD >
2002-10-13 03:31:49 +04:00
< TD WIDTH = 250 HEIGHT = 32 >
2002-09-02 04:14:11 +04:00
< P class = "Body" style = "margin: 0px" > void ChangeCursor(cursor_which which,< / P >
< P class = "Body" style = "margin: 0px" > int32 token)< / P >
< / TD >
< / TR >
2002-10-13 03:31:49 +04:00
< TR >
< TD WIDTH = 215 HEIGHT = 17 >
< P class = "Body" style = "margin: 0px" > cursor_which GetCursorWhich(void)< / P >
< / TD >
< TD WIDTH = 250 HEIGHT = 17 >
< / TD >
< / TR >
2002-09-02 04:14:11 +04:00
< / TABLE >
< P class = "Body" style = "margin: 0px" > < BR >
< BR >
2002-10-13 03:31:49 +04:00
Enumerated Types:< / P >
< P class = "Body" style = "margin: 0px" > < BR >
cursor_which {< / P >
2002-12-08 00:39:48 +03:00
< P class = "Body" style = "margin: 0px" > CURSOR_DEFAULT< / P >
2002-10-13 03:31:49 +04:00
< 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 >
2002-09-02 04:14:11 +04:00
< HR >
< / P >
< P class = "Body" style = "margin: 0px" > < span class = "OBOS-Function-Def" > CursorManager(void)< / span > < span style = "font-size: 16pt" > < / span > < / P >
< P class = "Body" style = "margin: 0px" > < BR >
< BR >
1) Create the cursor list empty< / P >
< P class = "Body" style = "margin: 0px" > 2) Set the token index to 0< / P >
< P class = "Body" style = "margin: 0px" > 3) Allocate the default system cursor and pass it to AddCursor< / P >
< P class = "Body" style = "margin: 0px" > 4) Initialize the member pointer for the graphics driver< / P >
< P class = "Body" style = "margin: 0px" > 5) Create the cursorlock semaphore< / P >
< P class = "Body" style = "margin: 0px" > 6) Call SetDefaultCursor< / P >
< P class = "Body" style = "margin: 0px" > < BR >
< BR >
< span class = "OBOS-Function-Def" > ~CursorManager(void)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < BR >
1) Empty and delete the cursor list< / P >
< P class = "Body" style = "margin: 0px" > 2) Delete the cursorlock semaphore< / P >
< P class = "Body" style = "margin: 0px" > < BR >
< BR >
< span class = "OBOS-Function-Def" > int32 AddCursor(ServerCursor *sc)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < BR >
AddCursor() is used to register the cursor in question with the manager, allowing for the user application to have the identifying token, if necessary. The cursor becomes the property of the manager. If a user application deletes a BCursor, its ServerApp will call DeleteCursor().< / P >
< P class = "Body" style = "margin: 0px" > < BR >
1) Acquire cursor lock< / P >
< P class = "Body" style = "margin: 0px" > 2) Add *sc to the cursor list< / P >
< P class = "Body" style = "margin: 0px" > 3) Set sc-> token to the current token index value< / P >
< P class = "Body" style = "margin: 0px" > 4) Increment the token index< / P >
< P class = "Body" style = "margin: 0px" > 5) Assign sc-> token to temporary variable< / P >
< P class = "Body" style = "margin: 0px" > 6) Release cursor lock< / P >
< P class = "Body" style = "margin: 0px" > 7) Return the saved token value< / P >
< P class = "Body" style = "margin: 0px" > < BR >
< BR >
< span class = "OBOS-Function-Def" > void DeleteCursor(int32 ctoken)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < BR >
1) Acquire cursor lock< / P >
< P class = "Body" style = "margin: 0px" > 2) Iterate through the cursor list, looking for ctoken< / P >
< P class = "Body" style = "margin: 0px" > 3) If any ServerCursor-> token equals ctoken, remove and delete it< / P >
< P class = "Body" style = "margin: 0px" > 4) Release cursor lock< / P >
< P class = "Body" style = "margin: 0px" > < BR >
< BR >
< span class = "OBOS-Function-Def" > void RemoveAppCursors(ServerApp *app)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < BR >
1) Acquire cursor lock< / P >
< P class = "Body" style = "margin: 0px" > 2) Iterate through the cursor list, checking each cursor's ServerApp pointer< / P >
< P class = "Body" style = "margin: 0px" > 3) If any have a ServerApp pointer which matches the passed pointer, remove and delete them< / P >
< P class = "Body" style = "margin: 0px" > 4) Release cursor lock< / P >
< P class = "Body" style = "margin: 0px" > < BR >
< BR >
< span class = "OBOS-Function-Def" > void ShowCursor(void)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < span class = "OBOS-Function-Def" > void HideCursor(void)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < span class = "OBOS-Function-Def" > void ObscureCursor(void)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < BR >
Simple pass-through functions which call the graphics driver's functions. Note that acquiring the cursor lock will be necessary for all three calls.< / P >
< P class = "Body" style = "margin: 0px" > < BR >
< BR >
< span class = "OBOS-Function-Def" > void SetCursor(int32 token)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < span class = "OBOS-Function-Def" > void SetCursor(cursor_which cursor)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < BR >
These set the current cursor for the graphics driver to the passed cursor, either one previously added via AddCursor or a system cursor.< / P >
< P class = "Body" style = "margin: 0px" > < BR >
1) Acquire cursor lock< / P >
< 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 >
2002-10-13 03:31:49 +04:00
< 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 >
2002-09-02 04:14:11 +04:00
< 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 >
2002-10-13 03:31:49 +04:00
< P class = "Body" style = "margin: 0px" > 3) set the internal cursor_which to the one passed to the function< / P >
2002-09-02 04:14:11 +04:00
< P class = "Body" style = "margin: 0px" > < BR >
2002-10-13 03:31:49 +04:00
4) Release cursor lock< / P >
2002-09-02 04:14:11 +04:00
< P class = "Body" style = "margin: 0px" > < BR >
< BR >
< span class = "OBOS-Function-Def" > ServerCursor *GetCursor(cursor_which which)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < BR >
GetCursor is intended for use in figuring out what cursor is in use for a particular system cursor.< / P >
< P class = "Body" style = "margin: 0px" > < BR >
1) Acquire cursor lock< / P >
< P class = "Body" style = "margin: 0px" > 2) use a switch statement to figure which cursor to return and assign a temporary pointer its value< / P >
< P class = "Body" style = "margin: 0px" > 3) Release cursor lock< / P >
< P class = "Body" style = "margin: 0px" > 4) Return the temporary pointer< / P >
< P class = "Body" style = "margin: 0px" > < BR >
< BR >
< span class = "OBOS-Function-Def" > void ChangeCursor(cursor_which which, int32 token)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < BR >
Calling ChangeCursor will allow a user to change a system cursor's appearance. Note that in calling this, the cursor changes ownership and belongs to the system. Thus, the BCursor destructor will not ultimately cause the cursor to be deleted.< / P >
< P class = "Body" style = "margin: 0px" > < BR >
1) Acquire cursor lock< / P >
< P class = "Body" style = "margin: 0px" > 2) Call FindCursor and, if NULL, release the cursor lock and return< / P >
< 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 >
2002-10-13 03:31:49 +04:00
< 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 >
2002-09-02 04:14:11 +04:00
< DIV class = "layer" id = "Layer 1" >
< / DIV >
< / DIV >
< / BODY >
< / HTML >