Tizen Native API

This provides basic gesture detection.

gesture_layer_inheritance_tree.png

Gesture Layer Usage:

Use Gesture Layer to detect gestures. The advantage is that you don't have to implement gesture detection, just set callbacks of the gesture state. By using the gesture layer we make a standard interface.

In order to use Gesture Layer you start with elm_gesture_layer_add and a parent object parameter. Next 'activate' the gesture layer with a call to elm_gesture_layer_attach Usually with the same object as target (2nd parameter).

Now you need to tell the gesture layer what gestures you follow. This is done with elm_gesture_layer_cb_set call. By setting the callback you are actually telling the gesture layer: I would like to know when the gesture Elm_Gesture_Type switches to the state Elm_Gesture_State.

Next, you need to implement the actual action that follows the input in your callback.

Note that if you like to stop being reported about a gesture, just set all callbacks referring to this gesture to NULL. (again with elm_gesture_layer_cb_set)

The information reported by the gesture layer to your callback is depending on Elm_Gesture_Type : Elm_Gesture_Taps_Info is the info reported for tap gestures: ELM_GESTURE_N_TAPS, ELM_GESTURE_N_LONG_TAPS, ELM_GESTURE_N_DOUBLE_TAPS, ELM_GESTURE_N_TRIPLE_TAPS.

Elm_Gesture_Momentum_Info is the info reported for momentum gestures: ELM_GESTURE_MOMENTUM.

Elm_Gesture_Line_Info is the info reported for line gestures: (this also contains the Elm_Gesture_Momentum_Info internal structure) ELM_GESTURE_N_LINES, ELM_GESTURE_N_FLICKS. Note that we consider a flick as a line-gesture that should be completed in a flick-time-limit as defined in Elementary Config.

Elm_Gesture_Zoom_Info is the info reported for the ELM_GESTURE_ZOOM gesture.

Elm_Gesture_Rotate_Info is the info reported for the ELM_GESTURE_ROTATE gesture.

Gesture Layer Tweaks:

Note that line, flick, gestures can start without the need to remove fingers from the surface. When the user's fingers rest on the same-spot, the gesture ends and starts again when the fingers are moved.

Setting glayer_continues_enable to false in Elementary Config changes this behavior, so the gesture starts when the user touches (a *DOWN event) touch-surface and ends when no fingers touch the surface (a *UP event).

Supported common elm_object APIs.

Functions

void elm_gesture_layer_cb_set (Evas_Object *obj, Elm_Gesture_Type idx, Elm_Gesture_State cb_type, Elm_Gesture_Event_Cb cb, void *data)
 Sets callbacks to be notified about the change of state of a gesture.
Eina_Bool elm_gesture_layer_hold_events_get (const Evas_Object *obj)
 Called to get repeat-events settings.
void elm_gesture_layer_hold_events_set (Evas_Object *obj, Eina_Bool hold_events)
 Makes gesture-layer repeat events.
void elm_gesture_layer_zoom_step_set (Evas_Object *obj, double step)
 Sets the step-value for zoom action.
double elm_gesture_layer_zoom_step_get (const Evas_Object *obj)
 Gets the step-value for zoom action.
void elm_gesture_layer_rotate_step_set (Evas_Object *obj, double step)
 Sets the step-value for rotate action.
double elm_gesture_layer_rotate_step_get (const Evas_Object *obj)
 Gets the step-value for rotate action.
Eina_Bool elm_gesture_layer_attach (Evas_Object *obj, Evas_Object *target)
 Attaches a given gesture layer widget to an Evas object, thus setting the widget's target.
Evas_Objectelm_gesture_layer_add (Evas_Object *parent)
 Called to construct a new gesture-layer object.
void elm_gesture_layer_line_min_length_set (Evas_Object *obj, int line_min_length)
 Sets the gesture layer line min length of an object.
int elm_gesture_layer_line_min_length_get (const Evas_Object *obj)
 Gets the gesture layer line min length of an object.
