typedef object cursor;
cursor newcursor(point hotspot, image img); cursor loadcursor(char *name); /* load a cursor from a file */ void del(cursor c); /* destroy a cursor */ void setcursor(cursor c); /* change current cursor */ cursor currentcursor(void); /* find current cursor */
extern cursor ArrowCursor; /* normal arrow cursor */ extern cursor BlankCursor; /* invisible cursor */ extern cursor WatchCursor; /* wait for the computer */ extern cursor CaretCursor; /* insert text */ extern cursor TextCursor; /* insert text */ extern cursor HandCursor; /* hand pointer */
A cursor is an object representing the shape of the mouse pointer on the screen.
New cursors can be created using the newcursor function. The hotspot point is where the 'tip' of the mouse pointer should be, and the image defines the shape of the cursor. The image can have transparent regions, and currently must only use Black, White and Transparent colours, and must also be exactly 16 by 16 pixels in size.
Alternately, cursors can be loaded from a file. The loadcursor function returns the named cursor, or NULL if it cannot be found. This function first looks for a file with the given name, and if it cannot find such a file it will attempt to look in the application's resources (Macintosh and Windows platforms only).
The memory used by a cursor can be reclaimed by calling del. Normally this is not necessary, since cursors take up very little space.
The setcursor function changes the shape of the mouse cursor on the screen to a given cursor. The currentcursor function returns the currently displayed cursor.
A number of pre-defined cursors are available, however the library must have already been initialised or these cursors will be NULL.