tizen 2.4 release
[framework/uifw/elementary.git] / src / lib / elm_gesture_layer_common.h
1 /**
2  * @addtogroup Elm_Gesture_Layer
3  *
4  * @{
5  */
6
7 /**
8  * @typedef Elm_Gesture_Type
9  * @brief This is a convenient macro around #_Elm_Gesture_Type.
10  */
11 typedef enum
12 {
13    ELM_GESTURE_FIRST = 0,
14
15    ELM_GESTURE_N_TAPS, /**< N fingers single taps */
16    ELM_GESTURE_N_LONG_TAPS, /**< N fingers single long-taps */
17    ELM_GESTURE_N_DOUBLE_TAPS, /**< N fingers double-single taps */
18    ELM_GESTURE_N_TRIPLE_TAPS, /**< N fingers triple-single taps */
19
20    ELM_GESTURE_MOMENTUM, /**< Reports momentum in the direction of move */
21
22    ELM_GESTURE_N_LINES, /**< N fingers line gesture */
23    ELM_GESTURE_N_FLICKS, /**< N fingers flick gesture */
24
25    ELM_GESTURE_ZOOM, /**< Zoom */
26    ELM_GESTURE_ROTATE, /**< Rotate */
27
28    ELM_GESTURE_LAST
29 } Elm_Gesture_Type;
30
31 /**
32  * @typedef Elm_Gesture_State
33  * @brief This is a convenient macro around #_Elm_Gesture_State
34  */
35 typedef enum
36 {
37    ELM_GESTURE_STATE_UNDEFINED = -1, /**< Gesture not STARTed */
38    ELM_GESTURE_STATE_START, /**< Gesture STARTed     */
39    ELM_GESTURE_STATE_MOVE, /**< Gesture is ongoing  */
40    ELM_GESTURE_STATE_END, /**< Gesture completed   */
41    ELM_GESTURE_STATE_ABORT /**< Ongoing gesture was ABORTed */
42 } Elm_Gesture_State;
43
44 /**
45  * @typedef Elm_Gesture_Taps_Info
46  * @brief The structure type that holds taps info for the user.
47  */
48 typedef struct _Elm_Gesture_Taps_Info Elm_Gesture_Taps_Info;
49
50 /**
51  * Struct holds taps info for user
52  */
53 struct _Elm_Gesture_Taps_Info
54 {
55    Evas_Coord   x, y; /**< Holds center point between fingers */
56    unsigned int n; /**< Number of fingers tapped           */
57    unsigned int timestamp; /**< event timestamp       */
58 };
59
60 /**
61  * @typedef Elm_Gesture_Momentum_Info
62  * @brief The structure type that holds momentum info for the user.
63  */
64 typedef struct _Elm_Gesture_Momentum_Info Elm_Gesture_Momentum_Info;
65
66 /**
67  * Struct holds momentum info for user
68  * x1 and y1 are not necessarily in sync
69  * x1 holds x value of x direction starting point
70  * and same holds for y1.
71  * This is noticeable when doing V-shape movement
72  */
73 struct _Elm_Gesture_Momentum_Info /* Report line ends, timestamps, and momentum computed        */
74 {
75    Evas_Coord   x1; /**< Final-swipe direction starting point on X */
76    Evas_Coord   y1; /**< Final-swipe direction starting point on Y */
77    Evas_Coord   x2; /**< Final-swipe direction ending point on X   */
78    Evas_Coord   y2; /**< Final-swipe direction ending point on Y   */
79
80    unsigned int tx; /**< Timestamp of start of final x-swipe */
81    unsigned int ty; /**< Timestamp of start of final y-swipe */
82
83    Evas_Coord   mx; /**< Momentum on X */
84    Evas_Coord   my; /**< Momentum on Y */
85
86    unsigned int n; /**< Number of fingers */
87 };
88
89 /**
90  * @typedef Elm_Gesture_Line_Info
91  * @brief The structure type that holds line info for the user.
92  */
93 typedef struct _Elm_Gesture_Line_Info Elm_Gesture_Line_Info;
94
95 /**
96  * Struct holds line info for user
97  */
98 struct _Elm_Gesture_Line_Info   /* Report line ends, timestamps, and momentum computed      */
99 {
100    Elm_Gesture_Momentum_Info momentum; /**< Line momentum info */
101    double                    angle; /**< Angle (direction) of lines  */
102 };
103
104 /**
105  * @typedef Elm_Gesture_Zoom_Info
106  * @brief The structure type that holds zoom info for the user.
107  */
108 typedef struct _Elm_Gesture_Zoom_Info Elm_Gesture_Zoom_Info;
109
110 /**
111  * Struct holds zoom info for user
112  */
113 struct _Elm_Gesture_Zoom_Info
114 {
115    Evas_Coord x, y; /**< Holds zoom center point reported to user  */
116    Evas_Coord radius; /**< Holds radius between fingers reported to user */
117    double     zoom; /**< Zoom value: 1.0 means no zoom             */
118    double     momentum; /**< Zoom momentum: zoom growth per second (NOT YET SUPPORTED) */
119 };
120
121 /**
122  * @typedef Elm_Gesture_Rotate_Info
123  * @brief The structure type that holds rotation info for the user.
124  */
125 typedef struct _Elm_Gesture_Rotate_Info Elm_Gesture_Rotate_Info;
126
127 /**
128  * Struct holds rotation info for user
129  */
130 struct _Elm_Gesture_Rotate_Info
131 {
132    Evas_Coord x, y; /**< Holds zoom center point reported to user      */
133    Evas_Coord radius; /**< Holds radius between fingers reported to user */
134    double     base_angle; /**< Holds start-angle */
135    double     angle; /**< Rotation value: 0.0 means no rotation         */
136    double     momentum; /**< Rotation momentum: rotation done per second (NOT YET SUPPORTED) */
137 };
138
139 /**
140  * @typedef Elm_Gesture_Event_Cb
141  * @brief User callback used to stream gesture info from the gesture layer.
142  *
143  * @remarks You should probably return EVAS_EVENT_FLAG_ON_HOLD if your widget acted
144  *          upon the event, in an irreversible way.
145  *
146  * @param data The user data
147  * @param event_info The gesture report info
148  * @return The flag field to be applied on the causing event
149  *
150  */
151 typedef Evas_Event_Flags (*Elm_Gesture_Event_Cb)(void *data, void *event_info);
152
153 /**
154  * @brief This function sets the gesture layer line min length of an object
155  *
156  * @if MOBILE @since_tizen 2.3
157  * @elseif WEARABLE @since_tizen 2.3.1
158  * @endif
159  *
160  * @param[in] obj gesture-layer.
161  * @param[in] line_min_length the length.
162  *
163  * @since 1.8
164  */
165 EAPI void elm_gesture_layer_line_min_length_set(Evas_Object *obj, int line_min_length);
166
167 /**
168  * @brief This function returns the gesture layer line min length of an object
169  *
170  * @if MOBILE @since_tizen 2.3
171  * @elseif WEARABLE @since_tizen 2.3.1
172  * @endif
173  *
174  * @param[in] obj gesture-layer.
175  * @return the length.
176  *
177  * @since 1.8
178  */
179 EAPI int elm_gesture_layer_line_min_length_get(const Evas_Object *obj);
180
181 /**
182  * @brief This function sets the gesture layer zoom distance tolerance of an object
183  *
184  * @if MOBILE @since_tizen 2.3
185  * @elseif WEARABLE @since_tizen 2.3.1
186  * @endif
187  *
188  * @param[in] obj gesture-layer.
189  * @param[in] zoom_distance_tolerance zoom distance tolerance
190  *
191  * @since 1.8
192  */
193 EAPI void elm_gesture_layer_zoom_distance_tolerance_set(Evas_Object *obj, Evas_Coord zoom_distance_tolerance);
194
195 /**
196  * @brief This function returns the gesture layer zoom distance tolerance of an object
197  *
198  * @if MOBILE @since_tizen 2.3
199  * @elseif WEARABLE @since_tizen 2.3.1
200  * @endif
201  *
202  * @param[in] obj gesture-layer.
203  * @return zoom distance tolerance
204  *
205  * @since 1.8
206  */
207 EAPI Evas_Coord elm_gesture_layer_zoom_distance_tolerance_get(const Evas_Object *obj);
208
209 /**
210  * @brief This function sets the gesture layer line distance tolerance of an object
211  *
212  * @if MOBILE @since_tizen 2.3
213  * @elseif WEARABLE @since_tizen 2.3.1
214  * @endif
215  *
216  * @param[in] obj gesture-layer.
217  * @param[in] line_distance_tolerance line distance tolerance
218  *
219  * @since 1.8
220  */
221 EAPI void elm_gesture_layer_line_distance_tolerance_set(Evas_Object *obj, Evas_Coord line_distance_tolerance);
222
223 /**
224  * @brief This function returns the gesture layer line distance tolerance of an object
225  *
226  * @if MOBILE @since_tizen 2.3
227  * @elseif WEARABLE @since_tizen 2.3.1
228  * @endif
229  *
230  * @param[in] obj gesture-layer.
231  * @return line distance tolerance
232  *
233  * @since 1.8
234  */
235 EAPI Evas_Coord elm_gesture_layer_line_distance_tolerance_get(const Evas_Object *obj);
236
237 /**
238  * @brief This function sets the gesture layer line angular tolerance of an object
239  *
240  * @if MOBILE @since_tizen 2.3
241  * @elseif WEARABLE @since_tizen 2.3.1
242  * @endif
243  *
244  * @param[in] obj gesture-layer.
245  * @param[in] line_angular_tolerance line angular tolerance
246  *
247  * @since 1.8
248  */
249 EAPI void elm_gesture_layer_line_angular_tolerance_set(Evas_Object *obj, double line_angular_tolerance);
250
251 /**
252  * @brief This function returns the gesture layer line angular tolerance of an object
253  *
254  * @if MOBILE @since_tizen 2.3
255  * @elseif WEARABLE @since_tizen 2.3.1
256  * @endif
257  *
258  * @param[in] obj gesture-layer.
259  * @return line angular tolerance
260  *
261  * @since 1.8
262  */
263 EAPI double elm_gesture_layer_line_angular_tolerance_get(const Evas_Object *obj);
264
265 /**
266  * @brief This function sets the gesture layer zoom wheel factor of an object
267  *
268  * @if MOBILE @since_tizen 2.3
269  * @elseif WEARABLE @since_tizen 2.3.1
270  * @endif
271  *
272  * @param[in] obj gesture-layer.
273  * @param[in] zoom_wheel_factor zoom wheel factor
274  *
275  * @since 1.8
276  */
277 EAPI void elm_gesture_layer_zoom_wheel_factor_set(Evas_Object *obj, double zoom_wheel_factor);
278
279 /**
280  * @brief This function returns the gesture layer zoom wheel factor of an object
281  *
282  * @if MOBILE @since_tizen 2.3
283  * @elseif WEARABLE @since_tizen 2.3.1
284  * @endif
285  *
286  * @param[in] obj gesture-layer.
287  * @return zoom wheel factor
288  *
289  * @since 1.8
290  */
291 EAPI double elm_gesture_layer_zoom_wheel_factor_get(const Evas_Object *obj);
292
293 /**
294  * @brief This function sets the gesture layer zoom finger factor of an object
295  *
296  * @if MOBILE @since_tizen 2.3
297  * @elseif WEARABLE @since_tizen 2.3.1
298  * @endif
299  *
300  * @param[in] obj gesture-layer.
301  * @param[in] zoom_finger_factor zoom finger factor
302  *
303  * @since 1.8
304  */
305 EAPI void elm_gesture_layer_zoom_finger_factor_set(Evas_Object *obj, double zoom_finger_factor);
306
307 /**
308  * @brief This function returns the gesture layer zoom finger factor of an object
309  *
310  * @if MOBILE @since_tizen 2.3
311  * @elseif WEARABLE @since_tizen 2.3.1
312  * @endif
313  *
314  * @param[in] obj gesture-layer.
315  * @return zoom finger factor
316  *
317  * @since 1.8
318  */
319 EAPI double elm_gesture_layer_zoom_finger_factor_get(const Evas_Object *obj);
320
321 /**
322  * @brief This function sets the gesture layer rotate angular tolerance of an object
323  *
324  * @if MOBILE @since_tizen 2.3
325  * @elseif WEARABLE @since_tizen 2.3.1
326  * @endif
327  *
328  * @param[in] obj gesture-layer.
329  * @param[in] rotate_angular_tolerance rotate angular tolerance
330  *
331  * @since 1.8
332  */
333 EAPI void elm_gesture_layer_rotate_angular_tolerance_set(Evas_Object *obj, double rotate_angular_tolerance);
334
335 /**
336  * @brief This function returns the gesture layer rotate angular tolerance of an object
337  *
338  * @if MOBILE @since_tizen 2.3
339  * @elseif WEARABLE @since_tizen 2.3.1
340  * @endif
341  *
342  * @param[in] obj gesture-layer.
343  * @return rotate angular tolerance
344  *
345  * @since 1.8
346  */
347 EAPI double elm_gesture_layer_rotate_angular_tolerance_get(const Evas_Object *obj);
348
349 /**
350  * @brief This function sets the gesture layer flick time limit (in ms) of an object
351  *
352  * @if MOBILE @since_tizen 2.3
353  * @elseif WEARABLE @since_tizen 2.3.1
354  * @endif
355  *
356  * @param[in] obj gesture-layer.
357  * @param[in] flick_time_limit_ms flick time limit (in ms)
358  *
359  * @since 1.8
360  */
361 EAPI void elm_gesture_layer_flick_time_limit_ms_set(Evas_Object *obj, unsigned int flick_time_limit_ms);
362
363 /**
364  * @brief This function returns the gesture layer flick time limit (in ms) of an object
365  *
366  * @if MOBILE @since_tizen 2.3
367  * @elseif WEARABLE @since_tizen 2.3.1
368  * @endif
369  *
370  * @param[in] obj gesture-layer.
371  * @return flick time limit (in ms)
372  *
373  * @since 1.8
374  */
375 EAPI unsigned int elm_gesture_layer_flick_time_limit_ms_get(const Evas_Object *obj);
376
377 /**
378  * @brief This function sets the gesture layer long tap start timeout of an object
379  *
380  * @if MOBILE @since_tizen 2.3
381  * @elseif WEARABLE @since_tizen 2.3.1
382  * @endif
383  *
384  * @param[in] obj gesture-layer.
385  * @param[in] long_tap_start_timeout long tap start timeout
386  *
387  * @since 1.8
388  */
389 EAPI void elm_gesture_layer_long_tap_start_timeout_set(Evas_Object *obj, double long_tap_start_timeout);
390
391 /**
392  * @brief this function returns the gesture layer long tap start timeout of an object
393  *
394  * @if MOBILE @since_tizen 2.3
395  * @elseif WEARABLE @since_tizen 2.3.1
396  * @endif
397  *
398  * @param[in] obj gesture-layer.
399  * @return long tap start timeout
400  *
401  * @since 1.8
402  */
403 EAPI double elm_gesture_layer_long_tap_start_timeout_get(const Evas_Object *obj);
404
405 /**
406  * @brief This function sets the gesture layer continues enable of an object
407  *
408  * @if MOBILE @since_tizen 2.3
409  * @elseif WEARABLE @since_tizen 2.3.1
410  * @endif
411  *
412  * @param[in] obj gesture-layer.
413  * @param[in] continues_enable continues enable
414  *
415  * @since 1.8
416  */
417 EAPI void elm_gesture_layer_continues_enable_set(Evas_Object *obj, Eina_Bool continues_enable);
418
419 /**
420  * @brief This function returns the gesture layer continues enable of an object
421  *
422  * @if MOBILE @since_tizen 2.3
423  * @elseif WEARABLE @since_tizen 2.3.1
424  * @endif
425  *
426  * @param[in] obj gesture-layer.
427  * @return continues enable
428  *
429  * @since 1.8
430  */
431 EAPI Eina_Bool elm_gesture_layer_continues_enable_get(const Evas_Object *obj);
432
433 /**
434  * @brief This function sets the gesture layer double tap timeout of an object
435  *
436  * @if MOBILE @since_tizen 2.3
437  * @elseif WEARABLE @since_tizen 2.3.1
438  * @endif
439  *
440  * @param[in] obj gesture-layer.
441  * @param[in] double_tap_timeout double tap timeout
442  *
443  * @since 1.8
444  */
445 EAPI void elm_gesture_layer_double_tap_timeout_set(Evas_Object *obj, double double_tap_timeout);
446
447 /**
448  * @brief this function returns the gesture layer double tap timeout of an object
449  *
450  * @if MOBILE @since_tizen 2.3
451  * @elseif WEARABLE @since_tizen 2.3.1
452  * @endif
453  *
454  * @param[in] obj gesture-layer.
455  * @return double tap timeout
456  *
457  * @since 1.8
458  */
459 EAPI double elm_gesture_layer_double_tap_timeout_get(const Evas_Object *obj);
460
461 /**
462  * @internal
463  *
464  * @brief This function sets the gesture layer finger-size for taps
465  * If not set, this size taken from elm_config.
466  * Set to ZERO if you want GLayer to use system finger size value (default)
467  *
468  * @if MOBILE @since_tizen 2.3
469  * @elseif WEARABLE @since_tizen 2.3.1
470  * @endif
471  *
472  * @param[in] obj gesture-layer.
473  * @param[in] sz Finger size
474  *
475  * @since 1.8
476  */
477 EAPI void elm_gesture_layer_tap_finger_size_set(Evas_Object *obj, Evas_Coord sz);
478
479 /**
480  * @internal
481  *
482  * @brief This function returns the gesture layer finger-size for taps
483  *
484  * @if MOBILE @since_tizen 2.3
485  * @elseif WEARABLE @since_tizen 2.3.1
486  * @endif
487  *
488  * @param[in] obj gesture-layer.
489  * @return Finger size that is currently used by Gesture Layer for taps.
490  *
491  * @since 1.8
492  */
493 EAPI Evas_Coord elm_gesture_layer_tap_finger_size_get(const Evas_Object *obj);
494
495 /**
496  * @}
497  */