void elm_gesture_layer_zoom_distance_tolerance_set (Evas_Object *obj, Evas_Coord zoom_distance_tolerance)
 Sets the gesture layer zoom distance tolerance of an object.
Evas_Coord elm_gesture_layer_zoom_distance_tolerance_get (const Evas_Object *obj)
 Gets the gesture layer zoom distance tolerance of an object.
void elm_gesture_layer_line_distance_tolerance_set (Evas_Object *obj, Evas_Coord line_distance_tolerance)
 Sets the gesture layer line distance tolerance of an object.
Evas_Coord elm_gesture_layer_line_distance_tolerance_get (const Evas_Object *obj)
 Gets the gesture layer line distance tolerance of an object.
void elm_gesture_layer_line_angular_tolerance_set (Evas_Object *obj, double line_angular_tolerance)
 Sets the gesture layer line angular tolerance of an object.
double elm_gesture_layer_line_angular_tolerance_get (const Evas_Object *obj)
 Gets the gesture layer line angular tolerance of an object.
void elm_gesture_layer_zoom_wheel_factor_set (Evas_Object *obj, double zoom_wheel_factor)
 Sets the gesture layer zoom wheel factor of an object.
double elm_gesture_layer_zoom_wheel_factor_get (const Evas_Object *obj)
 Gets the gesture layer zoom wheel factor of an object.
void elm_gesture_layer_zoom_finger_factor_set (Evas_Object *obj, double zoom_finger_factor)
 Sets the gesture layer zoom finger factor of an object.
double elm_gesture_layer_zoom_finger_factor_get (const Evas_Object *obj)
 Gets the gesture layer zoom finger factor of an object.
void elm_gesture_layer_rotate_angular_tolerance_set (Evas_Object *obj, double rotate_angular_tolerance)
 Sets the gesture layer rotate angular tolerance of an object.
double elm_gesture_layer_rotate_angular_tolerance_get (const Evas_Object *obj)
 Gets the gesture layer rotate angular tolerance of an object.
void elm_gesture_layer_flick_time_limit_ms_set (Evas_Object *obj, unsigned int flick_time_limit_ms)
 Sets the gesture layer flick time limit (in ms) of an object.
unsigned int elm_gesture_layer_flick_time_limit_ms_get (const Evas_Object *obj)
 Gets the gesture layer flick time limit (in ms) of an object.
void elm_gesture_layer_long_tap_start_timeout_set (Evas_Object *obj, double long_tap_start_timeout)
 Sets the gesture layer long tap start timeout of an object.
double elm_gesture_layer_long_tap_start_timeout_get (const Evas_Object *obj)
 Gets the gesture layer long tap start timeout of an object.
void elm_gesture_layer_continues_enable_set (Evas_Object *obj, Eina_Bool continues_enable)
 Sets the gesture layer continues enable of an object.
Eina_Bool elm_gesture_layer_continues_enable_get (const Evas_Object *obj)
 Gets the gesture layer continues enable of an object.
void elm_gesture_layer_double_tap_timeout_set (Evas_Object *obj, double double_tap_timeout)
 Sets the gesture layer double tap timeout of an object.
double elm_gesture_layer_double_tap_timeout_get (const Evas_Object *obj)
 Gets the gesture layer double tap timeout of an object.
void elm_gesture_layer_tap_finger_size_set (Evas_Object *obj, Evas_Coord sz)
 Sets the gesture layer finger-size for taps.
Evas_Coord elm_gesture_layer_tap_finger_size_get (const Evas_Object *obj)
 Gets the gesture layer finger-size for taps.

Typedefs

typedef enum _Elm_Gesture_Type Elm_Gesture_Type
 This is a convenient macro around _Elm_Gesture_Type.
typedef enum _Elm_Gesture_State Elm_Gesture_State
 This is a convenient macro around _Elm_Gesture_State.
typedef struct
_Elm_Gesture_Taps_Info 
Elm_Gesture_Taps_Info
 The structure type that holds taps info for the user.
typedef struct
_Elm_Gesture_Momentum_Info 
Elm_Gesture_Momentum_Info
 The structure type that holds momentum info for the user.
