From eedeedaf6e9ec1d6396e452b7d852999d4acf841 Mon Sep 17 00:00:00 2001 From: Vivek Ellur Date: Wed, 23 Sep 2015 15:03:48 -0700 Subject: [PATCH] elm_spinner: ported eo_event_callbacks to use eo_event arrays Summary: Ported eo_event_callback_add to use eo_event_callback_array_add Signed-off-by: Vivek Ellur Reviewers: cedric Differential Revision: https://phab.enlightenment.org/D3092 Signed-off-by: Cedric BAIL --- legacy/elementary/src/lib/elm_spinner.c | 67 +++++++++++++++++-------- 1 file changed, 46 insertions(+), 21 deletions(-) diff --git a/legacy/elementary/src/lib/elm_spinner.c b/legacy/elementary/src/lib/elm_spinner.c index 09cb983003..3c5b31bf87 100644 --- a/legacy/elementary/src/lib/elm_spinner.c +++ b/legacy/elementary/src/lib/elm_spinner.c @@ -41,12 +41,49 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = { static Eina_Bool _key_action_spin(Evas_Object *obj, const char *params); static Eina_Bool _key_action_toggle(Evas_Object *obj, const char *params); +static Eina_Bool +_inc_button_clicked_cb(void *data, Eo *obj EINA_UNUSED, + const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED); +static Eina_Bool +_inc_button_pressed_cb(void *data, Eo *obj EINA_UNUSED, + const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED); +static Eina_Bool +_inc_button_unpressed_cb(void *data, Eo *obj EINA_UNUSED, + const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED); +static Eina_Bool +_inc_dec_button_mouse_move_cb(void *data, Eo *obj EINA_UNUSED, + const Eo_Event_Description *desc EINA_UNUSED, void *event_info); +static Eina_Bool +_dec_button_clicked_cb(void *data, Eo *obj EINA_UNUSED, + const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED); +static Eina_Bool +_dec_button_pressed_cb(void *data, Eo *obj EINA_UNUSED, + const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED); +static Eina_Bool +_dec_button_unpressed_cb(void *data, Eo *obj EINA_UNUSED, + const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED); + static const Elm_Action key_actions[] = { {"spin", _key_action_spin}, {"toggle", _key_action_toggle}, {NULL, NULL} }; +EO_CALLBACKS_ARRAY_DEFINE(_inc_button_cb, + { EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED, _inc_button_clicked_cb}, + { EVAS_CLICKABLE_INTERFACE_EVENT_PRESSED, _inc_button_pressed_cb}, + { EVAS_CLICKABLE_INTERFACE_EVENT_UNPRESSED, _inc_button_unpressed_cb}, + { EVAS_OBJECT_EVENT_MOUSE_MOVE, _inc_dec_button_mouse_move_cb } +); + +EO_CALLBACKS_ARRAY_DEFINE(_dec_button_cb, + { EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED, _dec_button_clicked_cb}, + { EVAS_CLICKABLE_INTERFACE_EVENT_PRESSED, _dec_button_pressed_cb}, + { EVAS_CLICKABLE_INTERFACE_EVENT_UNPRESSED, _dec_button_unpressed_cb}, + { EVAS_OBJECT_EVENT_MOUSE_MOVE, _inc_dec_button_mouse_move_cb } +); + + static void _access_increment_decrement_info_say(Evas_Object *obj, Eina_Bool is_incremented); @@ -747,10 +784,9 @@ _dec_button_unpressed_cb(void *data, return EINA_TRUE; } -static void -_inc_dec_button_mouse_move_cb(void *data, - Evas *evas EINA_UNUSED, - Evas_Object *obj EINA_UNUSED, +static Eina_Bool +_inc_dec_button_mouse_move_cb(void *data, Eo *obj EINA_UNUSED, + const Eo_Event_Description *desc EINA_UNUSED, void *event_info) { Evas_Event_Mouse_Move *ev = event_info; @@ -761,6 +797,8 @@ _inc_dec_button_mouse_move_cb(void *data, ecore_timer_del(sd->longpress_timer); sd->longpress_timer = NULL; } + + return EINA_TRUE; } EOLIAN static void @@ -1039,15 +1077,8 @@ _elm_spinner_evas_object_smart_add(Eo *obj, Elm_Spinner_Data *priv) priv->inc_button = elm_button_add(obj); elm_object_style_set(priv->inc_button, "spinner/increase/default"); - eo_do(priv->inc_button, eo_event_callback_add - (EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED, _inc_button_clicked_cb, obj)); - eo_do(priv->inc_button, eo_event_callback_add - (EVAS_CLICKABLE_INTERFACE_EVENT_PRESSED, _inc_button_pressed_cb, obj)); - eo_do(priv->inc_button, eo_event_callback_add - (EVAS_CLICKABLE_INTERFACE_EVENT_UNPRESSED, _inc_button_unpressed_cb, obj)); - evas_object_event_callback_add - (priv->inc_button, EVAS_CALLBACK_MOUSE_MOVE, _inc_dec_button_mouse_move_cb, obj); - + eo_do(priv->inc_button, + eo_event_callback_array_add(_inc_button_cb(), obj)); elm_layout_content_set(obj, "elm.swallow.inc_button", priv->inc_button); elm_widget_sub_object_add(obj, priv->inc_button); @@ -1064,14 +1095,8 @@ _elm_spinner_evas_object_smart_add(Eo *obj, Elm_Spinner_Data *priv) priv->dec_button = elm_button_add(obj); elm_object_style_set(priv->dec_button, "spinner/decrease/default"); - eo_do(priv->dec_button, eo_event_callback_add - (EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED, _dec_button_clicked_cb, obj)); - eo_do(priv->dec_button, eo_event_callback_add - (EVAS_CLICKABLE_INTERFACE_EVENT_PRESSED, _dec_button_pressed_cb, obj)); - eo_do(priv->dec_button, eo_event_callback_add - (EVAS_CLICKABLE_INTERFACE_EVENT_UNPRESSED, _dec_button_unpressed_cb, obj)); - evas_object_event_callback_add - (priv->dec_button, EVAS_CALLBACK_MOUSE_MOVE, _inc_dec_button_mouse_move_cb, obj); + eo_do(priv->dec_button, + eo_event_callback_array_add(_dec_button_cb(), obj)); elm_layout_content_set(obj, "elm.swallow.dec_button", priv->dec_button); elm_widget_sub_object_add(obj, priv->dec_button);