1 <!-- ##### SECTION Title ##### -->
4 <!-- ##### SECTION Short_Description ##### -->
7 <!-- ##### SECTION Long_Description ##### -->
12 <!-- ##### SECTION See_Also ##### -->
17 <!-- ##### STRUCT GdkCursor ##### -->
24 <!-- ##### ENUM GdkCursorType ##### -->
26 The standard cursors available.
30 <!-- ##### FUNCTION gdk_cursor_new ##### -->
32 Creates a new standard cursor.
35 @cursor_type: the type of the cursor.
36 @Returns: a new #GdkCursor.
39 <!-- ##### FUNCTION gdk_cursor_new_from_pixmap ##### -->
41 Creates a new cursor from a given pixmap and mask. Both the pixmap and mask
42 must have a depth of 1 (i.e. each pixel has only 2 values - on or off).
44 <example><title>Creating a custom cursor.</title>
46 /* This data is in X bitmap format, and can be created with the 'bitmap'
48 #define cursor1_width 16
49 #define cursor1_height 16
50 static unsigned char cursor1_bits[] = {
51 0x80, 0x01, 0x40, 0x02, 0x20, 0x04, 0x10, 0x08, 0x08, 0x10, 0x04, 0x20,
52 0x82, 0x41, 0x41, 0x82, 0x41, 0x82, 0x82, 0x41, 0x04, 0x20, 0x08, 0x10,
53 0x10, 0x08, 0x20, 0x04, 0x40, 0x02, 0x80, 0x01};
55 static unsigned char cursor1mask_bits[] = {
56 0x80, 0x01, 0xc0, 0x03, 0x60, 0x06, 0x30, 0x0c, 0x18, 0x18, 0x8c, 0x31,
57 0xc6, 0x63, 0x63, 0xc6, 0x63, 0xc6, 0xc6, 0x63, 0x8c, 0x31, 0x18, 0x18,
58 0x30, 0x0c, 0x60, 0x06, 0xc0, 0x03, 0x80, 0x01};
62 GdkPixmap *source, *mask;
63 GdkColor fg = { 0, 65535, 0, 0 }; /* Red. */
64 GdkColor bg = { 0, 0, 0, 65535 }; /* Blue. */
67 source = gdk_bitmap_create_from_data (NULL, cursor1_bits,
68 cursor1_width, cursor1_height);
69 mask = gdk_bitmap_create_from_data (NULL, cursor1mask_bits,
70 cursor1_width, cursor1_height);
71 cursor = gdk_cursor_new_from_pixmap (source, mask, &fg, &bg, 8, 8);
72 gdk_pixmap_unref (source);
73 gdk_pixmap_unref (mask);
76 gdk_window_set_cursor (widget->window, cursor);
80 @source: the pixmap specifying the cursor.
81 @mask: the pixmap specifying the mask, which must be the same size as @source.
82 @fg: the foreground color, used for the bits in the source which are 1.
83 The color does not have to be allocated first.
84 @bg: the background color, used for the bits in the source which are 0.
85 The color does not have to be allocated first.
86 @x: the horizontal offset of the 'hotspot' of the cursor.
87 @y: the vertical offset of the 'hotspot' of the cursor.
88 @Returns: a new #GdkCursor.
91 <!-- ##### FUNCTION gdk_cursor_destroy ##### -->
93 Destroys a cursor, freeing any resources allocated for it.
96 @cursor: a #GdkCursor.