diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am index ffcff1d007..19180e0292 100644 --- a/src/Makefile_Elementary.am +++ b/src/Makefile_Elementary.am @@ -187,7 +187,6 @@ elm_private_eolian_files = \ elm_legacy_eolian_files = \ lib/elementary/efl_ui_clock_legacy.eo \ lib/elementary/elm_interface_fileselector.eo \ - lib/elementary/elm_gesture_layer.eo \ lib/elementary/elm_glview.eo \ lib/elementary/elm_hover.eo \ lib/elementary/elm_index.eo \ @@ -353,6 +352,8 @@ lib/elementary/elm_genlist_eo.c \ lib/elementary/elm_genlist_item_eo.legacy.c \ lib/elementary/elm_genlist_item_eo.c \ lib/elementary/elm_genlist_pan_eo.c \ +lib/elementary/elm_gesture_layer_eo.legacy.c \ +lib/elementary/elm_gesture_layer_eo.c \ lib/elementary/elm_hoversel_eo.c \ lib/elementary/elm_hoversel_item_eo.c \ lib/elementary/elm_hoversel_item_eo.legacy.c @@ -462,6 +463,8 @@ lib/elementary/elm_genlist_item_eo.h \ lib/elementary/elm_genlist_item_eo.legacy.h \ lib/elementary/elm_genlist_pan_eo.h \ lib/elementary/elm_genlist_pan_eo.legacy.h \ +lib/elementary/elm_gesture_layer_eo.h \ +lib/elementary/elm_gesture_layer_eo.legacy.h \ lib/elementary/elm_hoversel_eo.h \ lib/elementary/elm_hoversel_eo.legacy.h \ lib/elementary/elm_hoversel_item_eo.h \ diff --git a/src/lib/elementary/elm_gesture_layer.c b/src/lib/elementary/elm_gesture_layer.c index b1c3212e27..ba5ea9cc99 100644 --- a/src/lib/elementary/elm_gesture_layer.c +++ b/src/lib/elementary/elm_gesture_layer.c @@ -4,7 +4,7 @@ #include #include "elm_priv.h" -#include "elm_gesture_layer.eo.h" +#include "elm_gesture_layer_eo.h" #define MY_CLASS ELM_GESTURE_LAYER_CLASS @@ -4175,4 +4175,4 @@ _elm_gesture_layer_class_constructor(Efl_Class *klass) #define ELM_GESTURE_LAYER_EXTRA_OPS \ EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_gesture_layer) -#include "elm_gesture_layer.eo.c" +#include "elm_gesture_layer_eo.c" diff --git a/src/lib/elementary/elm_gesture_layer.eo b/src/lib/elementary/elm_gesture_layer.eo deleted file mode 100644 index 6fce6d4678..0000000000 --- a/src/lib/elementary/elm_gesture_layer.eo +++ /dev/null @@ -1,167 +0,0 @@ -type Elm_Gesture_Event_Cb: __undefined_type; [[Elementary gesture event callback type]] - -enum Elm.Gesture.Type -{ - [[ - Enum of supported gesture types. - ]] - legacy: elm_gesture; - first = 0, [[First type used for iteration over the enum]] - n_taps, [[N fingers single taps]] - n_long_taps, [[N fingers single long-taps]] - n_double_taps, [[N fingers double-single taps]] - n_triple_taps, [[N fingers triple-single taps]] - momentum, [[Reports momentum in the direction of move]] - n_lines, [[N fingers line gesture]] - n_flicks, [[N fingers flick gesture]] - zoom, [[Zoom]] - rotate, [[Rotate]] - last [[Sentinel value to indicate last enum field during iteration]] -} - -enum Elm.Gesture.State -{ - [[ - Enum of gesture states. - ]] - undefined = -1, [[Gesture not started]] - start, [[Gesture started]] - move, [[Gesture is ongoing]] - end, [[Gesture completed]] - abort [[Ongoing gesture was aborted]] -} - -class Elm.Gesture_Layer extends Efl.Ui.Widget implements Efl.Ui.Legacy -{ - [[Elementary gesture layer class]] - legacy_prefix: elm_gesture_layer; - eo_prefix: elm_obj_gesture_layer; - methods { - @property zoom_step { - [[Control step value for zoom action.]] - set { - [[When recognizing the zoom gesture, it should be recognized as zooming larger - than step. - ]] - } - get { - } - values { - step: double; [[The zoom step value.]] - } - } - @property tap_finger_size { - set { - [[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). - - @since 1.8 - ]] - } - get { - [[This function returns the gesture layer finger-size for taps - - @since 1.8 - ]] - } - values { - sz: int; [[The finger size.]] - } - } - @property hold_events { - set { - [[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. - ]] - } - get { - [[Get the repeat-events setting.]] - } - values { - hold_events: bool; [[If $true get events only if gesture was not detected, $false otherwise]] - } - } - @property rotate_step { - [[This function returns step-value for rotate action.]] - set { - [[Set to 0 to cancel step setting. - - When recognizing the rotate gesture, the rotated size must be larger - than step. - ]] - } - get { - } - values { - step: double; [[New rotate step value.]] - } - } - @property cb { - set { - [[Set the gesture state change callback. - - When all callbacks for the gesture are set to $null, - it means this gesture is disabled. - ]] - } - values { - idx: Elm.Gesture.Type; [[The gesture you want to track state of.]] - cb_type: Elm.Gesture.State; [[The event the callback tracks (START, MOVE, END, ABORT).]] - cb: Elm_Gesture_Event_Cb; [[The callback itself.]] - data: void_ptr @optional; [[Custom data to be passed.]] - } - } - attach { - [[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. - ]] - return: bool; [[$true on success, $false otherwise.]] - params { - @in target: Efl.Canvas.Object; [[The object to attach.]] - } - } - cb_del { - [[Remove a gesture callback.]] - params { - @in idx: Elm.Gesture.Type; [[The gesture you want to track state of.]] - @in cb_type: Elm.Gesture.State; [[The event the callback tracks (START, MOVE, END, ABORT).]] - @in cb: Elm_Gesture_Event_Cb; [[The callback itself.]] - @in data: void_ptr @nullable; [[Custom callback data.]] - } - } - cb_add { - [[Add a gesture state change callback. - - When all callbacks for the gesture are set to $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 @.cb_add will be removed. It is recommended to - use only one of these functions for a gesture object. - ]] - params { - @in idx: Elm.Gesture.Type; [[The gesture you want to track state of.]] - @in cb_type: Elm.Gesture.State; [[The event the callback tracks (START, MOVE, END, ABORT).]] - @in cb: Elm_Gesture_Event_Cb; [[The callback itself.]] - @in data: void_ptr @optional; [[Custom data to be passed.]] - } - } - } - implements { - class.constructor; - Efl.Object.constructor; - Efl.Ui.Widget.disabled {set;} - } -} diff --git a/src/lib/elementary/elm_gesture_layer_eo.c b/src/lib/elementary/elm_gesture_layer_eo.c new file mode 100644 index 0000000000..9cdae6c1fe --- /dev/null +++ b/src/lib/elementary/elm_gesture_layer_eo.c @@ -0,0 +1,208 @@ + +void _elm_gesture_layer_zoom_step_set(Eo *obj, Elm_Gesture_Layer_Data *pd, double step); + + +static Eina_Error +__eolian_elm_gesture_layer_zoom_step_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; double cval; + if (!eina_value_double_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_gesture_layer_zoom_step_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_gesture_layer_zoom_step_set, EFL_FUNC_CALL(step), double step); + +double _elm_gesture_layer_zoom_step_get(const Eo *obj, Elm_Gesture_Layer_Data *pd); + + +static Eina_Value +__eolian_elm_gesture_layer_zoom_step_get_reflect(Eo *obj) +{ + double val = elm_obj_gesture_layer_zoom_step_get(obj); + return eina_value_double_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_gesture_layer_zoom_step_get, double, 0); + +void _elm_gesture_layer_tap_finger_size_set(Eo *obj, Elm_Gesture_Layer_Data *pd, int sz); + + +static Eina_Error +__eolian_elm_gesture_layer_tap_finger_size_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; int cval; + if (!eina_value_int_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_gesture_layer_tap_finger_size_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_gesture_layer_tap_finger_size_set, EFL_FUNC_CALL(sz), int sz); + +int _elm_gesture_layer_tap_finger_size_get(const Eo *obj, Elm_Gesture_Layer_Data *pd); + + +static Eina_Value +__eolian_elm_gesture_layer_tap_finger_size_get_reflect(Eo *obj) +{ + int val = elm_obj_gesture_layer_tap_finger_size_get(obj); + return eina_value_int_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_gesture_layer_tap_finger_size_get, int, 0); + +void _elm_gesture_layer_hold_events_set(Eo *obj, Elm_Gesture_Layer_Data *pd, Eina_Bool hold_events); + + +static Eina_Error +__eolian_elm_gesture_layer_hold_events_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; Eina_Bool cval; + if (!eina_value_bool_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_gesture_layer_hold_events_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_gesture_layer_hold_events_set, EFL_FUNC_CALL(hold_events), Eina_Bool hold_events); + +Eina_Bool _elm_gesture_layer_hold_events_get(const Eo *obj, Elm_Gesture_Layer_Data *pd); + + +static Eina_Value +__eolian_elm_gesture_layer_hold_events_get_reflect(Eo *obj) +{ + Eina_Bool val = elm_obj_gesture_layer_hold_events_get(obj); + return eina_value_bool_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_gesture_layer_hold_events_get, Eina_Bool, 0); + +void _elm_gesture_layer_rotate_step_set(Eo *obj, Elm_Gesture_Layer_Data *pd, double step); + + +static Eina_Error +__eolian_elm_gesture_layer_rotate_step_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; double cval; + if (!eina_value_double_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_gesture_layer_rotate_step_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_gesture_layer_rotate_step_set, EFL_FUNC_CALL(step), double step); + +double _elm_gesture_layer_rotate_step_get(const Eo *obj, Elm_Gesture_Layer_Data *pd); + + +static Eina_Value +__eolian_elm_gesture_layer_rotate_step_get_reflect(Eo *obj) +{ + double val = elm_obj_gesture_layer_rotate_step_get(obj); + return eina_value_double_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_gesture_layer_rotate_step_get, double, 0); + +void _elm_gesture_layer_cb_set(Eo *obj, Elm_Gesture_Layer_Data *pd, Elm_Gesture_Type idx, Elm_Gesture_State cb_type, Elm_Gesture_Event_Cb cb, void *data); + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_gesture_layer_cb_set, EFL_FUNC_CALL(idx, cb_type, cb, data), Elm_Gesture_Type idx, Elm_Gesture_State cb_type, Elm_Gesture_Event_Cb cb, void *data); + +Eina_Bool _elm_gesture_layer_attach(Eo *obj, Elm_Gesture_Layer_Data *pd, Efl_Canvas_Object *target); + +EOAPI EFL_FUNC_BODYV(elm_obj_gesture_layer_attach, Eina_Bool, 0, EFL_FUNC_CALL(target), Efl_Canvas_Object *target); + +void _elm_gesture_layer_cb_del(Eo *obj, Elm_Gesture_Layer_Data *pd, Elm_Gesture_Type idx, Elm_Gesture_State cb_type, Elm_Gesture_Event_Cb cb, void *data); + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_gesture_layer_cb_del, EFL_FUNC_CALL(idx, cb_type, cb, data), Elm_Gesture_Type idx, Elm_Gesture_State cb_type, Elm_Gesture_Event_Cb cb, void *data); + +void _elm_gesture_layer_cb_add(Eo *obj, Elm_Gesture_Layer_Data *pd, Elm_Gesture_Type idx, Elm_Gesture_State cb_type, Elm_Gesture_Event_Cb cb, void *data); + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_gesture_layer_cb_add, EFL_FUNC_CALL(idx, cb_type, cb, data), Elm_Gesture_Type idx, Elm_Gesture_State cb_type, Elm_Gesture_Event_Cb cb, void *data); + +Efl_Object *_elm_gesture_layer_efl_object_constructor(Eo *obj, Elm_Gesture_Layer_Data *pd); + + +void _elm_gesture_layer_efl_ui_widget_disabled_set(Eo *obj, Elm_Gesture_Layer_Data *pd, Eina_Bool disabled); + + +static Eina_Bool +_elm_gesture_layer_class_initializer(Efl_Class *klass) +{ + const Efl_Object_Ops *opsp = NULL; + + const Efl_Object_Property_Reflection_Ops *ropsp = NULL; + +#ifndef ELM_GESTURE_LAYER_EXTRA_OPS +#define ELM_GESTURE_LAYER_EXTRA_OPS +#endif + + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC(elm_obj_gesture_layer_zoom_step_set, _elm_gesture_layer_zoom_step_set), + EFL_OBJECT_OP_FUNC(elm_obj_gesture_layer_zoom_step_get, _elm_gesture_layer_zoom_step_get), + EFL_OBJECT_OP_FUNC(elm_obj_gesture_layer_tap_finger_size_set, _elm_gesture_layer_tap_finger_size_set), + EFL_OBJECT_OP_FUNC(elm_obj_gesture_layer_tap_finger_size_get, _elm_gesture_layer_tap_finger_size_get), + EFL_OBJECT_OP_FUNC(elm_obj_gesture_layer_hold_events_set, _elm_gesture_layer_hold_events_set), + EFL_OBJECT_OP_FUNC(elm_obj_gesture_layer_hold_events_get, _elm_gesture_layer_hold_events_get), + EFL_OBJECT_OP_FUNC(elm_obj_gesture_layer_rotate_step_set, _elm_gesture_layer_rotate_step_set), + EFL_OBJECT_OP_FUNC(elm_obj_gesture_layer_rotate_step_get, _elm_gesture_layer_rotate_step_get), + EFL_OBJECT_OP_FUNC(elm_obj_gesture_layer_cb_set, _elm_gesture_layer_cb_set), + EFL_OBJECT_OP_FUNC(elm_obj_gesture_layer_attach, _elm_gesture_layer_attach), + EFL_OBJECT_OP_FUNC(elm_obj_gesture_layer_cb_del, _elm_gesture_layer_cb_del), + EFL_OBJECT_OP_FUNC(elm_obj_gesture_layer_cb_add, _elm_gesture_layer_cb_add), + EFL_OBJECT_OP_FUNC(efl_constructor, _elm_gesture_layer_efl_object_constructor), + EFL_OBJECT_OP_FUNC(efl_ui_widget_disabled_set, _elm_gesture_layer_efl_ui_widget_disabled_set), + ELM_GESTURE_LAYER_EXTRA_OPS + ); + opsp = &ops; + + static const Efl_Object_Property_Reflection refl_table[] = { + {"zoom_step", __eolian_elm_gesture_layer_zoom_step_set_reflect, __eolian_elm_gesture_layer_zoom_step_get_reflect}, + {"tap_finger_size", __eolian_elm_gesture_layer_tap_finger_size_set_reflect, __eolian_elm_gesture_layer_tap_finger_size_get_reflect}, + {"hold_events", __eolian_elm_gesture_layer_hold_events_set_reflect, __eolian_elm_gesture_layer_hold_events_get_reflect}, + {"rotate_step", __eolian_elm_gesture_layer_rotate_step_set_reflect, __eolian_elm_gesture_layer_rotate_step_get_reflect}, + }; + static const Efl_Object_Property_Reflection_Ops rops = { + refl_table, EINA_C_ARRAY_LENGTH(refl_table) + }; + ropsp = &rops; + + return efl_class_functions_set(klass, opsp, ropsp); +} + +static const Efl_Class_Description _elm_gesture_layer_class_desc = { + EO_VERSION, + "Elm.Gesture_Layer", + EFL_CLASS_TYPE_REGULAR, + sizeof(Elm_Gesture_Layer_Data), + _elm_gesture_layer_class_initializer, + _elm_gesture_layer_class_constructor, + NULL +}; + +EFL_DEFINE_CLASS(elm_gesture_layer_class_get, &_elm_gesture_layer_class_desc, EFL_UI_WIDGET_CLASS, EFL_UI_LEGACY_INTERFACE, NULL); + +#include "elm_gesture_layer_eo.legacy.c" diff --git a/src/lib/elementary/elm_gesture_layer_eo.h b/src/lib/elementary/elm_gesture_layer_eo.h new file mode 100644 index 0000000000..2f15a10660 --- /dev/null +++ b/src/lib/elementary/elm_gesture_layer_eo.h @@ -0,0 +1,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 diff --git a/src/lib/elementary/elm_gesture_layer_eo.legacy.c b/src/lib/elementary/elm_gesture_layer_eo.legacy.c new file mode 100644 index 0000000000..ab6c4c95bd --- /dev/null +++ b/src/lib/elementary/elm_gesture_layer_eo.legacy.c @@ -0,0 +1,72 @@ + +EAPI void +elm_gesture_layer_zoom_step_set(Elm_Gesture_Layer *obj, double step) +{ + elm_obj_gesture_layer_zoom_step_set(obj, step); +} + +EAPI double +elm_gesture_layer_zoom_step_get(const Elm_Gesture_Layer *obj) +{ + return elm_obj_gesture_layer_zoom_step_get(obj); +} + +EAPI void +elm_gesture_layer_tap_finger_size_set(Elm_Gesture_Layer *obj, int sz) +{ + elm_obj_gesture_layer_tap_finger_size_set(obj, sz); +} + +EAPI int +elm_gesture_layer_tap_finger_size_get(const Elm_Gesture_Layer *obj) +{ + return elm_obj_gesture_layer_tap_finger_size_get(obj); +} + +EAPI void +elm_gesture_layer_hold_events_set(Elm_Gesture_Layer *obj, Eina_Bool hold_events) +{ + elm_obj_gesture_layer_hold_events_set(obj, hold_events); +} + +EAPI Eina_Bool +elm_gesture_layer_hold_events_get(const Elm_Gesture_Layer *obj) +{ + return elm_obj_gesture_layer_hold_events_get(obj); +} + +EAPI void +elm_gesture_layer_rotate_step_set(Elm_Gesture_Layer *obj, double step) +{ + elm_obj_gesture_layer_rotate_step_set(obj, step); +} + +EAPI double +elm_gesture_layer_rotate_step_get(const Elm_Gesture_Layer *obj) +{ + return elm_obj_gesture_layer_rotate_step_get(obj); +} + +EAPI void +elm_gesture_layer_cb_set(Elm_Gesture_Layer *obj, Elm_Gesture_Type idx, Elm_Gesture_State cb_type, Elm_Gesture_Event_Cb cb, void *data) +{ + elm_obj_gesture_layer_cb_set(obj, idx, cb_type, cb, data); +} + +EAPI Eina_Bool +elm_gesture_layer_attach(Elm_Gesture_Layer *obj, Efl_Canvas_Object *target) +{ + return elm_obj_gesture_layer_attach(obj, target); +} + +EAPI void +elm_gesture_layer_cb_del(Elm_Gesture_Layer *obj, Elm_Gesture_Type idx, Elm_Gesture_State cb_type, Elm_Gesture_Event_Cb cb, void *data) +{ + elm_obj_gesture_layer_cb_del(obj, idx, cb_type, cb, data); +} + +EAPI void +elm_gesture_layer_cb_add(Elm_Gesture_Layer *obj, Elm_Gesture_Type idx, Elm_Gesture_State cb_type, Elm_Gesture_Event_Cb cb, void *data) +{ + elm_obj_gesture_layer_cb_add(obj, idx, cb_type, cb, data); +} diff --git a/src/lib/elementary/elm_gesture_layer_eo.legacy.h b/src/lib/elementary/elm_gesture_layer_eo.legacy.h new file mode 100644 index 0000000000..268eab1aec --- /dev/null +++ b/src/lib/elementary/elm_gesture_layer_eo.legacy.h @@ -0,0 +1,222 @@ +#ifndef _ELM_GESTURE_LAYER_EO_LEGACY_H_ +#define _ELM_GESTURE_LAYER_EO_LEGACY_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 + +/** + * @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_Group + */ +EAPI void elm_gesture_layer_zoom_step_set(Elm_Gesture_Layer *obj, double step); + +/** + * @brief Control step value for zoom action. + * + * @param[in] obj The object. + * + * @return The zoom step value. + * + * @ingroup Elm_Gesture_Layer_Group + */ +EAPI double elm_gesture_layer_zoom_step_get(const Elm_Gesture_Layer *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_Group + */ +EAPI void elm_gesture_layer_tap_finger_size_set(Elm_Gesture_Layer *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_Group + */ +EAPI int elm_gesture_layer_tap_finger_size_get(const Elm_Gesture_Layer *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_Group + */ +EAPI void elm_gesture_layer_hold_events_set(Elm_Gesture_Layer *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_Group + */ +EAPI Eina_Bool elm_gesture_layer_hold_events_get(const Elm_Gesture_Layer *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_Group + */ +EAPI void elm_gesture_layer_rotate_step_set(Elm_Gesture_Layer *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_Group + */ +EAPI double elm_gesture_layer_rotate_step_get(const Elm_Gesture_Layer *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_Group + */ +EAPI void elm_gesture_layer_cb_set(Elm_Gesture_Layer *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_Group + */ +EAPI Eina_Bool elm_gesture_layer_attach(Elm_Gesture_Layer *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_Group + */ +EAPI void elm_gesture_layer_cb_del(Elm_Gesture_Layer *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_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_Group + */ +EAPI void elm_gesture_layer_cb_add(Elm_Gesture_Layer *obj, Elm_Gesture_Type idx, Elm_Gesture_State cb_type, Elm_Gesture_Event_Cb cb, void *data); + +#endif diff --git a/src/lib/elementary/elm_gesture_layer_legacy.h b/src/lib/elementary/elm_gesture_layer_legacy.h index f6f76e9dfe..7c67737e93 100644 --- a/src/lib/elementary/elm_gesture_layer_legacy.h +++ b/src/lib/elementary/elm_gesture_layer_legacy.h @@ -1,4 +1,4 @@ -#include "elm_gesture_layer.eo.legacy.h" +#include "elm_gesture_layer_eo.legacy.h" /** * Call this function to construct a new gesture-layer object. diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build index f95140d832..c7e5ba4225 100644 --- a/src/lib/elementary/meson.build +++ b/src/lib/elementary/meson.build @@ -1,7 +1,6 @@ pub_legacy_eo_files = [ 'efl_ui_clock_legacy.eo', 'elm_interface_fileselector.eo', - 'elm_gesture_layer.eo', 'elm_glview.eo', 'elm_hover.eo', 'elm_index.eo', @@ -752,6 +751,8 @@ elementary_pub_headers = [ 'elm_genlist_item_eo.legacy.h', 'elm_genlist_pan_eo.h', 'elm_genlist_pan_eo.legacy.h', + 'elm_gesture_layer_eo.h', + 'elm_gesture_layer_eo.legacy.h', 'elm_hoversel_eo.h', 'elm_hoversel_eo.legacy.h', 'elm_hoversel_item_eo.h',