27
27
#define GRIP_GESTURE_MANAGER_H
29
29
#include <gtk/gtk.h>
30
#include "gripinputdevice.h"
33
#define GRIP_TYPE_GESTURE_MANAGER (grip_gesture_manager_get_type ())
34
#define GRIP_GESTURE_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GRIP_TYPE_GESTURE_MANAGER, GripGestureManager))
35
#define GRIP_GESTURE_MANAGER_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GRIP_TYPE_GESTURE_MANAGER, GripGestureManagerClass))
36
#define GRIP_IS_GESTURE_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GRIP_TYPE_GESTURE_MANAGER))
37
#define GRIP_IS_GESTURE_MANAGER_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GRIP_TYPE_GESTURE_MANAGER))
38
#define GRIP_GESTURE_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GRIP_TYPE_GESTURE_MANAGER, GripGestureManagerClass))
35
* SECTION:GripGestureManager
37
* The Grip gesture managre is a singleton object that connections to the
38
* gesture recognition engine and manages gesture subscriptions for GTK widgets.
42
* SECTION:GripGestureEvents
44
* A series of one or more events are passed to the gesture callback. Each
45
* event conveys information specific to the type of gesture occurring.
49
* GRIP_TYPE_GESTURE_MANAGER:
51
* Gets the #GType for the #GripGestureManager.
53
#define GRIP_TYPE_GESTURE_MANAGER (grip_gesture_manager_get_type ())
56
* GRIP_GESTURE_MANAGER:
57
* @obj: The #GObject to convert.
59
* Performs a checked conversion of a #GObject to a #GripGestureManager.
61
#define GRIP_GESTURE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GRIP_TYPE_GESTURE_MANAGER, GripGestureManager))
64
* GRIP_GESTURE_MANAGER_CLASS:
65
* @klass: The #GObjectClass to convert.
67
* Performes a checked conversion of a #GObjectClass to a
68
* #GripGestureManagerClass.
70
#define GRIP_GESTURE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GRIP_TYPE_GESTURE_MANAGER, GripGestureManagerClass))
73
* GRIP_IS_GESTURE_MANAGER:
74
* @obj: The #GObject to check.
76
* Checks to see if #GripGestureManagerClass is in the #GObjectClass heirarchy
79
#define GRIP_IS_GESTURE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GRIP_TYPE_GESTURE_MANAGER))
82
* GRIP_IS_GESTURE_MANAGER_CLASS:
83
* @klass: The #GObjectClass to check.
85
* Checks to see if a #GripGestureManagerClass object is in the object heirarchy
88
#define GRIP_IS_GESTURE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GRIP_TYPE_GESTURE_MANAGER))
91
* GRIP_GESTURE_MANAGER_GET_CLASS:
94
* Gets the @GripGestureManagerClass object for @obj if that object is a member
95
* of its #GObjectClass heirarchy.
97
#define GRIP_GESTURE_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GRIP_TYPE_GESTURE_MANAGER, GripGestureManagerClass))
40
99
typedef struct _GripGestureManager GripGestureManager;
41
100
typedef struct _GripGestureManagerClass GripGestureManagerClass;
48
107
typedef struct _GripEventGestureRotate GripEventGestureRotate;
49
108
typedef struct _GripEventGestureTap GripEventGestureTap;
112
* @GRIP_GESTURE_DRAG: a drag gesture
113
* @GRIP_GESTURE_PINCH: a pinch/expand gesture
114
* @GRIP_GESTURE_ROTATE: a rotate gesture
115
* @GRIP_GESTURE_TAP: a tap gesture
117
* Indicates the type of gesture for which a gesture event is being received.
52
120
GRIP_GESTURE_DRAG = 0,
53
121
GRIP_GESTURE_PINCH = 1,
55
123
GRIP_GESTURE_TAP = 15
56
124
} GripGestureType;
59
GRIP_DEVICE_TOUCHSCREEN = 1,
60
GRIP_DEVICE_TOUCHPAD = 2,
61
GRIP_DEVICE_INDEPENDENT = 4,
64
127
#define GRIP_DEVICE_ALL (GRIP_DEVICE_TOUCHSCREEN | GRIP_DEVICE_TOUCHPAD | GRIP_DEVICE_INDEPENDENT)
131
* @GRIP_TIME_START: a new gesture is starting
132
* @GRIP_TIME_UPDATE: an existing gesture is updating
133
* @GRIP_TIME_END: a gesture is ending
135
* Indicates the part of the gesture stream ocuuring during the gesture event.
144
* GripEventGestureAny:
146
* This struct is not used.
72
148
struct _GripEventGestureAny
74
150
GdkEventType type;
75
151
GdkWindow *window;
155
* GripEventGestureDrag:
156
* @type: the #GripGestureType of the gesture
157
* @id: identifies the gesture
158
* @window: the #GdkWindow in which the gesture occurred
159
* @root: the root #GdkWindow
160
* @child: the child #GdkWindow
161
* @timestamp: the time the gesture event occurred
162
* @fingers: the number of touches making up the gesture
163
* @focus_x: the X coordinate of the focus point of the gesture start
164
* @focus_y: the Y coordinate of the focus point of the gesture start
165
* @delta_x: the change in the X coordinate since the last gesture event
166
* @delta_y: the change in the Y coordinate since the last gesture event
167
* @velocity_x: the rate of change of the X coordinate
168
* @velocity_y: the rate of change of the Y coordinate
169
* @position_x: the current X coordinate of the centroid poistion of the touches
170
* @position_y: the current Y coordinate of the centroid poistion of the touches
171
* @input_device: the #GripInputDevice used to make the gesture
173
* Data associated with a drag event. A drag is a lateral motion.
78
175
struct _GripEventGestureDrag
80
177
GripGestureType type;
92
189
gdouble velocity_y;
93
190
gdouble position_x;
94
191
gdouble position_y;
192
GripInputDevice *input_device;
196
* GripEventGesturePinch:
197
* @type: the #GripGestureType of the gesture
198
* @id: identifies the gesture
199
* @window: the #GdkWindow in which the gesture occurred
200
* @root: the root #GdkWindow
201
* @child: the child #GdkWindow
202
* @timestamp: the time the gesture event occurred
203
* @fingers: the number of touches making up the gesture
204
* @focus_x: the X coordinate of the focus point of the gesture start
205
* @focus_y: the Y coordinate of the focus point of the gesture start
206
* @radius_delta: the change in the radius (in screen coordinates)
207
* @radial_velocity: the rate of change of the radius
208
* @radius: the current radius (in screen coordinates)
209
* @position_x: the current X coordinate of the centroid poistion of the touches
210
* @position_y: the current Y coordinate of the centroid poistion of the touches
211
* @input_device: the #GripInputDevice used to make the gesture
213
* Data associated with a pinch event. A pinch is an expand or contract motion.
97
215
struct _GripEventGesturePinch
99
217
GripGestureType type;
111
229
gfloat position_x;
112
230
gfloat position_y;
231
GripInputDevice *input_device;
235
* GripEventGestureRotate:
236
* @type: the #GripGestureType of the gesture
237
* @id: identifies the gesture
238
* @window: the #GdkWindow in which the gesture occurred
239
* @root: the root #GdkWindow
240
* @child: the child #GdkWindow
241
* @timestamp: the time the gesture event occurred
242
* @fingers: the number of touches making up the gesture
243
* @focus_x: the X coordinate of the focus point of the gesture start
244
* @focus_y: the Y coordinate of the focus point of the gesture start
245
* @angle_delta: the change in the rotation angle (in radians)
246
* @angular_velocity: the rate of change in the rotation angle
247
* @angle: the current rotation angle
248
* @position_x: the current X coordinate of the centroid poistion of the touches
249
* @position_y: the current Y coordinate of the centroid poistion of the touches
250
* @input_device: the #GripInputDevice used to make the gesture
252
* Data associated with a rotate gesture event.
115
254
struct _GripEventGestureRotate
117
256
GripGestureType type;
129
268
gfloat position_x;
130
269
gfloat position_y;
270
GripInputDevice *input_device;
274
* GripEventGestureTap:
275
* @type: the #GripGestureType of the gesture
276
* @id: identifies the gesture
277
* @window: the #GdkWindow in which the gesture occurred
278
* @root: the root #GdkWindow
279
* @child: the child #GdkWindow
280
* @timestamp: the time the gesture event occurred
281
* @fingers: the number of touches making up the gesture
282
* @tap_time: the duration of the tap
283
* @focus_x: the X coordinate of the focus point of the gesture start
284
* @focus_y: the Y coordinate of the focus point of the gesture start
285
* @position_x: the current X coordinate of the centroid poistion of the touches
286
* @position_y: the current Y coordinate of the centroid poistion of the touches
287
* @input_device: the #GripInputDevice used to make the gesture
289
* Data associated with a tap gesture.
133
291
struct _GripEventGestureTap
135
293
GripGestureType type;
187
359
* @time: A #GripTimeType
188
360
* @gesture: (in): A #GripGestureEvent pointer
189
361
* @user_data: (transfer none): user data
363
* The gesture callback function is registered by the
364
* grip_gesture_manager_register_window() function and gets called whenever a
365
* new gesture event has been received. The same function may be registered for
366
* more than one gesture type.
368
* The <type>GripGestureCallback</type> function is the main customization point
369
* for application response to gestural input.
191
371
typedef void (* GripGestureCallback) (GtkWidget *widget,
192
372
GripTimeType time,
193
373
GripGestureEvent *gesture,
196
376
GType grip_gesture_manager_get_type (void) G_GNUC_CONST;