AlCursor
 
 
 

Interface to Alias cursors. Note that some of this class’s methods are not available on Windows.

Synposis

#include <AlCursor.h>
class  AlCursor
enum 
{ kArrowSquare=0, kEmpty, kHourGlass, kEyeDropper, kFullEyeDropper,
kMove, kSelect, kInsert, kDelete, kCross, kTarget } Predefined;
static statusCode	push( int id );
static statusCode	pop( void );
static int	define( const char*,int,int,int,int );
static int	define( const char*,int,int,int,int,const char*,int,int );
static statusCode	remove( int id );

Description

This class allows you to display and define cursors inside of OpenAlias. Predefined cursors can be used or custom cursors can be created. Cursors are maintained using a stack of ID numbers. When a cursor image is set, its ID is pushed onto the stack. When a cursor is popped, its image is restored to the previous image.

statusCode AlCursor::push( int id )

Description

Sets the current cursor to the given ID number and pushes

the ID onto the stack. ’ID’ can be either a custom ID returned by AlCursor::define() or one of the default types (Predefined::kArrowSquare, Predefined::kEmpty, Predefined::kHourGlass, Predefined::kEyeDropper, Predefined::kFullEyeDropper, Predefined::kMove, Predefined::kSelect, Predefined::kInsert, Predefined::kDelete, Predefined::kCross, or Predefined::kTarget).

Arguments

id - the id to set the cursor image to

Return Codes

sSuccess - the cursor image changed

sInvalidArgument - the cursor ID value was not valid

statusCode AlCursor::pop( void )

Description

Restores the cursor image to its previous state.

Return Codes

sSuccess - worked

int AlCursor::define( const char* image, int imageWidth, int imageHeight, int imageHotSpotX, int imageHotSpotY, const char* mask, int maskWidth, int maskHeight )

Description

Creates a new cursor using a mask. These parameters are used in conjunction with XCreatePixmapFromBitmapData(). The mask can be used to create a blank region around the image.

NOTE: this method always fails on the Windows.

Arguments

image - pointer to the bitmap data

imageWidth, imageHeight - image bitmap size

imageHotSpotX, imageHotSpotY - where the cursor’s hot spot is located

mask - pointer to the mask data

maskWidth, maskHeight - mask bitmap size

Return values

The new ID of the cursor is returned as a positive number. -1 indicates a failure;

int AlCursor::define( const char* image, int imageWidth, int imageHeight, int imageHotSpotX, int imageHotSpotY )

Description

Creates a new cursor (the cursor image is also used as the mask).

NOTE: this method always fails on the Windows.

Arguments

image - pointer to the bitmap data

imageWidth, imageHeight - image bitmap size

imageHotSpotX, imageHotSpotY - where the cursor’s hot spot is located

Return values

The new ID of the cursor is returned as a positive number. -1 indicates a failure;

statusCode AlCursor::remove( int id )

Description

Deletes the given cursor id.

Arguments

id - the cursor to remove

Return Codes

sSuccess - the cursor image was deleted

sInvalidArgument - the cursor ID value was a default cursor

sFailure - the cursor ID value could not be found