GrSetCursor()

Name

GrSetCursor() -- Specify a mouse cursor image

Synopsis

void GrSetCursor ( GR_WINDOW_ID wid , GR_SIZE width , GR_SIZE height , GR_COORD hotx , GR_COORD hoty , GR_COLOR foreground , GR_COLOR background , GR_BITMAP * fgbitmap , GR_BITMAP * bgbitmap );

Description

This function allows you to specify the image to use as the mouse pointer for the specified window and it's children.

Note

Pixels that are not set in either the foreground or the background bitmaps will be transparent.

Parameters

TypeNameDescription
GR_WINDOW_IDwidThe ID of the window to set the cursor for.
GR_SIZEwidthThe width of the pointer bitmap in pixels.
GR_SIZEheightThe height of the pointer bitmap in pixels.
GR_COORDhotxThe X coordinate within the bitmap used as the target for the pointer.
GR_COORDhotyThe Y coordinate within the bitmap used as the target for the pointer.
GR_COLORforegroundThe color to use for the foreground bitmap image.
GR_COLORbackgroundThe color to use for the background bitmap image.
GR_BITMAP*fgbitmapPointer to a bitmap data array to use as the foreground bitmap.
GR_BITMAP*bgbitmapPointer to a bitmap data array to use as the background bitmap.

Example

Example 2-1. Using GrSetCursor()

 
void set_x_cursor (GR_WINDOW_ID wid)
{
    GR_BITMAP fg_bitmap[16];
    GR_BITMAP bg_bitmap[16];

    fg_bitmap[0]  = 0x8001;  /* X______________X */
    fg_bitmap[1]  = 0x4002;  /* _X____________X_ */
    fg_bitmap[2]  = 0x2004;  /* __X__________X__ */
    fg_bitmap[3]  = 0x1008;  /* ___X________X___ */
    fg_bitmap[4]  = 0x0810;  /* ____X______X____ */
    fg_bitmap[5]  = 0x0420;  /* _____X____X_____ */
    fg_bitmap[6]  = 0x0240;  /* ______X__X______ */
    fg_bitmap[7]  = 0x0180;  /* _______XX_______ */
    fg_bitmap[8]  = 0x0180;  /* _______XX_______ */
    fg_bitmap[9]  = 0x0240;  /* ______X__X______ */
    fg_bitmap[10] = 0x0420;  /* _____X____X_____ */
    fg_bitmap[11] = 0x0810;  /* ____X______X____ */
    fg_bitmap[12] = 0x1008;  /* ___X________X___ */
    fg_bitmap[13] = 0x2004;  /* __X__________X__ */
    fg_bitmap[14] = 0x4002;  /* _X____________X_ */
    fg_bitmap[15] = 0x8001;  /* X______________X */

    bg_bitmap[0]  = 0x4002;  /* _X____________X_ */
    bg_bitmap[1]  = 0xA005;  /* X_X__________X_X */
    bg_bitmap[2]  = 0x500A;  /* _X_X________X_X_ */
    bg_bitmap[3]  = 0x2814;  /* __X_X______X_X__ */
    bg_bitmap[4]  = 0x1428;  /* ___X_X____X_X___ */
    bg_bitmap[5]  = 0x0A50;  /* ____X_X__X_X____ */
    bg_bitmap[6]  = 0x05A0;  /* _____X_XX_X_____ */
    bg_bitmap[7]  = 0x0240;  /* ______X__X______ */
    bg_bitmap[8]  = 0x0240;  /* ______X__X______ */
    bg_bitmap[9]  = 0x05A0;  /* _____X_XX_X_____ */
    bg_bitmap[10] = 0x0A50;  /* ____X_X__X_X____ */
    bg_bitmap[11] = 0x1428;  /* ___X_X____X_X___ */
    bg_bitmap[12] = 0x2814;  /* __X_X______X_X__ */
    bg_bitmap[13] = 0x500A;  /* _X_X________X_X_ */
    bg_bitmap[14] = 0xA005;  /* X_X__________X_X */
    bg_bitmap[15] = 0x4002;  /* _X____________X_ */

    GrSetCursor (wid, 16, 16, 8, 8, 
                 BLACK, BLACK, fg_bitmap, bg_bitmap);
}

See Also

GrMoveCursor().