Cursors
standard and pixmap cursors.
A GdkCursor structure represents a cursor.
@type:
@ref_count:
The standard cursors available.
@GDK_X_CURSOR:
@GDK_ARROW:
@GDK_BASED_ARROW_DOWN:
@GDK_BASED_ARROW_UP:
@GDK_BOAT:
@GDK_BOGOSITY:
@GDK_BOTTOM_LEFT_CORNER:
@GDK_BOTTOM_RIGHT_CORNER:
@GDK_BOTTOM_SIDE:
@GDK_BOTTOM_TEE:
@GDK_BOX_SPIRAL:
@GDK_CENTER_PTR:
@GDK_CIRCLE:
@GDK_CLOCK:
@GDK_COFFEE_MUG:
@GDK_CROSS:
@GDK_CROSS_REVERSE:
@GDK_CROSSHAIR:
@GDK_DIAMOND_CROSS:
@GDK_DOT:
@GDK_DOTBOX:
@GDK_DOUBLE_ARROW:
@GDK_DRAFT_LARGE:
@GDK_DRAFT_SMALL:
@GDK_DRAPED_BOX:
@GDK_EXCHANGE:
@GDK_FLEUR:
@GDK_GOBBLER:
@GDK_GUMBY:
@GDK_HAND1:
@GDK_HAND2:
@GDK_HEART:
@GDK_ICON:
@GDK_IRON_CROSS:
@GDK_LEFT_PTR:
@GDK_LEFT_SIDE:
@GDK_LEFT_TEE:
@GDK_LEFTBUTTON:
@GDK_LL_ANGLE:
@GDK_LR_ANGLE:
@GDK_MAN:
@GDK_MIDDLEBUTTON:
@GDK_MOUSE:
@GDK_PENCIL:
@GDK_PIRATE:
@GDK_PLUS:
@GDK_QUESTION_ARROW:
@GDK_RIGHT_PTR:
@GDK_RIGHT_SIDE:
@GDK_RIGHT_TEE:
@GDK_RIGHTBUTTON:
@GDK_RTL_LOGO:
@GDK_SAILBOAT:
@GDK_SB_DOWN_ARROW:
@GDK_SB_H_DOUBLE_ARROW:
@GDK_SB_LEFT_ARROW:
@GDK_SB_RIGHT_ARROW:
@GDK_SB_UP_ARROW:
@GDK_SB_V_DOUBLE_ARROW:
@GDK_SHUTTLE:
@GDK_SIZING:
@GDK_SPIDER:
@GDK_SPRAYCAN:
@GDK_STAR:
@GDK_TARGET:
@GDK_TCROSS:
@GDK_TOP_LEFT_ARROW:
@GDK_TOP_LEFT_CORNER:
@GDK_TOP_RIGHT_CORNER:
@GDK_TOP_SIDE:
@GDK_TOP_TEE:
@GDK_TREK:
@GDK_UL_ANGLE:
@GDK_UMBRELLA:
@GDK_UR_ANGLE:
@GDK_WATCH:
@GDK_XTERM:
@GDK_LAST_CURSOR:
@GDK_CURSOR_IS_PIXMAP: type of cursors constructed with
gdk_cursor_new_from_pixmap().
@cursor_type:
@Returns:
Creates a new cursor from a given pixmap and mask. Both the pixmap and mask
must have a depth of 1 (i.e. each pixel has only 2 values - on or off).
The standard cursor size is 16 by 16 pixels. You can create a bitmap
from inline data as in the below example.
Creating a custom cursor.
/* This data is in X bitmap format, and can be created with the 'bitmap'
utility. */
#define cursor1_width 16
#define cursor1_height 16
static unsigned char cursor1_bits[] = {
0x80, 0x01, 0x40, 0x02, 0x20, 0x04, 0x10, 0x08, 0x08, 0x10, 0x04, 0x20,
0x82, 0x41, 0x41, 0x82, 0x41, 0x82, 0x82, 0x41, 0x04, 0x20, 0x08, 0x10,
0x10, 0x08, 0x20, 0x04, 0x40, 0x02, 0x80, 0x01};
static unsigned char cursor1mask_bits[] = {
0x80, 0x01, 0xc0, 0x03, 0x60, 0x06, 0x30, 0x0c, 0x18, 0x18, 0x8c, 0x31,
0xc6, 0x63, 0x63, 0xc6, 0x63, 0xc6, 0xc6, 0x63, 0x8c, 0x31, 0x18, 0x18,
0x30, 0x0c, 0x60, 0x06, 0xc0, 0x03, 0x80, 0x01};
GdkCursor *cursor;
GdkPixmap *source, *mask;
GdkColor fg = { 0, 65535, 0, 0 }; /* Red. */
GdkColor bg = { 0, 0, 0, 65535 }; /* Blue. */
source = gdk_bitmap_create_from_data (NULL, cursor1_bits,
cursor1_width, cursor1_height);
mask = gdk_bitmap_create_from_data (NULL, cursor1mask_bits,
cursor1_width, cursor1_height);
cursor = gdk_cursor_new_from_pixmap (source, mask, &fg, &bg, 8, 8);
gdk_pixmap_unref (source);
gdk_pixmap_unref (mask);
gdk_window_set_cursor (widget->window, cursor);
@source: the pixmap specifying the cursor.
@mask: the pixmap specifying the mask, which must be the same size as @source.
@fg: the foreground color, used for the bits in the source which are 1.
The color does not have to be allocated first.
@bg: the background color, used for the bits in the source which are 0.
The color does not have to be allocated first.
@x: the horizontal offset of the 'hotspot' of the cursor.
@y: the vertical offset of the 'hotspot' of the cursor.
@Returns: a new #GdkCursor.
@screen:
@cursor_type:
@Returns:
@cursor:
@Returns:
@cursor:
@Returns:
@cursor:
Destroys a cursor, freeing any resources allocated for it.
@cursor: a #GdkCursor.