2 * This file is part of duit.
4 * duit is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * duit is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with duit; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = gdk-Cursors.html
51 * - GdkColor* -> Color
52 * - GdkCursor* -> Cursor
53 * - GdkDisplay* -> Display
54 * - GdkPixbuf* -> Pixbuf
55 * - GdkPixmap* -> Pixmap
61 private import gdk
.gdktypes
;
63 private import lib
.gdk
;
65 private import glib
.Str
;
66 private import gdk
.Pixmap
;
67 private import gdk
.Color
;
68 private import gdk
.Display
;
69 private import gdk
.Pixbuf
;
70 private import gdk
.Cursor
;
74 * These functions are used to create and destroy cursors.
75 * There is a number of standard cursors, but it is also
76 * possible to construct new cursors from pixmaps and
77 * pixbufs. There may be limitations as to what kinds of
78 * cursors can be constructed on a given display, see
79 * gdk_display_supports_cursor_alpha(),
80 * gdk_display_supports_cursor_color(),
81 * gdk_display_get_default_cursor_size() and
82 * gdk_display_get_maximal_cursor_size().
83 * Cursors by themselves are not very interesting, they must be be
84 * bound to a window for users to see them. This is done with
85 * gdk_window_set_cursor() or by setting the cursor member of the
86 * GdkWindowAttr struct passed to gdk_window_new().
91 /** the main Gtk struct */
92 protected GdkCursor
* gdkCursor
;
95 public GdkCursor
* getCursorStruct()
101 /** the main Gtk struct as a void* */
102 protected void* getStruct()
104 return cast(void*)gdkCursor
;
108 * Sets our main struct and passes it to the parent class
110 public this (GdkCursor
* gdkCursor
)
112 this.gdkCursor
= gdkCursor
;
121 * Creates a new cursor from the set of builtin cursors for the default display.
122 * See gdk_cursor_new_for_display().
123 * To make the cursor invisible, use gdk_cursor_new_from_pixmap() to create
124 * a cursor with no pixels in it.
130 public this (GdkCursorType cursorType
)
132 // GdkCursor* gdk_cursor_new (GdkCursorType cursor_type);
133 this(cast(GdkCursor
*)gdk_cursor_new(cursorType
) );
137 * Creates a new cursor from a given pixmap and mask. Both the pixmap and mask
138 * must have a depth of 1 (i.e. each pixel has only 2 values - on or off).
139 * The standard cursor size is 16 by 16 pixels. You can create a bitmap
140 * from inline data as in the below example.
141 * Example6.Creating a custom cursor
142 * /+* This data is in X bitmap format, and can be created with the 'bitmap'
144 * #define cursor1_width 16
145 * #define cursor1_height 16
146 * static unsigned char cursor1_bits[] = {
147 * 0x80, 0x01, 0x40, 0x02, 0x20, 0x04, 0x10, 0x08, 0x08, 0x10, 0x04, 0x20,
148 * 0x82, 0x41, 0x41, 0x82, 0x41, 0x82, 0x82, 0x41, 0x04, 0x20, 0x08, 0x10,
149 * 0x10, 0x08, 0x20, 0x04, 0x40, 0x02, 0x80, 0x01};
150 * static unsigned char cursor1mask_bits[] = {
151 * 0x80, 0x01, 0xc0, 0x03, 0x60, 0x06, 0x30, 0x0c, 0x18, 0x18, 0x8c, 0x31,
152 * 0xc6, 0x63, 0x63, 0xc6, 0x63, 0xc6, 0xc6, 0x63, 0x8c, 0x31, 0x18, 0x18,
153 * 0x30, 0x0c, 0x60, 0x06, 0xc0, 0x03, 0x80, 0x01};
155 * GdkPixmap *source, *mask;
156 * GdkColor fg = { 0, 65535, 0, 0 }; /+* Red. +/
157 * GdkColor bg = { 0, 0, 0, 65535 }; /+* Blue. +/
158 * source = gdk_bitmap_create_from_data (NULL, cursor1_bits,
159 * cursor1_width, cursor1_height);
160 * mask = gdk_bitmap_create_from_data (NULL, cursor1mask_bits,
161 * cursor1_width, cursor1_height);
162 * cursor = gdk_cursor_new_from_pixmap (source, mask, fg, bg, 8, 8);
163 * gdk_pixmap_unref (source);
164 * gdk_pixmap_unref (mask);
165 * gdk_window_set_cursor (widget->window, cursor);
167 * the pixmap specifying the cursor.
169 * the pixmap specifying the mask, which must be the same size as
172 * the foreground color, used for the bits in the source which are 1.
173 * The color does not have to be allocated first.
175 * the background color, used for the bits in the source which are 0.
176 * The color does not have to be allocated first.
178 * the horizontal offset of the 'hotspot' of the cursor.
180 * the vertical offset of the 'hotspot' of the cursor.
184 public this (Pixmap source
, Pixmap mask
, Color fg
, Color bg
, int x
, int y
)
186 // GdkCursor* gdk_cursor_new_from_pixmap (GdkPixmap *source, GdkPixmap *mask, const GdkColor *fg, const GdkColor *bg, gint x, gint y);
187 this(cast(GdkCursor
*)gdk_cursor_new_from_pixmap((source
is null) ?
null : source
.getPixmapStruct(), (mask
is null) ?
null : mask
.getPixmapStruct(), (fg
is null) ?
null : fg
.getColorStruct(), (bg
is null) ?
null : bg
.getColorStruct(), x
, y
) );
191 * Creates a new cursor from a pixbuf.
192 * Not all GDK backends support RGBA cursors. If they are not
193 * supported, a monochrome approximation will be displayed.
194 * The functions gdk_display_supports_cursor_alpha() and
195 * gdk_display_supports_cursor_color() can be used to determine
196 * whether RGBA cursors are supported;
197 * gdk_display_get_default_cursor_size() and
198 * gdk_display_get_maximal_cursor_size() give information about
200 * On the X backend, support for RGBA cursors requires a
201 * sufficently new version of the X Render extension.
203 * the GdkDisplay for which the cursor will be created
205 * the GdkPixbuf containing the cursor image
207 * the horizontal offset of the 'hotspot' of the cursor.
209 * the vertical offset of the 'hotspot' of the cursor.
214 public this (Display display
, Pixbuf pixbuf
, int x
, int y
)
216 // GdkCursor* gdk_cursor_new_from_pixbuf (GdkDisplay *display, GdkPixbuf *pixbuf, gint x, gint y);
217 this(cast(GdkCursor
*)gdk_cursor_new_from_pixbuf((display
is null) ?
null : display
.getDisplayStruct(), (pixbuf
is null) ?
null : pixbuf
.getPixbufStruct(), x
, y
) );
221 * Creates a new cursor by looking up name in the current cursor
224 * the GdkDisplay for which the cursor will be created
226 * the name of the cursor
228 * a new GdkCursor, or NULL if there is no cursor with
232 public this (Display display
, char[] name
)
234 // GdkCursor* gdk_cursor_new_from_name (GdkDisplay *display, const gchar *name);
235 this(cast(GdkCursor
*)gdk_cursor_new_from_name((display
is null) ?
null : display
.getDisplayStruct(), Str
.toStringz(name
)) );
239 * Creates a new cursor from the set of builtin cursors.
240 * Some useful ones are:
241 * GDK_RIGHT_PTR (right-facing arrow)
242 * GDK_CROSSHAIR (crosshair)
245 * GDK_FLEUR (for moving objects)
246 * GDK_HAND1 (a right-pointing hand)
247 * GDK_HAND2 (a left-pointing hand)
248 * GDK_LEFT_SIDE (resize left side)
249 * GDK_RIGHT_SIDE (resize right side)
250 * GDK_TOP_LEFT_CORNER (resize northwest corner)
251 * GDK_TOP_RIGHT_CORNER (resize northeast corner)
252 * GDK_BOTTOM_LEFT_CORNER (resize southwest corner)
253 * GDK_BOTTOM_RIGHT_CORNER (resize southeast corner)
254 * GDK_TOP_SIDE (resize top side)
255 * GDK_BOTTOM_SIDE (resize bottom side)
256 * GDK_SB_H_DOUBLE_ARROW (move vertical splitter)
257 * GDK_SB_V_DOUBLE_ARROW (move horizontal splitter)
258 * To make the cursor invisible, use gdk_cursor_new_from_pixmap() to create
259 * a cursor with no pixels in it.
261 * the GdkDisplay for which the cursor will be created
268 public this (Display display
, GdkCursorType cursorType
)
270 // GdkCursor* gdk_cursor_new_for_display (GdkDisplay *display, GdkCursorType cursor_type);
271 this(cast(GdkCursor
*)gdk_cursor_new_for_display((display
is null) ?
null : display
.getDisplayStruct(), cursorType
) );
275 * Returns the display on which the GdkCursor is defined.
279 * the GdkDisplay associated to cursor
282 public Display
getDisplay()
284 // GdkDisplay* gdk_cursor_get_display (GdkCursor *cursor);
285 return new Display( gdk_cursor_get_display(gdkCursor
) );
289 * Returns a GdkPixbuf with the image used to display the cursor.
290 * Note that depending on the capabilities of the windowing system and
291 * on the cursor, GDK may not be able to obtain the image data. In this
292 * case, NULL is returned.
296 * a GdkPixbuf representing cursor, or NULL
299 public Pixbuf
getImage()
301 // GdkPixbuf* gdk_cursor_get_image (GdkCursor *cursor);
302 return new Pixbuf( gdk_cursor_get_image(gdkCursor
) );
306 * Adds a reference to cursor.
310 * Same cursor that was passed in
314 // GdkCursor* gdk_cursor_ref (GdkCursor *cursor);
315 return new Cursor( gdk_cursor_ref(gdkCursor
) );
319 * Removes a reference from cursor, deallocating the cursor
320 * if no references remain.
326 // void gdk_cursor_unref (GdkCursor *cursor);
327 gdk_cursor_unref(gdkCursor
);