]> Pileus Git - ~andy/gtk/blob - gdk/gdkinput.h
Updated Arabic translation
[~andy/gtk] / gdk / gdkinput.h
1 /* GDK - The GIMP Drawing Kit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library 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 GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 /*
21  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
22  * file for a list of people on the GTK+ Team.  See the ChangeLog
23  * files for a list of changes.  These files are distributed with
24  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
25  */
26
27 #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
28 #error "Only <gdk/gdk.h> can be included directly."
29 #endif
30
31 #ifndef __GDK_INPUT_H__
32 #define __GDK_INPUT_H__
33
34 #include <gdk/gdktypes.h>
35
36 G_BEGIN_DECLS
37
38 #define GDK_TYPE_DEVICE              (gdk_device_get_type ())
39 #define GDK_DEVICE(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DEVICE, GdkDevice))
40 #define GDK_DEVICE_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DEVICE, GdkDeviceClass))
41 #define GDK_IS_DEVICE(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DEVICE))
42 #define GDK_IS_DEVICE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DEVICE))
43 #define GDK_DEVICE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DEVICE, GdkDeviceClass))
44
45 typedef struct _GdkDeviceKey        GdkDeviceKey;
46 typedef struct _GdkDeviceAxis       GdkDeviceAxis;
47 typedef struct _GdkDevice           GdkDevice;
48 typedef struct _GdkDeviceClass      GdkDeviceClass;
49 typedef struct _GdkTimeCoord        GdkTimeCoord;
50
51 typedef enum
52 {
53   GDK_EXTENSION_EVENTS_NONE,
54   GDK_EXTENSION_EVENTS_ALL,
55   GDK_EXTENSION_EVENTS_CURSOR
56 } GdkExtensionMode;
57
58 typedef enum
59 {
60   GDK_SOURCE_MOUSE,
61   GDK_SOURCE_PEN,
62   GDK_SOURCE_ERASER,
63   GDK_SOURCE_CURSOR
64 } GdkInputSource;
65
66 typedef enum
67 {
68   GDK_MODE_DISABLED,
69   GDK_MODE_SCREEN,
70   GDK_MODE_WINDOW
71 } GdkInputMode;
72
73 typedef enum
74 {
75   GDK_AXIS_IGNORE,
76   GDK_AXIS_X,
77   GDK_AXIS_Y,
78   GDK_AXIS_PRESSURE,
79   GDK_AXIS_XTILT,
80   GDK_AXIS_YTILT,
81   GDK_AXIS_WHEEL,
82   GDK_AXIS_LAST
83 } GdkAxisUse;
84
85 struct _GdkDeviceKey
86 {
87   guint keyval;
88   GdkModifierType modifiers;
89 };
90
91 struct _GdkDeviceAxis
92 {
93   GdkAxisUse use;
94   gdouble    min;
95   gdouble    max;
96 };
97
98 struct _GdkDevice
99 {
100   GObject parent_instance;
101   /* All fields are read-only */
102           
103   gchar *name;
104   GdkInputSource source;
105   GdkInputMode mode;
106   gboolean has_cursor;       /* TRUE if the X pointer follows device motion */
107           
108   gint num_axes;
109   GdkDeviceAxis *axes;
110           
111   gint num_keys;
112   GdkDeviceKey *keys;
113 };
114
115 /* We don't allocate each coordinate this big, but we use it to
116  * be ANSI compliant and avoid accessing past the defined limits.
117  */
118 #define GDK_MAX_TIMECOORD_AXES 128
119
120 struct _GdkTimeCoord
121 {
122   guint32 time;
123   gdouble axes[GDK_MAX_TIMECOORD_AXES];
124 };
125
126 GType          gdk_device_get_type      (void) G_GNUC_CONST;
127
128 #ifndef GDK_MULTIHEAD_SAFE
129 /* Returns a list of GdkDevice * */       
130 GList *        gdk_devices_list              (void);
131 #endif /* GDK_MULTIHEAD_SAFE */
132
133 /* Functions to configure a device */
134 void           gdk_device_set_source    (GdkDevice      *device,
135                                          GdkInputSource  source);
136           
137 gboolean       gdk_device_set_mode      (GdkDevice      *device,
138                                          GdkInputMode    mode);
139
140 void           gdk_device_set_key       (GdkDevice      *device,
141                                          guint           index_,
142                                          guint           keyval,
143                                          GdkModifierType modifiers);
144
145 void     gdk_device_set_axis_use (GdkDevice         *device,
146                                   guint              index_,
147                                   GdkAxisUse         use);
148
149 void     gdk_device_get_state    (GdkDevice         *device,
150                                   GdkWindow         *window,
151                                   gdouble           *axes,
152                                   GdkModifierType   *mask);
153
154 gboolean gdk_device_get_history  (GdkDevice         *device,
155                                   GdkWindow         *window,
156                                   guint32            start,
157                                   guint32            stop,
158                                   GdkTimeCoord    ***events,
159                                   gint              *n_events);
160
161 void     gdk_device_free_history (GdkTimeCoord     **events,
162                                   gint               n_events);
163 gboolean gdk_device_get_axis     (GdkDevice         *device,
164                                   gdouble           *axes,
165                                   GdkAxisUse         use,
166                                   gdouble           *value);
167
168 void gdk_input_set_extension_events (GdkWindow        *window,
169                                      gint              mask,
170                                      GdkExtensionMode  mode);
171
172 #ifndef GDK_MULTIHEAD_SAFE
173 GdkDevice *gdk_device_get_core_pointer (void);
174 #endif
175  
176 G_END_DECLS
177
178 #endif /* __GDK_INPUT_H__ */