summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-03-05 15:14:34 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-03-05 15:14:34 +0900
commitada4c48cc46259a180c33cb04a7b96af5a03cd00 (patch)
treee220ffbbba60c9ac47b51be60c269853939a50cb
parent2b03507366ead5a47165610149c865877b8e7b9c (diff)
elm spinner - add backwards compat for older spinner themes
this makes spinenr work with previous themes after adfe7fbcd3f4146d84219de7dbb5a273d89f396e commit
-rw-r--r--data/themes/edc/elm/spinner.edc31
-rw-r--r--src/lib/elm_spinner.c464
-rw-r--r--src/lib/elm_spinner.eo2
-rw-r--r--src/lib/elm_widget_spinner.h1
4 files changed, 414 insertions, 84 deletions
diff --git a/data/themes/edc/elm/spinner.edc b/data/themes/edc/elm/spinner.edc
index ca87047e8..b34eada18 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";
32 visible: 1; 32 visible: 1;
33 } 33 }
34 } 34 }
35 part { name: "elm.dragable.slider"; type: RECT; 35 part { name: "elm.swallow.entry";
36 dragable.x: 1 1 0; 36 type: SWALLOW;
37 dragable.y: 0 0 0;
38 description { state: "default" 0.0; 37 description { state: "default" 0.0;
39 fixed: 1 0; 38 fixed: 1 0;
40 rel1.to: "inset"; 39 rel1.to: "elm.swallow.text_button";
41 rel2.to: "inset"; 40 rel2.to: "elm.swallow.text_button";
42 color: 0 0 0 0; 41 visible: 0;
42 }
43 description { state: "active" 0.0;
44 inherit: "default" 0.0;
45 visible: 1;
43 } 46 }
44 } 47 }
45 part { name: "elm.swallow.dec_button"; 48 part { name: "elm.swallow.dec_button";
@@ -89,17 +92,15 @@ group { name: "elm/spinner/base/default";
89 visible: 0; 92 visible: 0;
90 } 93 }
91 } 94 }
92 part { name: "elm.swallow.entry"; 95 part { name: "elm.dragable.slider"; type: RECT;
93 type: SWALLOW; 96 repeat_events: 1;
97 dragable.x: 1 1 0;
98 dragable.y: 0 0 0;
94 description { state: "default" 0.0; 99 description { state: "default" 0.0;
95 fixed: 1 0; 100 fixed: 1 0;
96 rel1.to: "elm.swallow.text_button"; 101 rel1.to: "inset";
97 rel2.to: "elm.swallow.text_button"; 102 rel2.to: "inset";
98 visible: 0; 103 color: 0 0 0 0;
99 }
100 description { state: "active" 0.0;
101 inherit: "default" 0.0;
102 visible: 1;
103 } 104 }
104 } 105 }
105 part { name: "disabler"; 106 part { name: "disabler";
diff --git a/src/lib/elm_spinner.c b/src/lib/elm_spinner.c
index 51668fb41..c3ed34559 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[] = {
38 {NULL, NULL} 38 {NULL, NULL}
39}; 39};
40 40
41static Eina_Bool _key_action_spin(Evas_Object *obj, const char *params);
42static Eina_Bool _key_action_toggle(Evas_Object *obj, const char *params);
43
44static const Elm_Action key_actions[] = {
45 {"spin", _key_action_spin},
46 {"toggle", _key_action_toggle},
47 {NULL, NULL}
48};
49
41static void _access_increment_decrement_info_say(Evas_Object *obj, 50static void _access_increment_decrement_info_say(Evas_Object *obj,
42 Eina_Bool is_incremented); 51 Eina_Bool is_incremented);
43 52
@@ -109,7 +118,10 @@ _label_write(Evas_Object *obj)
109 snprintf(buf, sizeof(buf), "%.0f", sd->val); 118 snprintf(buf, sizeof(buf), "%.0f", sd->val);
110 119
111apply: 120apply:
112 elm_layout_text_set(sd->text_button, "elm.text", buf); 121 if (sd->button_layout)
122 elm_layout_text_set(sd->text_button, "elm.text", buf);
123 else
124 elm_layout_text_set(obj, "elm.text", buf);
113 elm_interface_atspi_accessible_name_changed_signal_emit(obj); 125 elm_interface_atspi_accessible_name_changed_signal_emit(obj);
114 if (sd->entry_visible) _entry_show(sd); 126 if (sd->entry_visible) _entry_show(sd);
115} 127}
@@ -193,12 +205,18 @@ _drag_cb(void *data,
193 205
194 if (sd->entry_visible) return; 206 if (sd->entry_visible) return;
195 207
196 if (!strncmp(elm_widget_style_get(obj), "vertical", 8)) 208 if (sd->button_layout)
197 eo_do((Eo *)wd->resize_obj, 209 {
198 edje_obj_part_drag_value_get("elm.dragable.slider", NULL, &pos)); 210 if (!strncmp(elm_widget_style_get(obj), "vertical", 8))
211 eo_do((Eo *)wd->resize_obj,
212 edje_obj_part_drag_value_get("elm.dragable.slider", NULL, &pos));
213 else
214 eo_do((Eo *)wd->resize_obj,
215 edje_obj_part_drag_value_get("elm.dragable.slider", &pos, NULL));
216 }
199 else 217 else
200 eo_do((Eo *)wd->resize_obj, 218 eo_do((Eo *)wd->resize_obj,
201 edje_obj_part_drag_value_get("elm.dragable.slider", &pos, NULL)); 219 edje_obj_part_drag_value_get("elm.dragable.slider", &pos, NULL));
202 220
203 delta = pos * sd->step * _elm_config->scale; 221 delta = pos * sd->step * _elm_config->scale;
204 /* If we are on rtl mode, change the delta to be negative on such changes */ 222 /* If we are on rtl mode, change the delta to be negative on such changes */
@@ -241,8 +259,13 @@ _entry_hide(Evas_Object *obj)
241{ 259{
242 ELM_SPINNER_DATA_GET(obj, sd); 260 ELM_SPINNER_DATA_GET(obj, sd);
243 261
244 elm_layout_signal_emit(obj, "elm,state,entry,inactive", "elm"); 262 if (sd->button_layout)
245 elm_layout_signal_emit(obj, "elm,state,button,active", "elm"); 263 {
264 elm_layout_signal_emit(obj, "elm,state,entry,inactive", "elm");
265 elm_layout_signal_emit(obj, "elm,state,button,active", "elm");
266 }
267 else
268 elm_layout_signal_emit(obj, "elm,state,inactive", "elm");
246 sd->entry_visible = EINA_FALSE; 269 sd->entry_visible = EINA_FALSE;
247} 270}
248 271
@@ -311,17 +334,28 @@ _toggle_entry(Evas_Object *obj)
311 if (!sd->ent) 334 if (!sd->ent)
312 { 335 {
313 sd->ent = elm_entry_add(obj); 336 sd->ent = elm_entry_add(obj);
314 Eina_Strbuf *buf = eina_strbuf_new(); 337 if (sd->button_layout)
315 eina_strbuf_append_printf(buf, "spinner/%s", elm_widget_style_get(obj)); 338 {
316 elm_widget_style_set(sd->ent, eina_strbuf_string_get(buf)); 339 Eina_Strbuf *buf = eina_strbuf_new();
317 eina_strbuf_free(buf); 340 eina_strbuf_append_printf(buf, "spinner/%s", elm_widget_style_get(obj));
341 elm_widget_style_set(sd->ent, eina_strbuf_string_get(buf));
342 eina_strbuf_free(buf);
343 evas_object_event_callback_add
344 (sd->ent, EVAS_CALLBACK_SHOW, _entry_show_cb, obj);
345 }
318 elm_entry_single_line_set(sd->ent, EINA_TRUE); 346 elm_entry_single_line_set(sd->ent, EINA_TRUE);
319 evas_object_smart_callback_add 347 evas_object_smart_callback_add
320 (sd->ent, "activated", _entry_activated_cb, obj); 348 (sd->ent, "activated", _entry_activated_cb, obj);
321 evas_object_event_callback_add
322 (sd->ent, EVAS_CALLBACK_SHOW, _entry_show_cb, obj);
323 elm_layout_content_set(obj, "elm.swallow.entry", sd->ent); 349 elm_layout_content_set(obj, "elm.swallow.entry", sd->ent);
324 } 350 }
351 if (!sd->button_layout)
352 {
353 elm_layout_signal_emit(obj, "elm,state,active", "elm");
354 _entry_show(sd);
355 elm_entry_select_all(sd->ent);
356 elm_widget_focus_set(sd->ent, EINA_TRUE);
357 sd->entry_visible = EINA_TRUE;
358 }
325 elm_layout_signal_emit(obj, "elm,state,entry,active", "elm"); 359 elm_layout_signal_emit(obj, "elm,state,entry,active", "elm");
326 } 360 }
327} 361}
@@ -396,6 +430,154 @@ _spin_stop(Evas_Object *obj)
396 ELM_SAFE_FREE(sd->spin_timer, ecore_timer_del); 430 ELM_SAFE_FREE(sd->spin_timer, ecore_timer_del);
397} 431}
398 432
433static Eina_Bool
434_key_action_spin(Evas_Object *obj, const char *params)
435{
436 const char *dir = params;
437 Eina_Bool horz = !!strncmp(elm_widget_style_get(obj), "vertical", 8);
438 if (((!strcmp(dir, "left")) && horz) ||
439 ((!strcmp(dir, "down")) && !horz))
440 {
441 _val_dec_start(obj);
442 elm_layout_signal_emit(obj, "elm,left,anim,activate", "elm");
443 }
444 else if (((!strcmp(dir, "right")) && horz) ||
445 ((!strcmp(dir, "up")) && !horz))
446 {
447 _val_inc_start(obj);
448 elm_layout_signal_emit(obj, "elm,right,anim,activate", "elm");
449 }
450 else return EINA_FALSE;
451 return EINA_TRUE;
452}
453
454static Eina_Bool
455_key_action_toggle(Evas_Object *obj, const char *params EINA_UNUSED)
456{
457 ELM_SPINNER_DATA_GET(obj, sd);
458 if (sd->spin_timer) _spin_stop(obj);
459 else _entry_toggle_cb(NULL, obj, NULL, NULL);
460 return EINA_FALSE;
461}
462
463EOLIAN static Eina_Bool
464_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)
465{
466 Evas_Event_Key_Down *ev = event_info;
467 Evas_Event_Mouse_Wheel *mev;
468
469 if (type == EVAS_CALLBACK_KEY_DOWN)
470 {
471 Eina_Bool ret;
472
473 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
474 ret = _elm_config_key_binding_call(obj, ev, key_actions);
475 if (!ret)
476 {
477 if (sd->spin_timer) _spin_stop(obj);
478 else return EINA_FALSE;
479 }
480 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
481 }
482 else if (type == EVAS_CALLBACK_KEY_UP)
483 {
484 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
485 if (sd->spin_timer) _spin_stop(obj);
486 else return EINA_FALSE;
487 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
488 }
489 else if (type == EVAS_CALLBACK_MOUSE_WHEEL)
490 {
491 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
492 mev = event_info;
493 sd->interval = sd->first_interval;
494 if (mev->z < 0)
495 {
496 sd->spin_speed = sd->step;
497 elm_layout_signal_emit(obj, "elm,right,anim,activate", "elm");
498 }
499 else
500 {
501 sd->spin_speed = -sd->step;
502 elm_layout_signal_emit(obj, "elm,left,anim,activate", "elm");
503 }
504 _spin_value(obj);
505 mev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
506 }
507 else return EINA_FALSE;
508 return EINA_TRUE;
509}
510
511static void
512_button_inc_start_cb(void *data,
513 Evas_Object *obj,
514 const char *emission EINA_UNUSED,
515 const char *source EINA_UNUSED)
516{
517 ELM_SPINNER_DATA_GET(data, sd);
518
519 if (sd->entry_visible)
520 {
521 _entry_value_apply(obj);
522 if ((sd->val_updated) && (sd->val == sd->val_min)) return;
523 }
524 ecore_timer_del(sd->longpress_timer);
525 sd->longpress_timer = ecore_timer_add
526 (_elm_config->longpress_timeout, _val_inc_start, data);
527}
528
529static void
530_button_inc_stop_cb(void *data,
531 Evas_Object *obj EINA_UNUSED,
532 const char *emission EINA_UNUSED,
533 const char *source EINA_UNUSED)
534{
535 ELM_SPINNER_DATA_GET(data, sd);
536
537 if (sd->longpress_timer)
538 {
539 ELM_SAFE_FREE(sd->longpress_timer, ecore_timer_del);
540 sd->spin_speed = sd->step;
541 _spin_value(data);
542 }
543 _spin_stop(data);
544}
545
546static void
547_button_dec_start_cb(void *data,
548 Evas_Object *obj EINA_UNUSED,
549 const char *emission EINA_UNUSED,
550 const char *source EINA_UNUSED)
551{
552 ELM_SPINNER_DATA_GET(data, sd);
553
554 if (sd->entry_visible)
555 {
556 _entry_value_apply(obj);
557 if ((sd->val_updated) && (sd->val == sd->val_max)) return;
558 }
559 ecore_timer_del(sd->longpress_timer);
560 sd->longpress_timer = ecore_timer_add
561 (_elm_config->longpress_timeout, _val_dec_start, data);
562}
563
564static void
565_button_dec_stop_cb(void *data,
566 Evas_Object *obj EINA_UNUSED,
567 const char *emission EINA_UNUSED,
568 const char *source EINA_UNUSED)
569{
570 ELM_SPINNER_DATA_GET(data, sd);
571
572 if (sd->longpress_timer)
573 {
574 ELM_SAFE_FREE(sd->longpress_timer, ecore_timer_del);
575 sd->spin_speed = -sd->step;
576 _spin_value(data);
577 }
578 _spin_stop(data);
579}
580
399static void 581static void
400_inc_button_clicked_cb(void *data, 582_inc_button_clicked_cb(void *data,
401 Evas_Object *obj EINA_UNUSED, 583 Evas_Object *obj EINA_UNUSED,
@@ -529,19 +711,68 @@ _elm_spinner_elm_widget_on_focus(Eo *obj, Elm_Spinner_Data *sd)
529 return EINA_TRUE; 711 return EINA_TRUE;
530} 712}
531 713
714static void
715_access_activate_cb(void *data,
716 Evas_Object *part_obj,
717 Elm_Object_Item *item EINA_UNUSED)
718{
719 char *text;
720 Eina_Strbuf *buf;
721 Evas_Object *eo, *inc_btn;
722 const char* increment_part;
723
724 if (!strncmp(elm_widget_style_get(data), "vertical", 8))
725 increment_part = "up_bt";
726 else
727 increment_part = "right_bt";
728
729 eo = elm_layout_edje_get(data);
730 inc_btn = (Evas_Object *)edje_object_part_object_get(eo, increment_part);
731
732 if (part_obj != inc_btn)
733 {
734 _val_dec_start(data);
735 elm_layout_signal_emit(data, "elm,left,anim,activate", "elm");
736 _spin_stop(data);
737 text = "decremented";
738 }
739 else
740 {
741 _val_inc_start(data);
742 elm_layout_signal_emit(data, "elm,right,anim,activate", "elm");
743 _spin_stop(data);
744 text = "incremented";
745 }
746
747 buf = eina_strbuf_new();
748
749 eina_strbuf_append_printf(buf, "%s, %s", text,
750 elm_layout_text_get(data, "elm.text"));
751
752 text = eina_strbuf_string_steal(buf);
753 eina_strbuf_free(buf);
754
755 _elm_access_say(text);
756}
757
532static char * 758static char *
533_access_info_cb(void *data, Evas_Object *obj EINA_UNUSED) 759_access_info_cb(void *data, Evas_Object *obj EINA_UNUSED)
534{ 760{
535 Evas_Object *spinner;
536 const char *txt = NULL; 761 const char *txt = NULL;
537 762 Evas_Object *spinner = (Evas_Object *)(data);
538 spinner = (Evas_Object *)(data);
539 ELM_SPINNER_DATA_GET(spinner, sd); 763 ELM_SPINNER_DATA_GET(spinner, sd);
540 764
541 if (sd->entry_visible) 765 if (sd->button_layout)
542 txt = elm_object_text_get(sd->ent); 766 {
767 if (sd->entry_visible)
768 txt = elm_object_text_get(sd->ent);
769 else
770 txt = elm_object_text_get(sd->text_button);
771 }
543 else 772 else
544 txt = elm_object_text_get(sd->text_button); 773 {
774 txt = elm_layout_text_get(spinner, "elm.text");
775 }
545 if (txt) return strdup(txt); 776 if (txt) return strdup(txt);
546 777
547 return NULL; 778 return NULL;
@@ -607,37 +838,91 @@ _access_spinner_register(Evas_Object *obj, Eina_Bool is_access)
607 838
608 ELM_SPINNER_DATA_GET(obj, sd); 839 ELM_SPINNER_DATA_GET(obj, sd);
609 840
610 if (!is_access) 841 if (sd->button_layout)
611 { 842 {
612 /* unregister access */ 843 if (!is_access)
613 _elm_access_edje_object_part_object_unregister 844 {
614 (obj, elm_layout_edje_get(obj), "access"); 845 /* unregister access */
615 elm_layout_signal_emit(obj, "elm,state,access,inactive", "elm"); 846 _elm_access_edje_object_part_object_unregister
616 return; 847 (obj, elm_layout_edje_get(obj), "access");
617 } 848 elm_layout_signal_emit(obj, "elm,state,access,inactive", "elm");
618 elm_layout_signal_emit(obj, "elm,state,access,active", "elm"); 849 return;
619 ao = _elm_access_edje_object_part_object_register 850 }
851 elm_layout_signal_emit(obj, "elm,state,access,active", "elm");
852 ao = _elm_access_edje_object_part_object_register
620 (obj, elm_layout_edje_get(obj), "access"); 853 (obj, elm_layout_edje_get(obj), "access");
621 854
622 ai = _elm_access_info_get(ao); 855 ai = _elm_access_info_get(ao);
623 _elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("spinner")); 856 _elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("spinner"));
624 _elm_access_callback_set(ai, ELM_ACCESS_STATE, _access_state_cb, obj); 857 _elm_access_callback_set(ai, ELM_ACCESS_STATE, _access_state_cb, obj);
625 _elm_access_activate_callback_set(ai, _access_activate_spinner_cb, obj); 858 _elm_access_activate_callback_set(ai, _access_activate_spinner_cb, obj);
626 859
627 /*Do not register spinner buttons if widget is disabled*/ 860 /*Do not register spinner buttons if widget is disabled*/
628 if (!elm_widget_disabled_get(obj)) 861 if (!elm_widget_disabled_get(obj))
862 {
863 ai = _elm_access_info_get(sd->inc_button);
864 _elm_access_text_set(ai, ELM_ACCESS_TYPE,
865 E_("spinner increment button"));
866 ai = _elm_access_info_get(sd->dec_button);
867 _elm_access_text_set(ai, ELM_ACCESS_TYPE,
868 E_("spinner decrement button"));
869 ai = _elm_access_info_get(sd->text_button);
870 _elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("spinner text"));
871 _elm_access_callback_set(ai, ELM_ACCESS_INFO, _access_info_cb, obj);
872 }
873 }
874 else
629 { 875 {
630 ai = _elm_access_info_get(sd->inc_button); 876 const char* increment_part;
877 const char* decrement_part;
878
879 if (!strncmp(elm_widget_style_get(obj), "vertical", 8))
880 {
881 increment_part = "up_bt";
882 decrement_part = "down_bt";
883 }
884 else
885 {
886 increment_part = "right_bt";
887 decrement_part = "left_bt";
888 }
889 if (!is_access)
890 {
891 /* unregister increment button, decrement button and spinner label */
892 _elm_access_edje_object_part_object_unregister
893 (obj, elm_layout_edje_get(obj), increment_part);
894 _elm_access_edje_object_part_object_unregister
895 (obj, elm_layout_edje_get(obj), decrement_part);
896 _elm_access_edje_object_part_object_unregister
897 (obj, elm_layout_edje_get(obj), "access.text");
898 return;
899 }
900
901 /* register increment button */
902 ao = _elm_access_edje_object_part_object_register
903 (obj, elm_layout_edje_get(obj), increment_part);
904 ai = _elm_access_info_get(ao);
631 _elm_access_text_set(ai, ELM_ACCESS_TYPE, 905 _elm_access_text_set(ai, ELM_ACCESS_TYPE,
632 E_("spinner increment button")); 906 E_("spinner increment button"));
907 _elm_access_activate_callback_set(ai, _access_activate_cb, obj);
633 908
634 ai = _elm_access_info_get(sd->dec_button); 909 /* register decrement button */
910 ao = _elm_access_edje_object_part_object_register
911 (obj, elm_layout_edje_get(obj), decrement_part);
912
913 ai = _elm_access_info_get(ao);
635 _elm_access_text_set(ai, ELM_ACCESS_TYPE, 914 _elm_access_text_set(ai, ELM_ACCESS_TYPE,
636 E_("spinner decrement button")); 915 E_("spinner decrement button"));
916 _elm_access_activate_callback_set(ai, _access_activate_cb, obj);
917
918 /* register spinner label */
919 ao = _elm_access_edje_object_part_object_register
920 (obj, elm_layout_edje_get(obj), "access.text");
637 921
638 ai = _elm_access_info_get(sd->text_button); 922 ai = _elm_access_info_get(ao);
639 _elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("spinner text")); 923 _elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("spinner"));
640 _elm_access_callback_set(ai, ELM_ACCESS_INFO, _access_info_cb, obj); 924 _elm_access_callback_set(ai, ELM_ACCESS_INFO, _access_info_cb, obj);
925 _elm_access_callback_set(ai, ELM_ACCESS_STATE, _access_state_cb, obj);
641 } 926 }
642} 927}
643 928
@@ -645,6 +930,7 @@ EOLIAN static void
645_elm_spinner_evas_object_smart_add(Eo *obj, Elm_Spinner_Data *priv) 930_elm_spinner_evas_object_smart_add(Eo *obj, Elm_Spinner_Data *priv)
646{ 931{
647 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); 932 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
933 ELM_SPINNER_DATA_GET(obj, sd);
648 934
649 eo_do_super(obj, MY_CLASS, evas_obj_smart_add()); 935 eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
650 elm_widget_sub_object_parent_add(obj); 936 elm_widget_sub_object_parent_add(obj);
@@ -657,48 +943,65 @@ _elm_spinner_evas_object_smart_add(Eo *obj, Elm_Spinner_Data *priv)
657 elm_widget_style_get(obj))) 943 elm_widget_style_get(obj)))
658 CRI("Failed to set layout!"); 944 CRI("Failed to set layout!");
659 945
946 if (edje_object_part_exists(wd->resize_obj, "elm.swallow.dec_button"))
947 sd->button_layout = EINA_TRUE;
948 else
949 sd->button_layout = EINA_FALSE;
950
660 elm_layout_signal_callback_add(obj, "drag", "*", _drag_cb, obj); 951 elm_layout_signal_callback_add(obj, "drag", "*", _drag_cb, obj);
661 elm_layout_signal_callback_add(obj, "drag,start", "*", _drag_start_cb, obj); 952 elm_layout_signal_callback_add(obj, "drag,start", "*", _drag_start_cb, obj);
662 elm_layout_signal_callback_add(obj, "drag,stop", "*", _drag_stop_cb, obj); 953 elm_layout_signal_callback_add(obj, "drag,stop", "*", _drag_stop_cb, obj);
663 elm_layout_signal_callback_add(obj, "drag,step", "*", _drag_stop_cb, obj); 954 elm_layout_signal_callback_add(obj, "drag,step", "*", _drag_stop_cb, obj);
664 elm_layout_signal_callback_add(obj, "drag,page", "*", _drag_stop_cb, obj); 955 elm_layout_signal_callback_add(obj, "drag,page", "*", _drag_stop_cb, obj);
665 956
666 priv->inc_button = elm_button_add(obj); 957 if (sd->button_layout)
667 elm_object_style_set(priv->inc_button, "spinner/increase/default"); 958 {
668 959 priv->inc_button = elm_button_add(obj);
669 evas_object_smart_callback_add 960 elm_object_style_set(priv->inc_button, "spinner/increase/default");
670 (priv->inc_button, "clicked", _inc_button_clicked_cb, obj);
671 evas_object_smart_callback_add
672 (priv->inc_button, "pressed", _inc_button_pressed_cb, obj);
673 evas_object_smart_callback_add
674 (priv->inc_button, "unpressed", _inc_button_unpressed_cb, obj);
675
676 elm_layout_content_set(obj, "elm.swallow.inc_button", priv->inc_button);
677 elm_widget_sub_object_add(obj, priv->inc_button);
678 961
679 priv->text_button = elm_button_add(obj); 962 evas_object_smart_callback_add
680 elm_object_style_set(priv->text_button, "spinner/default"); 963 (priv->inc_button, "clicked", _inc_button_clicked_cb, obj);
964 evas_object_smart_callback_add
965 (priv->inc_button, "pressed", _inc_button_pressed_cb, obj);
966 evas_object_smart_callback_add
967 (priv->inc_button, "unpressed", _inc_button_unpressed_cb, obj);
681 968
682 evas_object_smart_callback_add 969 elm_layout_content_set(obj, "elm.swallow.inc_button", priv->inc_button);
683 (priv->text_button, "clicked", _text_button_clicked_cb, obj); 970 elm_widget_sub_object_add(obj, priv->inc_button);
684 971
685 elm_layout_content_set(obj, "elm.swallow.text_button", priv->text_button); 972 priv->text_button = elm_button_add(obj);
686 elm_widget_sub_object_add(obj, priv->text_button); 973 elm_object_style_set(priv->text_button, "spinner/default");
687 974
975 evas_object_smart_callback_add
976 (priv->text_button, "clicked", _text_button_clicked_cb, obj);
688 977
689 priv->dec_button = elm_button_add(obj); 978 elm_layout_content_set(obj, "elm.swallow.text_button", priv->text_button);
690 elm_object_style_set(priv->dec_button, "spinner/decrease/default"); 979 elm_widget_sub_object_add(obj, priv->text_button);
691 980
692 evas_object_smart_callback_add 981 priv->dec_button = elm_button_add(obj);
693 (priv->dec_button, "clicked", _dec_button_clicked_cb, obj); 982 elm_object_style_set(priv->dec_button, "spinner/decrease/default");
694 evas_object_smart_callback_add
695 (priv->dec_button, "pressed", _dec_button_pressed_cb, obj);
696 evas_object_smart_callback_add
697 (priv->dec_button, "unpressed", _dec_button_unpressed_cb, obj);
698 983
699 elm_layout_content_set(obj, "elm.swallow.dec_button", priv->dec_button); 984 evas_object_smart_callback_add
700 elm_widget_sub_object_add(obj, priv->dec_button); 985 (priv->dec_button, "clicked", _dec_button_clicked_cb, obj);
986 evas_object_smart_callback_add
987 (priv->dec_button, "pressed", _dec_button_pressed_cb, obj);
988 evas_object_smart_callback_add
989 (priv->dec_button, "unpressed", _dec_button_unpressed_cb, obj);
701 990
991 elm_layout_content_set(obj, "elm.swallow.dec_button", priv->dec_button);
992 elm_widget_sub_object_add(obj, priv->dec_button);
993 }
994 else
995 {
996 elm_layout_signal_callback_add
997 (obj, "elm,action,increment,start", "*", _button_inc_start_cb, obj);
998 elm_layout_signal_callback_add
999 (obj, "elm,action,increment,stop", "*", _button_inc_stop_cb, obj);
1000 elm_layout_signal_callback_add
1001 (obj, "elm,action,decrement,start", "*", _button_dec_start_cb, obj);
1002 elm_layout_signal_callback_add
1003 (obj, "elm,action,decrement,stop", "*", _button_dec_stop_cb, obj);
1004 }
702 1005
703 edje_object_part_drag_value_set 1006 edje_object_part_drag_value_set
704 (wd->resize_obj, "elm.dragable.slider", 0.0, 0.0); 1007 (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)
741EOLIAN static Eina_Bool 1044EOLIAN static Eina_Bool
742_elm_spinner_elm_widget_theme_apply(Eo *obj, Elm_Spinner_Data *sd) 1045_elm_spinner_elm_widget_theme_apply(Eo *obj, Elm_Spinner_Data *sd)
743{ 1046{
1047 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
744 Eina_Bool int_ret = elm_layout_theme_set(obj, "spinner", "base", 1048 Eina_Bool int_ret = elm_layout_theme_set(obj, "spinner", "base",
745 elm_widget_style_get(obj)); 1049 elm_widget_style_get(obj));
746 1050
747 if (!int_ret) CRI("Failed to set layout!"); 1051 if (!int_ret) CRI("Failed to set layout!");
748 1052
1053 if (edje_object_part_exists(wd->resize_obj, "elm.swallow.dec_button"))
1054 sd->button_layout = EINA_TRUE;
1055 else
1056 sd->button_layout = EINA_FALSE;
1057
749 if (sd->ent) 1058 if (sd->ent)
750 { 1059 {
751 Eina_Strbuf *buf = eina_strbuf_new(); 1060 Eina_Strbuf *buf = eina_strbuf_new();
@@ -785,18 +1094,21 @@ _elm_spinner_elm_widget_theme_apply(Eo *obj, Elm_Spinner_Data *sd)
785 return int_ret; 1094 return int_ret;
786} 1095}
787 1096
788static Eina_Bool _elm_spinner_smart_focus_next_enable = EINA_TRUE; 1097static Eina_Bool _elm_spinner_smart_focus_next_enable = EINA_FALSE;
789 1098
790EOLIAN static Eina_Bool 1099EOLIAN static Eina_Bool
791_elm_spinner_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Elm_Spinner_Data *_pd EINA_UNUSED) 1100_elm_spinner_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Elm_Spinner_Data *_pd EINA_UNUSED)
792{ 1101{
793 return _elm_spinner_smart_focus_next_enable; 1102 ELM_SPINNER_DATA_GET(obj, sd);
1103 return _elm_spinner_smart_focus_next_enable | sd->button_layout;
794} 1104}
795 1105
796EOLIAN static Eina_Bool 1106EOLIAN static Eina_Bool
797_elm_spinner_elm_widget_focus_direction_manager_is(Eo *obj EINA_UNUSED, Elm_Spinner_Data *_pd EINA_UNUSED) 1107_elm_spinner_elm_widget_focus_direction_manager_is(Eo *obj EINA_UNUSED, Elm_Spinner_Data *_pd EINA_UNUSED)
798{ 1108{
799 return EINA_TRUE; 1109 ELM_SPINNER_DATA_GET(obj, sd);
1110 if (sd->button_layout) return EINA_TRUE;
1111 return EINA_FALSE;
800} 1112}
801 1113
802EOLIAN static Eina_Bool 1114EOLIAN static Eina_Bool
@@ -1098,6 +1410,20 @@ _elm_spinner_class_constructor(Eo_Class *klass)
1098 _elm_spinner_smart_focus_next_enable = EINA_TRUE; 1410 _elm_spinner_smart_focus_next_enable = EINA_TRUE;
1099} 1411}
1100 1412
1413EOLIAN static const Elm_Atspi_Action *
1414_elm_spinner_elm_interface_atspi_widget_action_elm_actions_get(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd EINA_UNUSED)
1415{
1416 static Elm_Atspi_Action atspi_actions[] = {
1417 { "spin,left", "spin", "left", _key_action_spin},
1418 { "spin,right", "spin", "right", _key_action_spin},
1419 { "spin,up", "spin", "up", _key_action_spin},
1420 { "spin,down", "spin", "down", _key_action_spin},
1421 { "toggle", "toggle", NULL, _key_action_toggle},
1422 { NULL, NULL, NULL, NULL }
1423 };
1424 return &atspi_actions[0];
1425}
1426
1101// A11Y Accessibility 1427// A11Y Accessibility
1102 1428
1103EOLIAN static void 1429EOLIAN static void
diff --git a/src/lib/elm_spinner.eo b/src/lib/elm_spinner.eo
index 0c02edea6..6e6b71ac1 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
373 Elm_Widget.focus_next; 373 Elm_Widget.focus_next;
374 Elm_Widget.focus_direction; 374 Elm_Widget.focus_direction;
375 Elm_Widget.on_focus; 375 Elm_Widget.on_focus;
376 Elm_Widget.event;
376 Elm_Layout.sizing_eval; 377 Elm_Layout.sizing_eval;
377 Elm_Interface_Atspi_Accessible.name.get; 378 Elm_Interface_Atspi_Accessible.name.get;
378 Elm_Interface_Atspi_Value.value_and_text.get; 379 Elm_Interface_Atspi_Value.value_and_text.get;
379 Elm_Interface_Atspi_Value.value_and_text.set; 380 Elm_Interface_Atspi_Value.value_and_text.set;
380 Elm_Interface_Atspi_Value.range.get; 381 Elm_Interface_Atspi_Value.range.get;
381 Elm_Interface_Atspi_Value.increment.get; 382 Elm_Interface_Atspi_Value.increment.get;
383 Elm_Interface_Atspi_Widget_Action.elm_actions.get;
382 } 384 }
383 events { 385 events {
384 changed; 386 changed;
diff --git a/src/lib/elm_widget_spinner.h b/src/lib/elm_widget_spinner.h
index 73e410a30..d0a4939dc 100644
--- a/src/lib/elm_widget_spinner.h
+++ b/src/lib/elm_widget_spinner.h
@@ -47,6 +47,7 @@ struct _Elm_Spinner_Data
47 Eina_Bool editable : 1; 47 Eina_Bool editable : 1;
48 Eina_Bool wrap : 1; 48 Eina_Bool wrap : 1;
49 Eina_Bool val_updated : 1; 49 Eina_Bool val_updated : 1;
50 Eina_Bool button_layout : 1;
50}; 51};
51 52
52typedef struct _Elm_Spinner_Special_Value Elm_Spinner_Special_Value; 53typedef struct _Elm_Spinner_Special_Value Elm_Spinner_Special_Value;