typedef struct
_Elm_Gesture_Line_Info 
Elm_Gesture_Line_Info
 The structure type that holds line info for the user.
typedef struct
_Elm_Gesture_Zoom_Info 
Elm_Gesture_Zoom_Info
 The structure type that holds zoom info for the user.
typedef struct
_Elm_Gesture_Rotate_Info 
Elm_Gesture_Rotate_Info
 The structure type that holds rotation info for the user.
typedef Evas_Event_Flags(* Elm_Gesture_Event_Cb )(void *data, void *event_info)
 User callback used to stream gesture info from the gesture layer.

Typedef Documentation

User callback used to stream gesture info from the gesture layer.

Remarks:
You should probably return EVAS_EVENT_FLAG_ON_HOLD if your widget acted upon the event, in an irreversible way.
Parameters:
dataThe user data
event_infoThe gesture report info
Returns:
The flag field to be applied on the causing event

Enumeration Type Documentation

Enumeration of gesture states.

Enumerator:
ELM_GESTURE_STATE_UNDEFINED 

Gesture not STARTed

ELM_GESTURE_STATE_START 

Gesture STARTed

ELM_GESTURE_STATE_MOVE 

Gesture is ongoing

ELM_GESTURE_STATE_END 

Gesture has completed

ELM_GESTURE_STATE_ABORT 

Ongoing gesture has been ABORTed

Enumeration of supported gesture types.

Enumerator:
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 movement

ELM_GESTURE_N_LINES 

N fingers line gesture

ELM_GESTURE_N_FLICKS 

N fingers flick gesture

ELM_GESTURE_ZOOM 

Zoom

ELM_GESTURE_ROTATE 

Rotate


Function Documentation

Gets the duration for occurrence of the double tap event of the gesture layer.

Since :
2.3.1
Returns:
The timeout for the double tap event of the gesture layer
void elm_config_glayer_double_tap_timeout_set ( double  double_tap_timeout)

Sets the duration for occurrence of the double tap event of the gesture layer.

Since :
2.3.1
Parameters:
[in]double_tap_timeoutThe timeout for the double tap event of the gesture layer

Gets the duration for occurrence of the long tap event of the gesture layer.

Since :
2.3.1
Returns:
The timeout for the long tap event of the gesture layer
void elm_config_glayer_long_tap_start_timeout_set ( double  long_tap_timeout)

Sets the duration for occurrence of the long tap event of the gesture layer.

Since :
2.3.1
Parameters:
[in]long_tap_timeoutThe timeout for the long tap event of the gesture layer

Called to construct a new gesture-layer object.

Since :
2.3.1
Remarks:
This does not activate the gesture layer. You have to call elm_gesture_layer_attach() in order to 'activate' gesture-layer.
Parameters:
[in]parentThe gesture layer's parent widget
Returns:
A new gesture layer object

Attaches a given gesture layer widget to an Evas object, thus setting the widget's target.

Since :
2.3.1
Remarks:
A gesture layer target may be whichever Evas object one chooses. This is the object obj that listens to all mouse and key events and reports the gestures made upon it.
Parameters:
[in]objThe gesture layer to attach an object to
[in]targetThe object to attach to obj (target)
Returns:
EINA_TRUE on success, otherwise EINA_FALSE on failure
void elm_gesture_layer_cb_set ( Evas_Object obj,
Elm_Gesture_Type  idx,
Elm_Gesture_State  cb_type,
Elm_Gesture_Event_Cb  cb,
void *  data 
)

Sets callbacks to be notified about the change of state of a gesture.

Since :
2.3.1
Remarks:
When a user registers a callback with this function it means this gesture has to be tested.
When ALL callbacks for a gesture are set to NULL it means the user isn't interested in gesture-state and it is not tested.
Parameters:
[in]objThe gesture-layer
[in]idxThe gesture whose state is tracked
[in]cbThe callback function pointer
[in]cb_typeThe event type this callback tracks: START, MOVE, END, ABORT
[in]dataThe user info to be sent to the callback (usually, Smart Data)

