summaryrefslogtreecommitdiff
path: root/src/lib/elementary/elm_gesture_layer_eo.h
blob: 2f15a106606495c2776f5192fe06f2934054a902 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
#ifndef _ELM_GESTURE_LAYER_EO_H_
#define _ELM_GESTURE_LAYER_EO_H_

#ifndef _ELM_GESTURE_LAYER_EO_CLASS_TYPE
#define _ELM_GESTURE_LAYER_EO_CLASS_TYPE

typedef Eo Elm_Gesture_Layer;

#endif

#ifndef _ELM_GESTURE_LAYER_EO_TYPES
#define _ELM_GESTURE_LAYER_EO_TYPES

/** Enum of supported gesture types.
 *
 * @ingroup Elm_Gesture
 */
typedef enum
{
  ELM_GESTURE_FIRST = 0, /**< First type used for iteration over the enum */
  ELM_GESTURE_N_TAPS, /**< N fingers single taps */
  ELM_GESTURE_N_LONG_TAPS, /**< N fingers single long-taps */
  ELM_GESTURE_N_DOUBLE_TAPS, /**< N fingers double-single taps */
  ELM_GESTURE_N_TRIPLE_TAPS, /**< N fingers triple-single taps */
  ELM_GESTURE_MOMENTUM, /**< Reports momentum in the direction of move */
  ELM_GESTURE_N_LINES, /**< N fingers line gesture */
  ELM_GESTURE_N_FLICKS, /**< N fingers flick gesture */
  ELM_GESTURE_ZOOM, /**< Zoom */
  ELM_GESTURE_ROTATE, /**< Rotate */
  ELM_GESTURE_LAST /**< Sentinel value to indicate last enum field during
                    * iteration */
} Elm_Gesture_Type;

/** Enum of gesture states.
 *
 * @ingroup Elm_Gesture
 */
typedef enum
{
  ELM_GESTURE_STATE_UNDEFINED = -1 /* +1 */, /**< Gesture not started */
  ELM_GESTURE_STATE_START, /**< Gesture started */
  ELM_GESTURE_STATE_MOVE, /**< Gesture is ongoing */
  ELM_GESTURE_STATE_END, /**< Gesture completed */
  ELM_GESTURE_STATE_ABORT /**< Ongoing gesture was aborted */
} Elm_Gesture_State;


#endif
/** Elementary gesture layer class
 *
 * @ingroup Elm_Gesture_Layer
 */
#define ELM_GESTURE_LAYER_CLASS elm_gesture_layer_class_get()

EWAPI const Efl_Class *elm_gesture_layer_class_get(void);

/**
 * @brief Control step value for zoom action.
 *
 * When recognizing the zoom gesture, it should be recognized as zooming larger
 * than step.
 *
 * @param[in] obj The object.
 * @param[in] step The zoom step value.
 *
 * @ingroup Elm_Gesture_Layer
 */
EOAPI void elm_obj_gesture_layer_zoom_step_set(Eo *obj, double step);

/**
 * @brief Control step value for zoom action.
 *
 * @param[in] obj The object.
 *
 * @return The zoom step value.
 *
 * @ingroup Elm_Gesture_Layer
 */
EOAPI double elm_obj_gesture_layer_zoom_step_get(const Eo *obj);

/**
 * @brief This function sets the gesture layer finger-size for taps.
 *
 * If not set, it's taken from elm_config. Set to 0 if you want GLayer to use
 * the system finger size value (default).
 *
 * @param[in] obj The object.
 * @param[in] sz The finger size.
 *
 * @since 1.8
 *
 * @ingroup Elm_Gesture_Layer
 */
EOAPI void elm_obj_gesture_layer_tap_finger_size_set(Eo *obj, int sz);

/**
 * @brief This function returns the gesture layer finger-size for taps
 *
 * @param[in] obj The object.
 *
 * @return The finger size.
 *
 * @since 1.8
 *
 * @ingroup Elm_Gesture_Layer
 */
EOAPI int elm_obj_gesture_layer_tap_finger_size_get(const Eo *obj);

