2 * This file is part of gtkD.
4 * gtkD 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 * gtkD 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 gtkD; 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
61 import tango
.io
.Stdout
; // use the tango loging?
65 private import gtkc
.gdktypes
;
67 private import gtkc
.gdk
;
70 private import glib
.ListG
;
71 private import gdk
.Device
;
72 private import gdk
.Window
;
79 * In addition to the normal keyboard and mouse input devices, GTK+ also
80 * contains support for extended input devices. In
81 * particular, this support is targeted at graphics tablets. Graphics
82 * tablets typically return sub-pixel positioning information and possibly
83 * information about the pressure and tilt of the stylus. Under
84 * X, the support for extended devices is done through the
86 * Because handling extended input devices may involve considerable
87 * overhead, they need to be turned on for each GdkWindow
88 * individually using gdk_input_set_extension_events().
89 * (Or, more typically, for GtkWidgets, using gtk_widget_set_extension_events()).
90 * As an additional complication, depending on the support from
91 * the windowing system, its possible that a normal mouse
92 * cursor will not be displayed for a particular extension
93 * device. If an application does not want to deal with displaying
94 * a cursor itself, it can ask only to get extension events
95 * from devices that will display a cursor, by passing the
96 * GDK_EXTENSION_EVENTS_CURSOR value to
97 * gdk_input_set_extension_events(). Otherwise, the application
98 * must retrieve the device information using gdk_devices_list(),
99 * check the has_cursor field, and,
100 * if it is FALSE, draw a cursor itself when it receives
102 * Each pointing device is assigned a unique integer ID; events from a
103 * particular device can be identified by the
104 * deviceid field in the event structure. The
105 * events generated by pointer devices have also been extended to contain
107 * and ytilt fields which contain the extended
108 * information reported as additional valuators
109 * from the device. The pressure field is a
110 * a double value ranging from 0.0 to 1.0, while the tilt fields are
111 * double values ranging from -1.0 to 1.0. (With -1.0 representing the
112 * maximum tilt to the left or up, and 1.0 representing the maximum
113 * tilt to the right or down.)
114 * One additional field in each event is the
115 * source field, which contains an
116 * enumeration value describing the type of device; this currently
117 * can be one of GDK_SOURCE_MOUSE, GDK_SOURCE_PEN, GDK_SOURCE_ERASER,
118 * or GDK_SOURCE_CURSOR. This field is present to allow simple
119 * applications to (for instance) delete when they detect eraser
120 * devices without having to keep track of complicated per-device
122 * Various aspects of each device may be configured. The easiest way of
123 * creating a GUI to allow the user to configure such a device
124 * is to use the GtkInputDialog widget in GTK+.
125 * However, even when using this widget, application writers
126 * will need to directly query and set the configuration parameters
127 * in order to save the state between invocations of the application.
128 * The configuration of devices is queried using gdk_devices_list().
129 * Each device must be activated using gdk_device_set_mode(), which
130 * also controls whether the device's range is mapped to the
131 * entire screen or to a single window. The mapping of the valuators of
132 * the device onto the predefined valuator types is set using
133 * gdk_device_set_axis_use(). And the source type for each device
134 * can be set with gdk_device_set_source().
135 * Devices may also have associated keys
136 * or macro buttons. Such keys can be globally set to map
137 * into normal X keyboard events. The mapping is set using
138 * gdk_device_set_key().
139 * The interfaces in this section will most likely be considerably
140 * modified in the future to accomodate devices that may have different
141 * sets of additional valuators than the pressure xtilt
147 /** the main Gtk struct */
148 protected GdkDevice
* gdkDevice
;
151 public GdkDevice
* getDeviceStruct()
157 /** the main Gtk struct as a void* */
158 protected void* getStruct()
160 return cast(void*)gdkDevice
;
164 * Sets our main struct and passes it to the parent class
166 public this (GdkDevice
* gdkDevice
)
170 if ( gdkDevice
is null )
175 Stdout("struct gdkDevice is null on constructor").newline
;
179 printf("struct gdkDevice is null on constructor");
186 assert(gdkDevice
!is null, "struct gdkDevice is null on constructor");
188 this.gdkDevice
= gdkDevice
;
201 * Returns the list of available input devices for the default display.
202 * The list is statically allocated and should not be freed.
204 * a list of GdkDevice
206 public static ListG
gdkDevicesList()
208 // GList* gdk_devices_list (void);
209 return new ListG( gdk_devices_list() );
213 * Sets the source type for an input device.
219 public void setSource(GdkInputSource source
)
221 // void gdk_device_set_source (GdkDevice *device, GdkInputSource source);
222 gdk_device_set_source(gdkDevice
, source
);
226 * Sets a the mode of an input device. The mode controls if the
227 * device is active and whether the device's range is mapped to the
228 * entire screen or to a single window.
234 * TRUE if the mode was successfully changed.
236 public int setMode(GdkInputMode mode
)
238 // gboolean gdk_device_set_mode (GdkDevice *device, GdkInputMode mode);
239 return gdk_device_set_mode(gdkDevice
, mode
);
243 * Specifies the X key event to generate when a macro button of a device
248 * the index of the macro button to set.
250 * the keyval to generate.
252 * the modifiers to set.
254 public void setKey(uint index
, uint keyval
, GdkModifierType modifiers
)
256 // void gdk_device_set_key (GdkDevice *device, guint index_, guint keyval, GdkModifierType modifiers);
257 gdk_device_set_key(gdkDevice
, index
, keyval
, modifiers
);
261 * Specifies how an axis of a device is used.
265 * the index of the axis.
267 * specifies how the axis is used.
269 public void setAxisUse(uint index
, GdkAxisUse use
)
271 // void gdk_device_set_axis_use (GdkDevice *device, guint index_, GdkAxisUse use);
272 gdk_device_set_axis_use(gdkDevice
, index
, use
);
276 * Returns the core pointer device for the default display.
278 * the core pointer device; this is owned by the
279 * display and should not be freed.
281 public static Device
getCorePointer()
283 // GdkDevice* gdk_device_get_core_pointer (void);
284 return new Device( gdk_device_get_core_pointer() );
288 * Gets the current state of a device.
294 * an array of doubles to store the values of the axes of device in,
297 * location to store the modifiers, or NULL.
299 public void getState(Window window
, double* axes
, GdkModifierType
* mask
)
301 // void gdk_device_get_state (GdkDevice *device, GdkWindow *window, gdouble *axes, GdkModifierType *mask);
302 gdk_device_get_state(gdkDevice
, (window
is null) ?
null : window
.getWindowStruct(), axes
, mask
);
306 * Obtains the motion history for a device; given a starting and
307 * ending timestamp, return all events in the motion history for
308 * the device in the given range of time. Some windowing systems
309 * do not support motion history, in which case, FALSE will
310 * be returned. (This is not distinguishable from the case where
311 * motion history is supported and no events were found.)
315 * the window with respect to which which the event coordinates will be reported
317 * starting timestamp for range of events to return
319 * ending timestamp for the range of events to return
321 * location to store a newly-allocated array of GdkTimeCoord, or NULL
323 * location to store the length of events, or NULL
325 * TRUE if the windowing system supports motion history and
326 * at least one event was found.
328 public int getHistory(Window window
, uint start
, uint stop
, GdkTimeCoord
*** events
, int* nEvents
)
330 // gboolean gdk_device_get_history (GdkDevice *device, GdkWindow *window, guint32 start, guint32 stop, GdkTimeCoord ***events, gint *n_events);
331 return gdk_device_get_history(gdkDevice
, (window
is null) ?
null : window
.getWindowStruct(), start
, stop
, events
, nEvents
);
335 * Frees an array of GdkTimeCoord that was returned by gdk_device_get_history().
337 * an array of GdkTimeCoord.
339 * the length of the array.
341 public static void freeHistory(GdkTimeCoord
** events
, int nEvents
)
343 // void gdk_device_free_history (GdkTimeCoord **events, gint n_events);
344 gdk_device_free_history(events
, nEvents
);
349 * Interprets an array of double as axis values for a given device,
350 * and locates the value in the array for a given axis use.
354 * pointer to an array of axes
356 * the use to look for
358 * location to store the found value.
360 * TRUE if the given axis use was found, otherwise FALSE
362 public int getAxis(double* axes
, GdkAxisUse use
, double* value
)
364 // gboolean gdk_device_get_axis (GdkDevice *device, gdouble *axes, GdkAxisUse use, gdouble *value);
365 return gdk_device_get_axis(gdkDevice
, axes
, use
, value
);
369 * Turns extension events on or off for a particular window,
370 * and specifies the event mask for extension events.
376 * the type of extension events that are desired.
378 public static void gdkInputSetExtensionEvents(Window window
, int mask
, GdkExtensionMode mode
)
380 // void gdk_input_set_extension_events (GdkWindow *window, gint mask, GdkExtensionMode mode);
381 gdk_input_set_extension_events((window
is null) ?
null : window
.getWindowStruct(), mask
, mode
);