Gets the gesture layer continues enable of an object.

Since (EFL) :
1.8
Since :
2.3.1
Parameters:
[in]objThe gesture-layer
Returns:
The continues enable
void elm_gesture_layer_continues_enable_set ( Evas_Object obj,
Eina_Bool  continues_enable 
)

Sets the gesture layer continues enable of an object.

Since (EFL) :
1.8
Since :
2.3.1
Parameters:
[in]objThe gesture-layer
[in]continues_enableThe continues enable

Gets the gesture layer double tap timeout of an object.

Since (EFL) :
1.8
Since :
2.3.1
Parameters:
[in]objThe gesture-layer
Returns:
The double tap timeout
void elm_gesture_layer_double_tap_timeout_set ( Evas_Object obj,
double  double_tap_timeout 
)

Sets the gesture layer double tap timeout of an object.

Since (EFL) :
1.8
Since :
2.3.1
Parameters:
[in]objThe gesture-layer
[in]double_tap_timeoutThe double tap timeout

Gets the gesture layer flick time limit (in ms) of an object.

Since (EFL) :
1.8
Since :
2.3.1
Parameters:
[in]objThe gesture-layer
Returns:
The flick time limit (in ms)
void elm_gesture_layer_flick_time_limit_ms_set ( Evas_Object obj,
unsigned int  flick_time_limit_ms 
)

Sets the gesture layer flick time limit (in ms) of an object.

Since (EFL) :
1.8
Since :
2.3.1
Parameters:
[in]objThe gesture-layer
[in]flick_time_limit_msThe flick time limit (in ms)

Called to get repeat-events settings.

Since :
2.3.1
Parameters:
[in]objThe gesture-layer
Returns:
The repeat events settings
See also:
elm_gesture_layer_hold_events_set()
void elm_gesture_layer_hold_events_set ( Evas_Object obj,
Eina_Bool  hold_events 
)

Makes gesture-layer repeat events.

Since :
2.3.1
Remarks:
Set this if you like to get the raw events only if gestures were not detected.
Clear this if you like the gesture layer to forward events as testing gestures.
Parameters:
[in]objThe gesture layer
[in]hold_eventsThe boolean value that indicates whether events are held

Gets the gesture layer line angular tolerance of an object.

Since (EFL) :
1.8
Since :
2.3.1
Parameters:
[in]objThe gesture-layer
Returns:
The line angular tolerance
void elm_gesture_layer_line_angular_tolerance_set ( Evas_Object obj,
double  line_angular_tolerance 
)

Sets the gesture layer line angular tolerance of an object.

Since (EFL) :
1.8
Since :
2.3.1
Parameters:
[in]objThe gesture-layer
[in]line_angular_toleranceThe line angular tolerance

Gets the gesture layer line distance tolerance of an object.

Since (EFL) :
1.8
Since :
2.3.1
Parameters:
[in]objThe gesture-layer
Returns:
The line distance tolerance
void elm_gesture_layer_line_distance_tolerance_set ( Evas_Object obj,
Evas_Coord  line_distance_tolerance 
)

Sets the gesture layer line distance tolerance of an object.

Since (EFL) :
1.8
Since :
2.3.1
Parameters:
[in]objThe gesture-layer
[in]line_distance_toleranceThe line distance tolerance

Gets the gesture layer line min length of an object.

Since (EFL) :
1.8
Since :
2.3.1
Parameters:
[in]objThe gesture-layer
Returns:
The length
void elm_gesture_layer_line_min_length_set ( Evas_Object obj,
int  line_min_length 
)

Sets the gesture layer line min length of an object.

Since (EFL) :
1.8
Since :
2.3.1
Parameters:
[in]objThe gesture-layer
[in]line_min_lengthThe length

Gets the gesture layer long tap start timeout of an object.

Since (EFL) :
1.8
Since :
2.3.1
Parameters:
[in]objThe gesture-layer
Returns:
The long tap start timeout
void elm_gesture_layer_long_tap_start_timeout_set ( Evas_Object obj,
double  long_tap_start_timeout 
)

