elm spinner - add backwards compat for older spinner themes
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Thu, 5 Mar 2015 06:14:34 +0000 (15:14 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Thu, 5 Mar 2015 06:14:34 +0000 (15:14 +0900)
this makes spinenr work with previous themes after
adfe7fbcd3f4146d84219de7dbb5a273d89f396e commit

legacy/elementary/data/themes/edc/elm/spinner.edc
legacy/elementary/src/lib/elm_spinner.c
legacy/elementary/src/lib/elm_spinner.eo
legacy/elementary/src/lib/elm_widget_spinner.h

index ca87047..b34eada 100644 (file)
@@ -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";
index 51668fb..c3ed345 100644 (file)
@@ -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,17 +334,28 @@ _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");
      }
 }
@@ -396,6 +430,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,
@@ -529,19 +711,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;
@@ -607,37 +838,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);
      }
 }
 
@@ -645,6 +930,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);
@@ -657,48 +943,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);
@@ -741,11 +1044,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();
@@ -785,18 +1094,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
@@ -1098,6 +1410,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
index 0c02ede..6e6b71a 100644 (file)
@@ -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;
index 73e410a..d0a4939 100644 (file)
@@ -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;