Using Cursor Utilities
The YAAF libraries provide several routines for encapsulating the currently displayed cursor. This permits the interface to put up a 'wait' cursor, for example, or to put up a 'text edit' mouse cursor. There is also support for creating an animated cursor, such as a spinning beachball.
If you are using an animated 'wait' cursor, use InitCursorAnimation(). This takes an array of short integers which give the resource ID of the cursors that make up the animated sequence. (Note: this is not completely working yet on X Windows.)
To set the cursor to a particular cursor, use SetCursorID(). Several predefined cursor identifiers are provided which work on X which set the cursor to a particular cursor. Those predefined identifiers are:
KNormalCursor | The default cursor, an arrow pointed up and to the left. |
KIBeamCursor | The cursor to use to indicate text editing. |
KCrossCursor | A 'cross', usually used for drawing programs. |
KPlusCursor | A 'plus' cursor used for selecting items in a spreadsheet |
KWatchCursor | A small hourglass or watch cursor, used to indicate the system is busy. |
When the system is busy, repeatedly call WaitCursor(). This routine will either put up a watch cursor, or the next frame in the animated cursor sequence. When the calculation is done, call NormalCursor() to put up the cursor that was up before WaitCursor() was called.
Defined in <XCursorUtil.h>
void InitCursorAnimation(short *alist);
Provides an (optional) list of cursor resources to sequence through when WaitCursor() is repeatedly called. This routine does not have to be called; when it is not called, a watch cursor is displayed instead. The list of resources must be zero-terminated.
Defined in <XCursorUtil.h>
void SetCursorID(short cursorID);
Sets the cursor to the cursor specified. On the Macintosh this attempts to put up a color cursor; if one doesn't exist with the specified resource ID, this then looks for the black and white cursor with the same ID. If no cursor exists, this puts up the default normal cursor, an arrow cursor.
Defined in <XCursorUtil.h>
void WaitCursor(void);
This either displays the watch cursor or the next cursor in the animation sequence.
Defined in <XCursorUtil.h>
void NormalCursor(void);
This should be called after WaitCursor(), and puts up the cursor that was up before the first call to WaitCursor.