From b7c50faa80c2c022d7cf9c1f7bba935116dea940 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Thu, 5 Mar 2015 15:14:34 +0900 Subject: [PATCH] elm spinner - add backwards compat for older spinner themes this makes spinenr work with previous themes after adfe7fbcd3f4146d84219de7dbb5a273d89f396e commit Change-Id: I657ad31ab3005431468503fdac8cb13033ea4d6e Origin: upstream --- data/themes/edc/elm/spinner.edc | 31 +-- src/lib/elm_spinner.c | 464 ++++++++++++++++++++++++++++++++++------ src/lib/elm_spinner.eo | 2 + src/lib/elm_widget_spinner.h | 1 + 4 files changed, 414 insertions(+), 84 deletions(-) diff --git a/data/themes/edc/elm/spinner.edc b/data/themes/edc/elm/spinner.edc index ca87047..b34eada 100644 --- a/data/themes/edc/elm/spinner.edc +++ b/data/themes/edc/elm/spinner.edc @@ -32,14 +32,17 @@ group { name: "elm/spinner/base/default"; visible: 1; } } - part { name: "elm.dragable.slider"; type: RECT; - dragable.x: 1 1 0; - dragable.y: 0 0 0; + part { name: "elm.swallow.entry"; + type: SWALLOW; description { state: "default" 0.0; fixed: 1 0; - rel1.to: "inset"; - rel2.to: "inset"; - color: 0 0 0 0; + rel1.to: "elm.swallow.text_button"; + rel2.to: "elm.swallow.text_button"; + visible: 0; + } + description { state: "active" 0.0; + inherit: "default" 0.0; + visible: 1; } } part { name: "elm.swallow.dec_button"; @@ -89,17 +92,15 @@ group { name: "elm/spinner/base/default"; visible: 0; } } - part { name: "elm.swallow.entry"; - type: SWALLOW; + part { name: "elm.dragable.slider"; type: RECT; + repeat_events: 1; + dragable.x: 1 1 0; + dragable.y: 0 0 0; description { state: "default" 0.0; fixed: 1 0; - rel1.to: "elm.swallow.text_button"; - rel2.to: "elm.swallow.text_button"; - visible: 0; - } - description { state: "active" 0.0; - inherit: "default" 0.0; - visible: 1; + rel1.to: "inset"; + rel2.to: "inset"; + color: 0 0 0 0; } } part { name: "disabler"; diff --git a/src/lib/elm_spinner.c b/src/lib/elm_spinner.c index 9be88bf..aa96a1e 100644 --- a/src/lib/elm_spinner.c +++ b/src/lib/elm_spinner.c @@ -38,6 +38,15 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = { {NULL, NULL} }; +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 const Elm_Action key_actions[] = { + {"spin", _key_action_spin}, + {"toggle", _key_action_toggle}, + {NULL, NULL} +}; + static void _access_increment_decrement_info_say(Evas_Object *obj, Eina_Bool is_incremented); @@ -109,7 +118,10 @@ _label_write(Evas_Object *obj) snprintf(buf, sizeof(buf), "%.0f", sd->val); apply: - elm_layout_text_set(sd->text_button, "elm.text", buf); + if (sd->button_layout) + elm_layout_text_set(sd->text_button, "elm.text", buf); + else + elm_layout_text_set(obj, "elm.text", buf); elm_interface_atspi_accessible_name_changed_signal_emit(obj); if (sd->entry_visible) _entry_show(sd); } @@ -193,12 +205,18 @@ _drag_cb(void *data, if (sd->entry_visible) return; - if (!strncmp(elm_widget_style_get(obj), "vertical", 8)) - eo_do((Eo *)wd->resize_obj, - edje_obj_part_drag_value_get("elm.dragable.slider", NULL, &pos)); + if (sd->button_layout) + { + if (!strncmp(elm_widget_style_get(obj), "vertical", 8)) + eo_do((Eo *)wd->resize_obj, + edje_obj_part_drag_value_get("elm.dragable.slider", NULL, &pos)); + else + eo_do((Eo *)wd->resize_obj, + edje_obj_part_drag_value_get("elm.dragable.slider", &pos, NULL)); + } else eo_do((Eo *)wd->resize_obj, - edje_obj_part_drag_value_get("elm.dragable.slider", &pos, NULL)); + edje_obj_part_drag_value_get("elm.dragable.slider", &pos, NULL)); delta = pos * sd->step * _elm_config->scale; /* If we are on rtl mode, change the delta to be negative on such changes */ @@ -241,8 +259,13 @@ _entry_hide(Evas_Object *obj) { ELM_SPINNER_DATA_GET(obj, sd); - elm_layout_signal_emit(obj, "elm,state,entry,inactive", "elm"); - elm_layout_signal_emit(obj, "elm,state,button,active", "elm"); + if (sd->button_layout) + { + elm_layout_signal_emit(obj, "elm,state,entry,inactive", "elm"); + elm_layout_signal_emit(obj, "elm,state,button,active", "elm"); + } + else + elm_layout_signal_emit(obj, "elm,state,inactive", "elm"); sd->entry_visible = EINA_FALSE; } @@ -311,18 +334,29 @@ _toggle_entry(Evas_Object *obj) if (!sd->ent) { sd->ent = elm_entry_add(obj); - Eina_Strbuf *buf = eina_strbuf_new(); - eina_strbuf_append_printf(buf, "spinner/%s", elm_widget_style_get(obj)); - elm_widget_style_set(sd->ent, eina_strbuf_string_get(buf)); - eina_strbuf_free(buf); + if (sd->button_layout) + { + Eina_Strbuf *buf = eina_strbuf_new(); + eina_strbuf_append_printf(buf, "spinner/%s", elm_widget_style_get(obj)); + elm_widget_style_set(sd->ent, eina_strbuf_string_get(buf)); + eina_strbuf_free(buf); + evas_object_event_callback_add + (sd->ent, EVAS_CALLBACK_SHOW, _entry_show_cb, obj); + } elm_entry_single_line_set(sd->ent, EINA_TRUE); evas_object_smart_callback_add (sd->ent, "activated", _entry_activated_cb, obj); - evas_object_event_callback_add - (sd->ent, EVAS_CALLBACK_SHOW, _entry_show_cb, obj); elm_layout_content_set(obj, "elm.swallow.entry", sd->ent); } + if (!sd->button_layout) + { + elm_layout_signal_emit(obj, "elm,state,active", "elm"); + _entry_show(sd); + elm_entry_select_all(sd->ent); + elm_widget_focus_set(sd->ent, EINA_TRUE); + sd->entry_visible = EINA_TRUE; + } elm_layout_signal_emit(obj, "elm,state,entry,active", "elm"); } } @@ -397,6 +431,154 @@ _spin_stop(Evas_Object *obj) ELM_SAFE_FREE(sd->spin_timer, ecore_timer_del); } +static Eina_Bool +_key_action_spin(Evas_Object *obj, const char *params) +{ + const char *dir = params; + Eina_Bool horz = !!strncmp(elm_widget_style_get(obj), "vertical", 8); + if (((!strcmp(dir, "left")) && horz) || + ((!strcmp(dir, "down")) && !horz)) + { + _val_dec_start(obj); + elm_layout_signal_emit(obj, "elm,left,anim,activate", "elm"); + } + else if (((!strcmp(dir, "right")) && horz) || + ((!strcmp(dir, "up")) && !horz)) + { + _val_inc_start(obj); + elm_layout_signal_emit(obj, "elm,right,anim,activate", "elm"); + } + else return EINA_FALSE; + return EINA_TRUE; +} + +static Eina_Bool +_key_action_toggle(Evas_Object *obj, const char *params EINA_UNUSED) +{ + ELM_SPINNER_DATA_GET(obj, sd); + if (sd->spin_timer) _spin_stop(obj); + else _entry_toggle_cb(NULL, obj, NULL, NULL); + return EINA_FALSE; +} + +EOLIAN static Eina_Bool +_elm_spinner_elm_widget_event(Eo *obj, Elm_Spinner_Data *sd EINA_UNUSED, Evas_Object *src EINA_UNUSED, Evas_Callback_Type type, void *event_info) +{ + Evas_Event_Key_Down *ev = event_info; + Evas_Event_Mouse_Wheel *mev; + + if (type == EVAS_CALLBACK_KEY_DOWN) + { + Eina_Bool ret; + + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; + ret = _elm_config_key_binding_call(obj, ev, key_actions); + if (!ret) + { + if (sd->spin_timer) _spin_stop(obj); + else return EINA_FALSE; + } + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + } + else if (type == EVAS_CALLBACK_KEY_UP) + { + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; + if (sd->spin_timer) _spin_stop(obj); + else return EINA_FALSE; + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + } + else if (type == EVAS_CALLBACK_MOUSE_WHEEL) + { + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; + mev = event_info; + sd->interval = sd->first_interval; + if (mev->z < 0) + { + sd->spin_speed = sd->step; + elm_layout_signal_emit(obj, "elm,right,anim,activate", "elm"); + } + else + { + sd->spin_speed = -sd->step; + elm_layout_signal_emit(obj, "elm,left,anim,activate", "elm"); + } + _spin_value(obj); + mev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + } + else return EINA_FALSE; + return EINA_TRUE; +} + +static void +_button_inc_start_cb(void *data, + Evas_Object *obj, + const char *emission EINA_UNUSED, + const char *source EINA_UNUSED) +{ + ELM_SPINNER_DATA_GET(data, sd); + + if (sd->entry_visible) + { + _entry_value_apply(obj); + if ((sd->val_updated) && (sd->val == sd->val_min)) return; + } + ecore_timer_del(sd->longpress_timer); + sd->longpress_timer = ecore_timer_add + (_elm_config->longpress_timeout, _val_inc_start, data); +} + +static void +_button_inc_stop_cb(void *data, + Evas_Object *obj EINA_UNUSED, + const char *emission EINA_UNUSED, + const char *source EINA_UNUSED) +{ + ELM_SPINNER_DATA_GET(data, sd); + + if (sd->longpress_timer) + { + ELM_SAFE_FREE(sd->longpress_timer, ecore_timer_del); + sd->spin_speed = sd->step; + _spin_value(data); + } + _spin_stop(data); +} + +static void +_button_dec_start_cb(void *data, + Evas_Object *obj EINA_UNUSED, + const char *emission EINA_UNUSED, + const char *source EINA_UNUSED) +{ + ELM_SPINNER_DATA_GET(data, sd); + + if (sd->entry_visible) + { + _entry_value_apply(obj); + if ((sd->val_updated) && (sd->val == sd->val_max)) return; + } + ecore_timer_del(sd->longpress_timer); + sd->longpress_timer = ecore_timer_add + (_elm_config->longpress_timeout, _val_dec_start, data); +} + +static void +_button_dec_stop_cb(void *data, + Evas_Object *obj EINA_UNUSED, + const char *emission EINA_UNUSED, + const char *source EINA_UNUSED) +{ + ELM_SPINNER_DATA_GET(data, sd); + + if (sd->longpress_timer) + { + ELM_SAFE_FREE(sd->longpress_timer, ecore_timer_del); + sd->spin_speed = -sd->step; + _spin_value(data); + } + _spin_stop(data); +} + static void _inc_button_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED, @@ -530,19 +712,68 @@ _elm_spinner_elm_widget_on_focus(Eo *obj, Elm_Spinner_Data *sd) return EINA_TRUE; } +static void +_access_activate_cb(void *data, + Evas_Object *part_obj, + Elm_Object_Item *item EINA_UNUSED) +{ + char *text; + Eina_Strbuf *buf; + Evas_Object *eo, *inc_btn; + const char* increment_part; + + if (!strncmp(elm_widget_style_get(data), "vertical", 8)) + increment_part = "up_bt"; + else + increment_part = "right_bt"; + + eo = elm_layout_edje_get(data); + inc_btn = (Evas_Object *)edje_object_part_object_get(eo, increment_part); + + if (part_obj != inc_btn) + { + _val_dec_start(data); + elm_layout_signal_emit(data, "elm,left,anim,activate", "elm"); + _spin_stop(data); + text = "decremented"; + } + else + { + _val_inc_start(data); + elm_layout_signal_emit(data, "elm,right,anim,activate", "elm"); + _spin_stop(data); + text = "incremented"; + } + + buf = eina_strbuf_new(); + + eina_strbuf_append_printf(buf, "%s, %s", text, + elm_layout_text_get(data, "elm.text")); + + text = eina_strbuf_string_steal(buf); + eina_strbuf_free(buf); + + _elm_access_say(text); +} + static char * _access_info_cb(void *data, Evas_Object *obj EINA_UNUSED) { - Evas_Object *spinner; const char *txt = NULL; - - spinner = (Evas_Object *)(data); + Evas_Object *spinner = (Evas_Object *)(data); ELM_SPINNER_DATA_GET(spinner, sd); - if (sd->entry_visible) - txt = elm_object_text_get(sd->ent); + if (sd->button_layout) + { + if (sd->entry_visible) + txt = elm_object_text_get(sd->ent); + else + txt = elm_object_text_get(sd->text_button); + } else - txt = elm_object_text_get(sd->text_button); + { + txt = elm_layout_text_get(spinner, "elm.text"); + } if (txt) return strdup(txt); return NULL; @@ -608,37 +839,91 @@ _access_spinner_register(Evas_Object *obj, Eina_Bool is_access) ELM_SPINNER_DATA_GET(obj, sd); - if (!is_access) + if (sd->button_layout) { - /* unregister access */ - _elm_access_edje_object_part_object_unregister - (obj, elm_layout_edje_get(obj), "access"); - elm_layout_signal_emit(obj, "elm,state,access,inactive", "elm"); - return; - } - elm_layout_signal_emit(obj, "elm,state,access,active", "elm"); - ao = _elm_access_edje_object_part_object_register + if (!is_access) + { + /* unregister access */ + _elm_access_edje_object_part_object_unregister + (obj, elm_layout_edje_get(obj), "access"); + elm_layout_signal_emit(obj, "elm,state,access,inactive", "elm"); + return; + } + elm_layout_signal_emit(obj, "elm,state,access,active", "elm"); + ao = _elm_access_edje_object_part_object_register (obj, elm_layout_edje_get(obj), "access"); - ai = _elm_access_info_get(ao); - _elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("spinner")); - _elm_access_callback_set(ai, ELM_ACCESS_STATE, _access_state_cb, obj); - _elm_access_activate_callback_set(ai, _access_activate_spinner_cb, obj); + ai = _elm_access_info_get(ao); + _elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("spinner")); + _elm_access_callback_set(ai, ELM_ACCESS_STATE, _access_state_cb, obj); + _elm_access_activate_callback_set(ai, _access_activate_spinner_cb, obj); - /*Do not register spinner buttons if widget is disabled*/ - if (!elm_widget_disabled_get(obj)) + /*Do not register spinner buttons if widget is disabled*/ + if (!elm_widget_disabled_get(obj)) + { + ai = _elm_access_info_get(sd->inc_button); + _elm_access_text_set(ai, ELM_ACCESS_TYPE, + E_("spinner increment button")); + ai = _elm_access_info_get(sd->dec_button); + _elm_access_text_set(ai, ELM_ACCESS_TYPE, + E_("spinner decrement button")); + ai = _elm_access_info_get(sd->text_button); + _elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("spinner text")); + _elm_access_callback_set(ai, ELM_ACCESS_INFO, _access_info_cb, obj); + } + } + else { - ai = _elm_access_info_get(sd->inc_button); + const char* increment_part; + const char* decrement_part; + + if (!strncmp(elm_widget_style_get(obj), "vertical", 8)) + { + increment_part = "up_bt"; + decrement_part = "down_bt"; + } + else + { + increment_part = "right_bt"; + decrement_part = "left_bt"; + } + if (!is_access) + { + /* unregister increment button, decrement button and spinner label */ + _elm_access_edje_object_part_object_unregister + (obj, elm_layout_edje_get(obj), increment_part); + _elm_access_edje_object_part_object_unregister + (obj, elm_layout_edje_get(obj), decrement_part); + _elm_access_edje_object_part_object_unregister + (obj, elm_layout_edje_get(obj), "access.text"); + return; + } + + /* register increment button */ + ao = _elm_access_edje_object_part_object_register + (obj, elm_layout_edje_get(obj), increment_part); + ai = _elm_access_info_get(ao); _elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("spinner increment button")); + _elm_access_activate_callback_set(ai, _access_activate_cb, obj); - ai = _elm_access_info_get(sd->dec_button); + /* register decrement button */ + ao = _elm_access_edje_object_part_object_register + (obj, elm_layout_edje_get(obj), decrement_part); + + ai = _elm_access_info_get(ao); _elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("spinner decrement button")); + _elm_access_activate_callback_set(ai, _access_activate_cb, obj); + + /* register spinner label */ + ao = _elm_access_edje_object_part_object_register + (obj, elm_layout_edje_get(obj), "access.text"); - ai = _elm_access_info_get(sd->text_button); - _elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("spinner text")); + ai = _elm_access_info_get(ao); + _elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("spinner")); _elm_access_callback_set(ai, ELM_ACCESS_INFO, _access_info_cb, obj); + _elm_access_callback_set(ai, ELM_ACCESS_STATE, _access_state_cb, obj); } } @@ -646,6 +931,7 @@ EOLIAN static void _elm_spinner_evas_object_smart_add(Eo *obj, Elm_Spinner_Data *priv) { ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); + ELM_SPINNER_DATA_GET(obj, sd); eo_do_super(obj, MY_CLASS, evas_obj_smart_add()); elm_widget_sub_object_parent_add(obj); @@ -658,48 +944,65 @@ _elm_spinner_evas_object_smart_add(Eo *obj, Elm_Spinner_Data *priv) elm_widget_style_get(obj))) CRI("Failed to set layout!"); + if (edje_object_part_exists(wd->resize_obj, "elm.swallow.dec_button")) + sd->button_layout = EINA_TRUE; + else + sd->button_layout = EINA_FALSE; + elm_layout_signal_callback_add(obj, "drag", "*", _drag_cb, obj); elm_layout_signal_callback_add(obj, "drag,start", "*", _drag_start_cb, obj); elm_layout_signal_callback_add(obj, "drag,stop", "*", _drag_stop_cb, obj); elm_layout_signal_callback_add(obj, "drag,step", "*", _drag_stop_cb, obj); elm_layout_signal_callback_add(obj, "drag,page", "*", _drag_stop_cb, obj); - priv->inc_button = elm_button_add(obj); - elm_object_style_set(priv->inc_button, "spinner/increase/default"); - - evas_object_smart_callback_add - (priv->inc_button, "clicked", _inc_button_clicked_cb, obj); - evas_object_smart_callback_add - (priv->inc_button, "pressed", _inc_button_pressed_cb, obj); - evas_object_smart_callback_add - (priv->inc_button, "unpressed", _inc_button_unpressed_cb, obj); - - elm_layout_content_set(obj, "elm.swallow.inc_button", priv->inc_button); - elm_widget_sub_object_add(obj, priv->inc_button); + if (sd->button_layout) + { + priv->inc_button = elm_button_add(obj); + elm_object_style_set(priv->inc_button, "spinner/increase/default"); - priv->text_button = elm_button_add(obj); - elm_object_style_set(priv->text_button, "spinner/default"); + evas_object_smart_callback_add + (priv->inc_button, "clicked", _inc_button_clicked_cb, obj); + evas_object_smart_callback_add + (priv->inc_button, "pressed", _inc_button_pressed_cb, obj); + evas_object_smart_callback_add + (priv->inc_button, "unpressed", _inc_button_unpressed_cb, obj); - evas_object_smart_callback_add - (priv->text_button, "clicked", _text_button_clicked_cb, obj); + elm_layout_content_set(obj, "elm.swallow.inc_button", priv->inc_button); + elm_widget_sub_object_add(obj, priv->inc_button); - elm_layout_content_set(obj, "elm.swallow.text_button", priv->text_button); - elm_widget_sub_object_add(obj, priv->text_button); + priv->text_button = elm_button_add(obj); + elm_object_style_set(priv->text_button, "spinner/default"); + evas_object_smart_callback_add + (priv->text_button, "clicked", _text_button_clicked_cb, obj); - priv->dec_button = elm_button_add(obj); - elm_object_style_set(priv->dec_button, "spinner/decrease/default"); + elm_layout_content_set(obj, "elm.swallow.text_button", priv->text_button); + elm_widget_sub_object_add(obj, priv->text_button); - evas_object_smart_callback_add - (priv->dec_button, "clicked", _dec_button_clicked_cb, obj); - evas_object_smart_callback_add - (priv->dec_button, "pressed", _dec_button_pressed_cb, obj); - evas_object_smart_callback_add - (priv->dec_button, "unpressed", _dec_button_unpressed_cb, obj); + priv->dec_button = elm_button_add(obj); + elm_object_style_set(priv->dec_button, "spinner/decrease/default"); - elm_layout_content_set(obj, "elm.swallow.dec_button", priv->dec_button); - elm_widget_sub_object_add(obj, priv->dec_button); + evas_object_smart_callback_add + (priv->dec_button, "clicked", _dec_button_clicked_cb, obj); + evas_object_smart_callback_add + (priv->dec_button, "pressed", _dec_button_pressed_cb, obj); + evas_object_smart_callback_add + (priv->dec_button, "unpressed", _dec_button_unpressed_cb, obj); + elm_layout_content_set(obj, "elm.swallow.dec_button", priv->dec_button); + elm_widget_sub_object_add(obj, priv->dec_button); + } + else + { + elm_layout_signal_callback_add + (obj, "elm,action,increment,start", "*", _button_inc_start_cb, obj); + elm_layout_signal_callback_add + (obj, "elm,action,increment,stop", "*", _button_inc_stop_cb, obj); + elm_layout_signal_callback_add + (obj, "elm,action,decrement,start", "*", _button_dec_start_cb, obj); + elm_layout_signal_callback_add + (obj, "elm,action,decrement,stop", "*", _button_dec_stop_cb, obj); + } edje_object_part_drag_value_set (wd->resize_obj, "elm.dragable.slider", 0.0, 0.0); @@ -742,11 +1045,17 @@ _elm_spinner_evas_object_smart_del(Eo *obj, Elm_Spinner_Data *sd) EOLIAN static Eina_Bool _elm_spinner_elm_widget_theme_apply(Eo *obj, Elm_Spinner_Data *sd) { + ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); Eina_Bool int_ret = elm_layout_theme_set(obj, "spinner", "base", elm_widget_style_get(obj)); if (!int_ret) CRI("Failed to set layout!"); + if (edje_object_part_exists(wd->resize_obj, "elm.swallow.dec_button")) + sd->button_layout = EINA_TRUE; + else + sd->button_layout = EINA_FALSE; + if (sd->ent) { Eina_Strbuf *buf = eina_strbuf_new(); @@ -786,18 +1095,21 @@ _elm_spinner_elm_widget_theme_apply(Eo *obj, Elm_Spinner_Data *sd) return int_ret; } -static Eina_Bool _elm_spinner_smart_focus_next_enable = EINA_TRUE; +static Eina_Bool _elm_spinner_smart_focus_next_enable = EINA_FALSE; EOLIAN static Eina_Bool _elm_spinner_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Elm_Spinner_Data *_pd EINA_UNUSED) { - return _elm_spinner_smart_focus_next_enable; + ELM_SPINNER_DATA_GET(obj, sd); + return _elm_spinner_smart_focus_next_enable | sd->button_layout; } EOLIAN static Eina_Bool _elm_spinner_elm_widget_focus_direction_manager_is(Eo *obj EINA_UNUSED, Elm_Spinner_Data *_pd EINA_UNUSED) { - return EINA_TRUE; + ELM_SPINNER_DATA_GET(obj, sd); + if (sd->button_layout) return EINA_TRUE; + return EINA_FALSE; } EOLIAN static Eina_Bool @@ -1099,6 +1411,20 @@ _elm_spinner_class_constructor(Eo_Class *klass) _elm_spinner_smart_focus_next_enable = EINA_TRUE; } +EOLIAN static const Elm_Atspi_Action * +_elm_spinner_elm_interface_atspi_widget_action_elm_actions_get(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd EINA_UNUSED) +{ + static Elm_Atspi_Action atspi_actions[] = { + { "spin,left", "spin", "left", _key_action_spin}, + { "spin,right", "spin", "right", _key_action_spin}, + { "spin,up", "spin", "up", _key_action_spin}, + { "spin,down", "spin", "down", _key_action_spin}, + { "toggle", "toggle", NULL, _key_action_toggle}, + { NULL, NULL, NULL, NULL } + }; + return &atspi_actions[0]; +} + // A11Y Accessibility EOLIAN static void diff --git a/src/lib/elm_spinner.eo b/src/lib/elm_spinner.eo index 0c02ede..6e6b71a 100644 --- a/src/lib/elm_spinner.eo +++ b/src/lib/elm_spinner.eo @@ -373,12 +373,14 @@ class Elm_Spinner (Elm_Layout, Elm_Interface_Atspi_Value, Elm_Interface_Atspi_Wi Elm_Widget.focus_next; Elm_Widget.focus_direction; Elm_Widget.on_focus; + Elm_Widget.event; Elm_Layout.sizing_eval; Elm_Interface_Atspi_Accessible.name.get; Elm_Interface_Atspi_Value.value_and_text.get; Elm_Interface_Atspi_Value.value_and_text.set; Elm_Interface_Atspi_Value.range.get; Elm_Interface_Atspi_Value.increment.get; + Elm_Interface_Atspi_Widget_Action.elm_actions.get; } events { changed; diff --git a/src/lib/elm_widget_spinner.h b/src/lib/elm_widget_spinner.h index 73e410a..d0a4939 100644 --- a/src/lib/elm_widget_spinner.h +++ b/src/lib/elm_widget_spinner.h @@ -47,6 +47,7 @@ struct _Elm_Spinner_Data Eina_Bool editable : 1; Eina_Bool wrap : 1; Eina_Bool val_updated : 1; + Eina_Bool button_layout : 1; }; typedef struct _Elm_Spinner_Special_Value Elm_Spinner_Special_Value; -- 2.7.4