/**
 * @brief This function makes gesture-layer repeat events.
 *
 * Set this if you like to get the raw events only if gestures were not
 * detected.
 *
 * Clear this if you like gesture layer to forward events as testing gestures.
 *
 * @param[in] obj The object.
 * @param[in] hold_events If @c true get events only if gesture was not
 * detected, @c false otherwise
 *
 * @ingroup Elm_Gesture_Layer
 */
EOAPI void elm_obj_gesture_layer_hold_events_set(Eo *obj, Eina_Bool hold_events);

/**
 * @brief Get the repeat-events setting.
 *
 * @param[in] obj The object.
 *
 * @return If @c true get events only if gesture was not detected, @c false
 * otherwise
 *
 * @ingroup Elm_Gesture_Layer
 */
EOAPI Eina_Bool elm_obj_gesture_layer_hold_events_get(const Eo *obj);

/**
 * @brief This function returns step-value for rotate action.
 *
 * Set to 0 to cancel step setting.
 *
 * When recognizing the rotate gesture, the rotated size must be larger than
 * step.
 *
 * @param[in] obj The object.
 * @param[in] step New rotate step value.
 *
 * @ingroup Elm_Gesture_Layer
 */
EOAPI void elm_obj_gesture_layer_rotate_step_set(Eo *obj, double step);

/**
 * @brief This function returns step-value for rotate action.
 *
 * @param[in] obj The object.
 *
 * @return New rotate step value.
 *
 * @ingroup Elm_Gesture_Layer
 */
EOAPI double elm_obj_gesture_layer_rotate_step_get(const Eo *obj);

/**
 * @brief Set the gesture state change callback.
 *
 * When all callbacks for the gesture are set to @c null, it means this gesture
 * is disabled.
 *
 * @param[in] obj The object.
 * @param[in] idx The gesture you want to track state of.
 * @param[in] cb_type The event the callback tracks (START, MOVE, END, ABORT).
 * @param[in] cb The callback itself.
 * @param[in] data Custom data to be passed.
 *
 * @ingroup Elm_Gesture_Layer
 */
EOAPI void elm_obj_gesture_layer_cb_set(Eo *obj, Elm_Gesture_Type idx, Elm_Gesture_State cb_type, Elm_Gesture_Event_Cb cb, void *data);

/**
 * @brief Attach a gesture layer widget to an Evas object (setting the widget's
 * target).
 *
 * A gesture layer's target may be any Evas object. This object will be used to
 * listen to mouse and key events.
 *
 * @param[in] obj The object.
 * @param[in] target The object to attach.
 *
 * @return @c true on success, @c false otherwise.
 *
 * @ingroup Elm_Gesture_Layer
 */
EOAPI Eina_Bool elm_obj_gesture_layer_attach(Eo *obj, Efl_Canvas_Object *target);

/**
 * @brief Remove a gesture callback.
 *
 * @param[in] obj The object.
 * @param[in] idx The gesture you want to track state of.
 * @param[in] cb_type The event the callback tracks (START, MOVE, END, ABORT).
 * @param[in] cb The callback itself.
 * @param[in] data Custom callback data.
 *
 * @ingroup Elm_Gesture_Layer
 */
EOAPI void elm_obj_gesture_layer_cb_del(Eo *obj, Elm_Gesture_Type idx, Elm_Gesture_State cb_type, Elm_Gesture_Event_Cb cb, void *data);

/**
 * @brief Add a gesture state change callback.
 *
 * When all callbacks for the gesture are set to @c null, it means this gesture
 * is disabled.
 *
 * If a function was already set for this gesture/type/state, it will be
 * replaced by the new one. For ABI compat, callbacks added by
 * @ref elm_obj_gesture_layer_cb_add will be removed. It is recommended to use
 * only one of these functions for a gesture object.
 *
 * @param[in] obj The object.
 * @param[in] idx The gesture you want to track state of.
 * @param[in] cb_type The event the callback tracks (START, MOVE, END, ABORT).
 * @param[in] cb The callback itself.
 * @param[in] data Custom data to be passed.
 *
 * @ingroup Elm_Gesture_Layer
 */
EOAPI void elm_obj_gesture_layer_cb_add(Eo *obj, Elm_Gesture_Type idx, Elm_Gesture_State cb_type, Elm_Gesture_Event_Cb cb, void *data);

#endif