1 /*
2  * Clutter.
3  *
4  * An OpenGL based 'interactive canvas' library.
5  *
6  * Copyright (C) 2010  Intel Corporation.
7  * Copyright (C) 2011  Robert Bosch Car Multimedia GmbH.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
21  *
22  * Author:
23  *   Tomeu Vizoso <tomeu.vizoso@collabora.co.uk>
24  */
25 
26 #ifndef __CLUTTER_GESTURE_ACTION_H__
27 #define __CLUTTER_GESTURE_ACTION_H__
28 
29 #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
30 #error "Only <clutter/clutter.h> can be included directly."
31 #endif
32 
33 #include <clutter/clutter-action.h>
34 
35 G_BEGIN_DECLS
36 
37 #define CLUTTER_TYPE_GESTURE_ACTION (clutter_gesture_action_get_type ())
38 
39 CLUTTER_EXPORT
40 G_DECLARE_DERIVABLE_TYPE (ClutterGestureAction, clutter_gesture_action,
41                           CLUTTER, GESTURE_ACTION, ClutterAction);
42 
43 typedef struct _ClutterGestureActionPrivate ClutterGestureActionPrivate;
44 
45 /**
46  * ClutterGestureActionClass:
47  * @gesture_begin: class handler for the #ClutterGestureAction::gesture-begin signal
48  * @gesture_progress: class handler for the #ClutterGestureAction::gesture-progress signal
49  * @gesture_end: class handler for the #ClutterGestureAction::gesture-end signal
50  * @gesture_cancel: class handler for the #ClutterGestureAction::gesture-cancel signal
51  * @gesture_prepare: virtual function called before emitting the
52  *   #ClutterGestureAction::gesture-cancel signal
53  *
54  * The #ClutterGestureClass structure contains only
55  * private data.
56  *
57  * Since: 1.8
58  */
59 struct _ClutterGestureActionClass
60 {
61   /*< private >*/
62   ClutterActionClass parent_class;
63 
64   /*< public >*/
65   gboolean (* gesture_begin)    (ClutterGestureAction  *action,
66                                  ClutterActor          *actor);
67   gboolean (* gesture_progress) (ClutterGestureAction  *action,
68                                  ClutterActor          *actor);
69   void     (* gesture_end)      (ClutterGestureAction  *action,
70                                  ClutterActor          *actor);
71   void     (* gesture_cancel)   (ClutterGestureAction  *action,
72                                  ClutterActor          *actor);
73   gboolean (* gesture_prepare)  (ClutterGestureAction  *action,
74                                  ClutterActor          *actor);
75 
76   /*< private >*/
77   void (* _clutter_gesture_action1) (void);
78   void (* _clutter_gesture_action2) (void);
79   void (* _clutter_gesture_action3) (void);
80   void (* _clutter_gesture_action4) (void);
81   void (* _clutter_gesture_action5) (void);
82   void (* _clutter_gesture_action6) (void);
83 };
84 
85 CLUTTER_EXPORT
86 ClutterAction *        clutter_gesture_action_new                      (void);
87 
88 CLUTTER_EXPORT
89 gint                   clutter_gesture_action_get_n_touch_points   (ClutterGestureAction *action);
90 CLUTTER_EXPORT
91 void                   clutter_gesture_action_set_n_touch_points   (ClutterGestureAction *action,
92                                                                     gint                  nb_points);
93 CLUTTER_EXPORT
94 void                   clutter_gesture_action_get_press_coords     (ClutterGestureAction *action,
95                                                                     guint                 point,
96                                                                     gfloat               *press_x,
97                                                                     gfloat               *press_y);
98 CLUTTER_EXPORT
99 void                   clutter_gesture_action_get_motion_coords    (ClutterGestureAction *action,
100                                                                     guint                 point,
101                                                                     gfloat               *motion_x,
102                                                                     gfloat               *motion_y);
103 CLUTTER_EXPORT
104 gfloat                 clutter_gesture_action_get_motion_delta     (ClutterGestureAction *action,
105                                                                     guint                 point,
106                                                                     gfloat               *delta_x,
107                                                                     gfloat               *delta_y);
108 CLUTTER_EXPORT
109 void                   clutter_gesture_action_get_release_coords   (ClutterGestureAction *action,
110                                                                     guint                 point,
111                                                                     gfloat               *release_x,
112                                                                     gfloat               *release_y);
113 CLUTTER_EXPORT
114 gfloat                 clutter_gesture_action_get_velocity         (ClutterGestureAction *action,
115                                                                     guint                 point,
116                                                                     gfloat               *velocity_x,
117                                                                     gfloat               *velocity_y);
118 
119 CLUTTER_EXPORT
120 guint                  clutter_gesture_action_get_n_current_points (ClutterGestureAction *action);
121 
122 CLUTTER_EXPORT
123 ClutterEventSequence * clutter_gesture_action_get_sequence         (ClutterGestureAction *action,
124                                                                     guint                 point);
125 
126 CLUTTER_EXPORT
127 ClutterInputDevice *   clutter_gesture_action_get_device           (ClutterGestureAction *action,
128                                                                     guint                 point);
129 
130 CLUTTER_EXPORT
131 const ClutterEvent *   clutter_gesture_action_get_last_event       (ClutterGestureAction *action,
132                                                                     guint                 point);
133 
134 CLUTTER_EXPORT
135 void                   clutter_gesture_action_cancel               (ClutterGestureAction *action);
136 
137 CLUTTER_EXPORT
138 void                            clutter_gesture_action_set_threshold_trigger_edge       (ClutterGestureAction      *action,
139                                                                                          ClutterGestureTriggerEdge  edge);
140 CLUTTER_DEPRECATED_FOR(clutter_gesture_action_get_threshold_trigger_edge)
141 ClutterGestureTriggerEdge       clutter_gesture_action_get_threshold_trigger_egde       (ClutterGestureAction      *action);
142 CLUTTER_EXPORT
143 ClutterGestureTriggerEdge       clutter_gesture_action_get_threshold_trigger_edge       (ClutterGestureAction      *action);
144 
145 CLUTTER_EXPORT
146 void                            clutter_gesture_action_set_threshold_trigger_distance   (ClutterGestureAction      *action,
147                                                                                          float                      x,
148                                                                                          float                      y);
149 
150 CLUTTER_EXPORT
151 void                            clutter_gesture_action_get_threshold_trigger_distance   (ClutterGestureAction *action,
152                                                                                          float                *x,
153                                                                                          float                *y);
154 
155 G_END_DECLS
156 
157 #endif /* __CLUTTER_GESTURE_ACTION_H__ */
158