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-Input-Devices.html
49 * - GdkDevice* -> Device
50 * - GdkWindow* -> Window
56 private import gdk
.gdktypes
;
58 private import lib
.gdk
;
60 private import glib
.ListG
;
61 private import gdk
.Device
;
62 private import gdk
.Window
;
66 * In addition to the normal keyboard and mouse input devices, GTK+ also
67 * contains support for extended input devices. In
68 * particular, this support is targeted at graphics tablets. Graphics
69 * tablets typically return sub-pixel positioning information and possibly
70 * information about the pressure and tilt of the stylus. Under
71 * X, the support for extended devices is done through the
73 * Because handling extended input devices may involve considerable
74 * overhead, they need to be turned on for each GdkWindow
75 * individually using gdk_input_set_extension_events().
76 * (Or, more typically, for GtkWidgets, using gtk_widget_set_extension_events()).
77 * As an additional complication, depending on the support from
78 * the windowing system, its possible that a normal mouse
79 * cursor will not be displayed for a particular extension
80 * device. If an application does not want to deal with displaying
81 * a cursor itself, it can ask only to get extension events
82 * from devices that will display a cursor, by passing the
83 * GDK_EXTENSION_EVENTS_CURSOR value to
84 * gdk_input_set_extension_events(). Otherwise, the application
85 * must retrieve the device information using gdk_devices_list(),
86 * check the has_cursor field, and,
87 * if it is FALSE, draw a cursor itself when it receives
89 * Each pointing device is assigned a unique integer ID; events from a
90 * particular device can be identified by the
91 * deviceid field in the event structure. The
92 * events generated by pointer devices have also been extended to contain
94 * and ytilt fields which contain the extended
95 * information reported as additional valuators
96 * from the device. The pressure field is a
97 * a double value ranging from 0.0 to 1.0, while the tilt fields are
98 * double values ranging from -1.0 to 1.0. (With -1.0 representing the
99 * maximum tilt to the left or up, and 1.0 representing the maximum
100 * tilt to the right or down.)
101 * One additional field in each event is the
102 * source field, which contains an
103 * enumeration value describing the type of device; this currently
104 * can be one of GDK_SOURCE_MOUSE, GDK_SOURCE_PEN, GDK_SOURCE_ERASER,
105 * or GDK_SOURCE_CURSOR. This field is present to allow simple
106 * applications to (for instance) delete when they detect eraser
107 * devices without having to keep track of complicated per-device
109 * Various aspects of each device may be configured. The easiest way of
110 * creating a GUI to allow the user to configure such a device
111 * is to use the GtkInputDialog widget in GTK+.
112 * However, even when using this widget, application writers
113 * will need to directly query and set the configuration parameters
114 * in order to save the state between invocations of the application.
115 * The configuration of devices is queried using gdk_devices_list().
116 * Each device must be activated using gdk_device_set_mode(), which
117 * also controls whether the device's range is mapped to the
118 * entire screen or to a single window. The mapping of the valuators of
119 * the device onto the predefined valuator types is set using
120 * gdk_device_set_axis_use(). And the source type for each device
121 * can be set with gdk_device_set_source().
122 * Devices may also have associated keys
123 * or macro buttons. Such keys can be globally set to map
124 * into normal X keyboard events. The mapping is set using
125 * gdk_device_set_key().
126 * The interfaces in this section will most likely be considerably
127 * modified in the future to accomodate devices that may have different
128 * sets of additional valuators than the pressure xtilt
134 /** the main Gtk struct */
135 protected GdkDevice
* gdkDevice
;
138 public GdkDevice
* getDeviceStruct()
144 /** the main Gtk struct as a void* */
145 protected void* getStruct()
147 return cast(void*)gdkDevice
;
151 * Sets our main struct and passes it to the parent class
153 public this (GdkDevice
* gdkDevice
)
155 this.gdkDevice
= gdkDevice
;
168 * Returns the list of available input devices for the default display.
169 * The list is statically allocated and should not be freed.
171 * a list of GdkDevice
173 public static ListG
gdkDevicesList()
175 // GList* gdk_devices_list (void);
176 return new ListG( gdk_devices_list() );
180 * Sets the source type for an input device.
186 public void setSource(GdkInputSource source
)
188 // void gdk_device_set_source (GdkDevice *device, GdkInputSource source);
189 gdk_device_set_source(gdkDevice
, source
);
193 * Sets a the mode of an input device. The mode controls if the
194 * device is active and whether the device's range is mapped to the
195 * entire screen or to a single window.
201 * TRUE if the mode was successfully changed.
203 public int setMode(GdkInputMode mode
)
205 // gboolean gdk_device_set_mode (GdkDevice *device, GdkInputMode mode);
206 return gdk_device_set_mode(gdkDevice
, mode
);
210 * Specifies the X key event to generate when a macro button of a device
215 * the index of the macro button to set.
217 * the keyval to generate.
219 * the modifiers to set.
221 public void setKey(uint index
, uint keyval
, GdkModifierType modifiers
)
223 // void gdk_device_set_key (GdkDevice *device, guint index_, guint keyval, GdkModifierType modifiers);
224 gdk_device_set_key(gdkDevice
, index
, keyval
, modifiers
);
228 * Specifies how an axis of a device is used.
232 * the index of the axis.
234 * specifies how the axis is used.
236 public void setAxisUse(uint index
, GdkAxisUse use
)
238 // void gdk_device_set_axis_use (GdkDevice *device, guint index_, GdkAxisUse use);
239 gdk_device_set_axis_use(gdkDevice
, index
, use
);
243 * Returns the core pointer device for the default display.
245 * the core pointer device; this is owned by the
246 * display and should not be freed.
248 public static Device
getCorePointer()
250 // GdkDevice* gdk_device_get_core_pointer (void);
251 return new Device( gdk_device_get_core_pointer() );
255 * Gets the current state of a device.
261 * an array of doubles to store the values of the axes of device in,
264 * location to store the modifiers, or NULL.
266 public void getState(Window window
, double* axes
, GdkModifierType
* mask
)
268 // void gdk_device_get_state (GdkDevice *device, GdkWindow *window, gdouble *axes, GdkModifierType *mask);
269 gdk_device_get_state(gdkDevice
, (window
is null) ?
null : window
.getWindowStruct(), axes
, mask
);
273 * Obtains the motion history for a device; given a starting and
274 * ending timestamp, return all events in the motion history for
275 * the device in the given range of time. Some windowing systems
276 * do not support motion history, in which case, FALSE will
277 * be returned. (This is not distinguishable from the case where
278 * motion history is supported and no events were found.)
282 * the window with respect to which which the event coordinates will be reported
284 * starting timestamp for range of events to return
286 * ending timestamp for the range of events to return
288 * location to store a newly-allocated array of GdkTimeCoord, or NULL
290 * location to store the length of events, or NULL
292 * TRUE if the windowing system supports motion history and
293 * at least one event was found.
295 public int getHistory(Window window
, uint start
, uint stop
, GdkTimeCoord
*** events
, int* nEvents
)
297 // gboolean gdk_device_get_history (GdkDevice *device, GdkWindow *window, guint32 start, guint32 stop, GdkTimeCoord ***events, gint *n_events);
298 return gdk_device_get_history(gdkDevice
, (window
is null) ?
null : window
.getWindowStruct(), start
, stop
, events
, nEvents
);
302 * Frees an array of GdkTimeCoord that was returned by gdk_device_get_history().
304 * an array of GdkTimeCoord.
306 * the length of the array.
308 public static void freeHistory(GdkTimeCoord
** events
, int nEvents
)
310 // void gdk_device_free_history (GdkTimeCoord **events, gint n_events);
311 gdk_device_free_history(events
, nEvents
);
316 * Interprets an array of double as axis values for a given device,
317 * and locates the value in the array for a given axis use.
321 * pointer to an array of axes
323 * the use to look for
325 * location to store the found value.
327 * TRUE if the given axis use was found, otherwise FALSE
329 public int getAxis(double* axes
, GdkAxisUse use
, double* value
)
331 // gboolean gdk_device_get_axis (GdkDevice *device, gdouble *axes, GdkAxisUse use, gdouble *value);
332 return gdk_device_get_axis(gdkDevice
, axes
, use
, value
);
336 * Turns extension events on or off for a particular window,
337 * and specifies the event mask for extension events.
343 * the type of extension events that are desired.
345 public static void gdkInputSetExtensionEvents(Window window
, int mask
, GdkExtensionMode mode
)
347 // void gdk_input_set_extension_events (GdkWindow *window, gint mask, GdkExtensionMode mode);
348 gdk_input_set_extension_events((window
is null) ?
null : window
.getWindowStruct(), mask
, mode
);