summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bin/elementary/test_part_bg.c3
-rw-r--r--src/lib/elementary/efl_ui_spin.c31
-rw-r--r--src/lib/elementary/efl_ui_spin.eo2
-rw-r--r--src/lib/elementary/efl_ui_spin_button.c63
-rw-r--r--src/lib/elementary/efl_ui_spin_button.eo2
5 files changed, 35 insertions, 66 deletions
diff --git a/src/bin/elementary/test_part_bg.c b/src/bin/elementary/test_part_bg.c
index 26ba4dc7eb..c3b391b673 100644
--- a/src/bin/elementary/test_part_bg.c
+++ b/src/bin/elementary/test_part_bg.c
@@ -3,7 +3,7 @@
3#endif 3#endif
4#include <Elementary.h> 4#include <Elementary.h>
5 5
6#define MAX_NUM_OF_CONTENT 18 6#define MAX_NUM_OF_CONTENT 19
7 7
8const Efl_Class *content_class[MAX_NUM_OF_CONTENT]; 8const Efl_Class *content_class[MAX_NUM_OF_CONTENT];
9 9
@@ -141,6 +141,7 @@ test_part_background(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
141 content_class[15] = EFL_UI_IMAGE_ZOOMABLE_CLASS; 141 content_class[15] = EFL_UI_IMAGE_ZOOMABLE_CLASS;
142 content_class[16] = EFL_UI_NSTATE_CLASS; 142 content_class[16] = EFL_UI_NSTATE_CLASS;
143 content_class[17] = EFL_UI_SPIN_CLASS; 143 content_class[17] = EFL_UI_SPIN_CLASS;
144 content_class[18] = EFL_UI_SPIN_BUTTON_CLASS;
144 145
145 win = efl_add(EFL_UI_WIN_CLASS, NULL, 146 win = efl_add(EFL_UI_WIN_CLASS, NULL,
146 efl_text_set(efl_added, "Widget Part Background"), 147 efl_text_set(efl_added, "Widget Part Background"),
diff --git a/src/lib/elementary/efl_ui_spin.c b/src/lib/elementary/efl_ui_spin.c
index dadb404041..d24d20d309 100644
--- a/src/lib/elementary/efl_ui_spin.c
+++ b/src/lib/elementary/efl_ui_spin.c
@@ -150,19 +150,6 @@ _efl_ui_spin_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Spin_Data *_pd EINA_UNUSED)
150 evas_object_size_hint_max_set(obj, -1, -1); 150 evas_object_size_hint_max_set(obj, -1, -1);
151} 151}
152 152
153EOLIAN static Efl_Ui_Theme_Apply
154_efl_ui_spin_elm_widget_theme_apply(Eo *obj, Efl_Ui_Spin_Data *sd EINA_UNUSED)
155{
156 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_UI_THEME_APPLY_FAILED);
157
158 if (!elm_layout_theme_set(obj, "spin", "base", elm_widget_style_get(obj)))
159 CRI("Failed to set layout!");
160
161 elm_layout_sizing_eval(obj);
162
163 return EFL_UI_THEME_APPLY_SUCCESS;
164}
165
166EOLIAN static Eina_Bool 153EOLIAN static Eina_Bool
167_efl_ui_spin_elm_widget_widget_event(Eo *obj, Efl_Ui_Spin_Data *sd, const Efl_Event *eo_event, Evas_Object *src EINA_UNUSED) 154_efl_ui_spin_elm_widget_widget_event(Eo *obj, Efl_Ui_Spin_Data *sd, const Efl_Event *eo_event, Evas_Object *src EINA_UNUSED)
168{ 155{
@@ -187,6 +174,10 @@ _efl_ui_spin_elm_widget_widget_event(Eo *obj, Efl_Ui_Spin_Data *sd, const Efl_Ev
187EOLIAN static Eo * 174EOLIAN static Eo *
188_efl_ui_spin_efl_object_constructor(Eo *obj, Efl_Ui_Spin_Data *sd) 175_efl_ui_spin_efl_object_constructor(Eo *obj, Efl_Ui_Spin_Data *sd)
189{ 176{
177 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
178
179 if (!elm_widget_theme_klass_get(obj))
180 elm_widget_theme_klass_set(obj, "spin");
190 obj = efl_constructor(efl_super(obj, MY_CLASS)); 181 obj = efl_constructor(efl_super(obj, MY_CLASS));
191 182
192 elm_widget_sub_object_parent_add(obj); 183 elm_widget_sub_object_parent_add(obj);
@@ -194,8 +185,10 @@ _efl_ui_spin_efl_object_constructor(Eo *obj, Efl_Ui_Spin_Data *sd)
194 sd->val_max = 100.0; 185 sd->val_max = 100.0;
195 sd->step = 1.0; 186 sd->step = 1.0;
196 187
197 if (!elm_layout_theme_set(obj, "spin", "base", 188 if (!elm_widget_theme_object_set(obj, wd->resize_obj,
198 elm_widget_style_get(obj))) 189 elm_widget_theme_klass_get(obj),
190 elm_widget_theme_element_get(obj),
191 elm_widget_theme_style_get(obj)))
199 CRI("Failed to set layout!"); 192 CRI("Failed to set layout!");
200 193
201 _label_write(obj); 194 _label_write(obj);
@@ -206,14 +199,6 @@ _efl_ui_spin_efl_object_constructor(Eo *obj, Efl_Ui_Spin_Data *sd)
206 return obj; 199 return obj;
207} 200}
208 201
209EOLIAN static Eo *
210_efl_ui_spin_efl_object_finalize(Eo *obj, Efl_Ui_Spin_Data *sd EINA_UNUSED)
211{
212 obj = efl_finalize(efl_super(obj, MY_CLASS));
213
214 return obj;
215}
216
217EOLIAN static void 202EOLIAN static void
218_efl_ui_spin_efl_object_destructor(Eo *obj, Efl_Ui_Spin_Data *sd EINA_UNUSED) 203_efl_ui_spin_efl_object_destructor(Eo *obj, Efl_Ui_Spin_Data *sd EINA_UNUSED)
219{ 204{
diff --git a/src/lib/elementary/efl_ui_spin.eo b/src/lib/elementary/efl_ui_spin.eo
index fae80d1e40..f350cb1413 100644
--- a/src/lib/elementary/efl_ui_spin.eo
+++ b/src/lib/elementary/efl_ui_spin.eo
@@ -10,9 +10,7 @@ class Efl.Ui.Spin (Efl.Ui.Layout, Efl.Ui.Range, Efl.Ui.Format,
10 ]] 10 ]]
11 implements { 11 implements {
12 Efl.Object.constructor; 12 Efl.Object.constructor;
13 Efl.Object.finalize;
14 Efl.Object.destructor; 13 Efl.Object.destructor;
15 Elm.Widget.theme_apply;
16 Elm.Widget.widget_event; 14 Elm.Widget.widget_event;
17 Efl.Ui.Range.range_min_max { get; set; } 15 Efl.Ui.Range.range_min_max { get; set; }
18 Efl.Ui.Range.range_step { get; set; } 16 Efl.Ui.Range.range_step { get; set; }
diff --git a/src/lib/elementary/efl_ui_spin_button.c b/src/lib/elementary/efl_ui_spin_button.c
index eaf47435d1..abc49eda93 100644
--- a/src/lib/elementary/efl_ui_spin_button.c
+++ b/src/lib/elementary/efl_ui_spin_button.c
@@ -20,6 +20,10 @@
20 20
21#define EFL_UI_SPIN_BUTTON_DELAY_CHANGE_TIME 0.2 21#define EFL_UI_SPIN_BUTTON_DELAY_CHANGE_TIME 0.2
22 22
23static const char PART_NAME_DEC_BUTTON[] = "dec_button";
24static const char PART_NAME_TEXT_BUTTON[] = "text_button";
25static const char PART_NAME_INC_BUTTON[] = "inc_button";
26
23static void 27static void
24_inc_dec_button_clicked_cb(void *data, const Efl_Event *event); 28_inc_dec_button_clicked_cb(void *data, const Efl_Event *event);
25static void 29static void
@@ -101,13 +105,15 @@ _label_write(Evas_Object *obj)
101 Efl_Ui_Spin_Data *pd = efl_data_scope_get(obj, EFL_UI_SPIN_CLASS); 105 Efl_Ui_Spin_Data *pd = efl_data_scope_get(obj, EFL_UI_SPIN_CLASS);
102 106
103 if (pd->templates) 107 if (pd->templates)
104 elm_layout_text_set(sd->text_button, "elm.text", pd->templates); 108 {
109 efl_text_set(sd->text_button, pd->templates);
110 }
105 else 111 else
106 { 112 {
107 char buf[1024]; 113 char buf[1024];
108 114
109 snprintf(buf, sizeof(buf), "%.0f", pd->val); 115 snprintf(buf, sizeof(buf), "%.0f", pd->val);
110 elm_layout_text_set(sd->text_button, "elm.text", buf); 116 efl_text_set(sd->text_button, buf);
111 } 117 }
112} 118}
113 119
@@ -151,9 +157,7 @@ _entry_hide(Evas_Object *obj)
151 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(obj, MY_CLASS); 157 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(obj, MY_CLASS);
152 158
153 elm_layout_signal_emit(obj, "elm,state,button,active", "elm"); 159 elm_layout_signal_emit(obj, "elm,state,button,active", "elm");
154 evas_object_show(sd->text_button);
155 elm_layout_signal_emit(obj, "elm,state,entry,inactive", "elm"); 160 elm_layout_signal_emit(obj, "elm,state,entry,inactive", "elm");
156 evas_object_hide(sd->ent);
157 161
158 if (sd->entry_visible && !evas_focus_state_get(evas_object_evas_get(obj))) 162 if (sd->entry_visible && !evas_focus_state_get(evas_object_evas_get(obj)))
159 sd->entry_reactivate = EINA_TRUE; 163 sd->entry_reactivate = EINA_TRUE;
@@ -337,7 +341,6 @@ _entry_show_cb(void *data,
337 elm_entry_select_all(obj); 341 elm_entry_select_all(obj);
338 sd->entry_visible = EINA_TRUE; 342 sd->entry_visible = EINA_TRUE;
339 elm_layout_signal_emit(data, "elm,state,button,inactive", "elm"); 343 elm_layout_signal_emit(data, "elm,state,button,inactive", "elm");
340 evas_object_hide(sd->text_button);
341} 344}
342 345
343static void 346static void
@@ -376,7 +379,6 @@ _toggle_entry(Evas_Object *obj)
376 _entry_focus_changed_cb, obj); 379 _entry_focus_changed_cb, obj);
377 sd->entry_visible = EINA_TRUE; 380 sd->entry_visible = EINA_TRUE;
378 elm_layout_signal_emit(obj, "elm,state,entry,active", "elm"); 381 elm_layout_signal_emit(obj, "elm,state,entry,active", "elm");
379 evas_object_show(sd->ent);
380 { 382 {
381 Eina_List *items = NULL; 383 Eina_List *items = NULL;
382 384
@@ -617,7 +619,7 @@ _access_info_cb(void *data, Evas_Object *obj EINA_UNUSED)
617 if (sd->entry_visible) 619 if (sd->entry_visible)
618 txt = elm_object_text_get(sd->ent); 620 txt = elm_object_text_get(sd->ent);
619 else 621 else
620 txt = elm_object_text_get(sd->text_button); 622 txt = efl_text_get(sd->text_button);
621 623
622 if (txt) return strdup(txt); 624 if (txt) return strdup(txt);
623 625
@@ -717,13 +719,14 @@ _access_spinner_register(Evas_Object *obj, Eina_Bool is_access)
717EOLIAN static Efl_Ui_Theme_Apply 719EOLIAN static Efl_Ui_Theme_Apply
718_efl_ui_spin_button_elm_widget_theme_apply(Eo *obj, Efl_Ui_Spin_Button_Data *sd EINA_UNUSED) 720_efl_ui_spin_button_elm_widget_theme_apply(Eo *obj, Efl_Ui_Spin_Button_Data *sd EINA_UNUSED)
719{ 721{
720 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_UI_THEME_APPLY_FAILED); 722 Efl_Ui_Theme_Apply int_ret = EFL_UI_THEME_APPLY_FAILED;
721 723
722 if (!elm_layout_theme_set(obj, "spin_button", "base", elm_widget_style_get(obj))) 724 int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS));
723 CRI("Failed to set layout!"); 725 if (!int_ret) return EFL_UI_THEME_APPLY_FAILED;
724 726
725 if (sd->ent) 727 if (sd->ent)
726 { 728 {
729 //elm_widget_element_update(obj, sd->ent, PART_NAME_TEXT);
727 Eina_Strbuf *buf = eina_strbuf_new(); 730 Eina_Strbuf *buf = eina_strbuf_new();
728 eina_strbuf_append_printf(buf, "spin_button/%s", elm_widget_style_get(obj)); 731 eina_strbuf_append_printf(buf, "spin_button/%s", elm_widget_style_get(obj));
729 elm_widget_style_set(sd->ent, eina_strbuf_string_get(buf)); 732 elm_widget_style_set(sd->ent, eina_strbuf_string_get(buf));
@@ -731,56 +734,40 @@ _efl_ui_spin_button_elm_widget_theme_apply(Eo *obj, Efl_Ui_Spin_Button_Data *sd
731 } 734 }
732 735
733 if (sd->inc_button) 736 if (sd->inc_button)
734 { 737 elm_widget_element_update(obj, sd->inc_button, PART_NAME_INC_BUTTON);
735 Eina_Strbuf *buf = eina_strbuf_new();
736 eina_strbuf_append_printf(buf, "spin_button/increase/%s", elm_widget_style_get(obj));
737 elm_widget_style_set(sd->inc_button, eina_strbuf_string_get(buf));
738 eina_strbuf_free(buf);
739 }
740 738
741 if (sd->text_button) 739 if (sd->text_button)
742 { 740 elm_widget_element_update(obj, sd->text_button, PART_NAME_TEXT_BUTTON);
743 Eina_Strbuf *buf = eina_strbuf_new();
744 eina_strbuf_append_printf(buf, "spin_button/%s", elm_widget_style_get(obj));
745 elm_widget_style_set(sd->text_button, eina_strbuf_string_get(buf));
746 eina_strbuf_free(buf);
747 }
748 741
749 if (sd->dec_button) 742 if (sd->dec_button)
750 { 743 elm_widget_element_update(obj, sd->dec_button, PART_NAME_DEC_BUTTON);
751 Eina_Strbuf *buf = eina_strbuf_new();
752 eina_strbuf_append_printf(buf, "spin_button/decrease/%s", elm_widget_style_get(obj));
753 elm_widget_style_set(sd->dec_button, eina_strbuf_string_get(buf));
754 eina_strbuf_free(buf);
755 }
756 744
757 if (_elm_config->access_mode) 745 if (_elm_config->access_mode)
758 _access_spinner_register(obj, EINA_TRUE); 746 _access_spinner_register(obj, EINA_TRUE);
759 747
748 _label_write(obj);
760 elm_layout_sizing_eval(obj); 749 elm_layout_sizing_eval(obj);
761 return EFL_UI_THEME_APPLY_SUCCESS; 750 return EFL_UI_THEME_APPLY_SUCCESS;
762} 751}
763 752
764EOLIAN static Eo * 753EOLIAN static Eo *
765_efl_ui_spin_button_efl_object_finalize(Eo *obj, Efl_Ui_Spin_Button_Data *sd) 754_efl_ui_spin_button_efl_object_constructor(Eo *obj, Efl_Ui_Spin_Button_Data *sd)
766{ 755{
767 obj = efl_finalize(efl_super(obj, MY_CLASS)); 756 if (!elm_widget_theme_klass_get(obj))
757 elm_widget_theme_klass_set(obj, "spin_button");
758 obj = efl_constructor(efl_super(obj, MY_CLASS));
768 759
769 elm_widget_sub_object_parent_add(obj); 760 elm_widget_sub_object_parent_add(obj);
770 761
771 sd->first_interval = 0.85; 762 sd->first_interval = 0.85;
772 763
773 if (!elm_layout_theme_set(obj, "spin_button", "base",
774 elm_widget_style_get(obj)))
775 CRI("Failed to set layout!");
776
777 sd->inc_button = efl_add(EFL_UI_BUTTON_CLASS, obj, 764 sd->inc_button = efl_add(EFL_UI_BUTTON_CLASS, obj,
778 efl_ui_widget_style_set(efl_added, "spinner/increase/default"), 765 elm_widget_element_update(obj, efl_added, PART_NAME_INC_BUTTON),
779 efl_event_callback_array_add(efl_added, _inc_dec_button_cb(), obj), 766 efl_event_callback_array_add(efl_added, _inc_dec_button_cb(), obj),
780 efl_content_set(efl_part(obj, "elm.swallow.inc_button"), efl_added)); 767 efl_content_set(efl_part(obj, "elm.swallow.inc_button"), efl_added));
781 768
782 sd->text_button = efl_add(EFL_UI_BUTTON_CLASS, obj, 769 sd->text_button = efl_add(EFL_UI_BUTTON_CLASS, obj,
783 efl_ui_widget_style_set(efl_added, "spinner/default"), 770 elm_widget_element_update(obj, efl_added, PART_NAME_TEXT_BUTTON),
784 efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED, 771 efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED,
785 _text_button_clicked_cb, obj), 772 _text_button_clicked_cb, obj),
786 efl_event_callback_add(efl_added, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED, 773 efl_event_callback_add(efl_added, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED,
@@ -788,7 +775,7 @@ _efl_ui_spin_button_efl_object_finalize(Eo *obj, Efl_Ui_Spin_Button_Data *sd)
788 efl_content_set(efl_part(obj, "elm.swallow.text_button"), efl_added)); 775 efl_content_set(efl_part(obj, "elm.swallow.text_button"), efl_added));
789 776
790 sd->dec_button = efl_add(EFL_UI_BUTTON_CLASS, obj, 777 sd->dec_button = efl_add(EFL_UI_BUTTON_CLASS, obj,
791 efl_ui_widget_style_set(efl_added, "spinner/decrease/default"), 778 elm_widget_element_update(obj, efl_added, PART_NAME_DEC_BUTTON),
792 efl_event_callback_array_add(efl_added, _inc_dec_button_cb(), obj), 779 efl_event_callback_array_add(efl_added, _inc_dec_button_cb(), obj),
793 efl_content_set(efl_part(obj, "elm.swallow.dec_button"), efl_added)); 780 efl_content_set(efl_part(obj, "elm.swallow.dec_button"), efl_added));
794 781
@@ -805,10 +792,8 @@ _efl_ui_spin_button_efl_object_finalize(Eo *obj, Efl_Ui_Spin_Button_Data *sd)
805 elm_layout_signal_callback_add 792 elm_layout_signal_callback_add
806 (obj, "elm,action,entry,toggle", "*", _entry_toggle_cb, NULL); 793 (obj, "elm,action,entry,toggle", "*", _entry_toggle_cb, NULL);
807 794
808 _label_write(obj);
809 elm_widget_can_focus_set(obj, EINA_TRUE); 795 elm_widget_can_focus_set(obj, EINA_TRUE);
810 796
811 elm_layout_sizing_eval(obj);
812 efl_access_role_set(obj, EFL_ACCESS_ROLE_SPIN_BUTTON); 797 efl_access_role_set(obj, EFL_ACCESS_ROLE_SPIN_BUTTON);
813 798
814 return obj; 799 return obj;
diff --git a/src/lib/elementary/efl_ui_spin_button.eo b/src/lib/elementary/efl_ui_spin_button.eo
index 06c604e574..e12841d838 100644
--- a/src/lib/elementary/efl_ui_spin_button.eo
+++ b/src/lib/elementary/efl_ui_spin_button.eo
@@ -63,7 +63,7 @@ class Efl.Ui.Spin_Button (Efl.Ui.Spin, Efl.Ui.Focus.Composition,
63 } 63 }
64 } 64 }
65 implements { 65 implements {
66 Efl.Object.finalize; 66 Efl.Object.constructor;
67 Elm.Widget.theme_apply; 67 Elm.Widget.theme_apply;
68 Elm.Widget.widget_event; 68 Elm.Widget.widget_event;
69 Elm.Widget.on_focus_update; 69 Elm.Widget.on_focus_update;