Sets the gesture layer long tap start timeout of an object.

Since (EFL) :
1.8
Since :
2.3.1
Parameters:
[in]objThe gesture-layer
[in]long_tap_start_timeoutThe long tap start timeout

Gets the gesture layer rotate angular tolerance of an object.

Since (EFL) :
1.8
Since :
2.3.1
Parameters:
[in]objThe gesture-layer
Returns:
The rotate angular tolerance
void elm_gesture_layer_rotate_angular_tolerance_set ( Evas_Object obj,
double  rotate_angular_tolerance 
)

Sets the gesture layer rotate angular tolerance of an object.

Since (EFL) :
1.8
Since :
2.3.1
Parameters:
[in]objThe gesture-layer
[in]rotate_angular_toleranceThe rotate angular tolerance

Gets the step-value for rotate action.

Since :
2.3.1
Parameters:
[in]objThe gesture-layer
Returns:
The rotate step value
void elm_gesture_layer_rotate_step_set ( Evas_Object obj,
double  step 
)

Sets the step-value for rotate action.

Since :
2.3.1
Remarks:
Set the step to any positive value.
Cancel the step setting by setting to 0.
Parameters:
[in]objThe gesture-layer
[in]stepThe new rotate step value

Gets the gesture layer finger-size for taps.

Since (EFL) :
1.8
Since :
2.3.1
Parameters:
[in]objThe gesture-layer
Returns:
The finger size that is currently used by the Gesture Layer for taps

Sets the gesture layer finger-size for taps.

Since :
2.3.1
Remarks:
If not set, this size is taken from elm_config. Set to ZERO if you want GLayer to use system finger size value (default) It is recommended to not set a very big or small value to avoid weird behaviors.
Parameters:
[in]objThe gesture-layer
[in]szThe finger size

Gets the gesture layer zoom distance tolerance of an object.

Since (EFL) :
1.8
Since :
2.3.1
Parameters:
[in]objThe gesture-layer
Returns:
The zoom distance tolerance
void elm_gesture_layer_zoom_distance_tolerance_set ( Evas_Object obj,
Evas_Coord  zoom_distance_tolerance 
)

Sets the gesture layer zoom distance tolerance of an object.

Since (EFL) :
1.8
Since :
2.3.1
Parameters:
[in]objThe gesture-layer
[in]zoom_distance_toleranceThe zoom distance tolerance

Gets the gesture layer zoom finger factor of an object.

Since (EFL) :
1.8
Since :
2.3.1
Parameters:
[in]objThe gesture-layer
Returns:
The zoom finger factor
void elm_gesture_layer_zoom_finger_factor_set ( Evas_Object obj,
double  zoom_finger_factor 
)

Sets the gesture layer zoom finger factor of an object.

Since (EFL) :
1.8
Since :
2.3.1
Parameters:
[in]objThe gesture-layer
[in]zoom_finger_factorThe zoom finger factor

Gets the step-value for zoom action.

Since :
2.3.1
Parameters:
[in]objThe gesture-layer
Returns:
The zoom step value
See also:
elm_gesture_layer_zoom_step_set()
void elm_gesture_layer_zoom_step_set ( Evas_Object obj,
double  step 
)

Sets the step-value for zoom action.

Since :
2.3.1
Remarks:
Set the step to any positive value.
Cancel step setting by setting it to 0.
Parameters:
[in]objThe gesture-layer
[in]stepThe new zoom step value
See also:
elm_gesture_layer_zoom_step_get()

Gets the gesture layer zoom wheel factor of an object.

Since (EFL) :
1.8
Since :
2.3.1
Parameters:
[in]objThe gesture-layer
Returns:
The zoom wheel factor
void elm_gesture_layer_zoom_wheel_factor_set ( Evas_Object obj,
double  zoom_wheel_factor 
)

Sets the gesture layer zoom wheel factor of an object.

Since (EFL) :
1.8
Since :
2.3.1
Parameters:
[in]objThe gesture-layer
[in]zoom_wheel_factorThe zoom wheel factor