summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWoochan Lee <wc0917.lee@samsung.com>2017-11-20 19:12:49 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2017-11-27 19:40:31 +0900
commiteefcb49419af9d0057ba4c03e6c9009a1265e31e (patch)
treeaa4282cd4b8d311d1434a02d6ae86d850ee8bc46
parent31ce5250cb125a5aee98480ba87570e9811c5c54 (diff)
efl_ui_spin: Add new spin and spin_button widgets
Summary: https://phab.enlightenment.org/T5900 Creating base class(efl_ui_spin) to support various shape of spinner. Added button interaction widget efl_ui_spin_button inherited from efl_ui_spin. Test Plan: Add tests in elementary_test. Reviewers: Jaehyun_Cho, woohyun, jpeg, singh.amitesh Subscribers: jenkins, id213sin, cedric, jpeg Differential Revision: https://phab.enlightenment.org/D5424
-rw-r--r--data/elementary/themes/Makefile.am2
-rw-r--r--data/elementary/themes/default.edc2
-rw-r--r--data/elementary/themes/edc/elm/button.edc6
-rw-r--r--data/elementary/themes/edc/elm/entry.edc2
-rw-r--r--data/elementary/themes/edc/elm/spin.edc27
-rw-r--r--data/elementary/themes/edc/elm/spin_button.edc218
-rw-r--r--src/Makefile_Efl.am1
-rw-r--r--src/Makefile_Elementary.am8
-rw-r--r--src/bin/elementary/Makefile.am2
-rw-r--r--src/bin/elementary/test.c4
-rw-r--r--src/bin/elementary/test_flipselector.c8
-rw-r--r--src/bin/elementary/test_ui_spin.c71
-rw-r--r--src/bin/elementary/test_ui_spin_button.c43
-rw-r--r--src/lib/efl/CMakeLists.txt1
-rw-r--r--src/lib/efl/Efl.h1
-rw-r--r--src/lib/efl/interfaces/efl_interfaces_main.c1
-rw-r--r--src/lib/efl/interfaces/efl_ui_range.eo18
-rw-r--r--src/lib/efl/interfaces/efl_ui_spin.eo84
-rw-r--r--src/lib/elementary/Elementary.h2
-rw-r--r--src/lib/elementary/efl_ui_spin.c311
-rw-r--r--src/lib/elementary/efl_ui_spin.eo26
-rw-r--r--src/lib/elementary/efl_ui_spin_button.c922
-rw-r--r--src/lib/elementary/efl_ui_spin_button.eo80
-rw-r--r--src/lib/elementary/efl_ui_spin_button_private.h20
-rw-r--r--src/lib/elementary/efl_ui_spin_private.h29
-rw-r--r--src/lib/elementary/elm_flipselector.c32
-rw-r--r--src/lib/elementary/elm_flipselector.eo43
-rw-r--r--src/lib/elementary/elm_flipselector_legacy.h37
-rw-r--r--src/lib/elementary/elm_spinner.c40
-rw-r--r--src/lib/elementary/elm_spinner.eo33
-rw-r--r--src/lib/elementary/elm_spinner_legacy.h46
31 files changed, 1886 insertions, 234 deletions
diff --git a/data/elementary/themes/Makefile.am b/data/elementary/themes/Makefile.am
index dfe26d5..f1ee7b1 100644
--- a/data/elementary/themes/Makefile.am
+++ b/data/elementary/themes/Makefile.am
@@ -146,6 +146,8 @@ elementary/themes/edc/elm/separator.edc \
146elementary/themes/edc/elm/slider.edc \ 146elementary/themes/edc/elm/slider.edc \
147elementary/themes/edc/elm/slideshow.edc \ 147elementary/themes/edc/elm/slideshow.edc \
148elementary/themes/edc/elm/spinner.edc \ 148elementary/themes/edc/elm/spinner.edc \
149elementary/themes/edc/elm/spin.edc \
150elementary/themes/edc/elm/spin_button.edc \
149elementary/themes/edc/elm/textpath.edc \ 151elementary/themes/edc/elm/textpath.edc \
150elementary/themes/edc/elm/thumb.edc \ 152elementary/themes/edc/elm/thumb.edc \
151elementary/themes/edc/elm/toolbar.edc \ 153elementary/themes/edc/elm/toolbar.edc \
diff --git a/data/elementary/themes/default.edc b/data/elementary/themes/default.edc
index 5e54ffd..9d61529 100644
--- a/data/elementary/themes/default.edc
+++ b/data/elementary/themes/default.edc
@@ -67,6 +67,8 @@ collections {
67#include "edc/elm/border.edc" 67#include "edc/elm/border.edc"
68// XXX: min size calc problems - too wide! ... err ok on my 32bit box... eh? 68// XXX: min size calc problems - too wide! ... err ok on my 32bit box... eh?
69#include "edc/elm/spinner.edc" 69#include "edc/elm/spinner.edc"
70#include "edc/elm/spin.edc"
71#include "edc/elm/spin_button.edc"
70#include "edc/elm/menu.edc" 72#include "edc/elm/menu.edc"
71#include "edc/elm/clock.edc" 73#include "edc/elm/clock.edc"
72#include "edc/elm/gengrid.edc" 74#include "edc/elm/gengrid.edc"
diff --git a/data/elementary/themes/edc/elm/button.edc b/data/elementary/themes/edc/elm/button.edc
index a05260f..c5c48d3 100644
--- a/data/elementary/themes/edc/elm/button.edc
+++ b/data/elementary/themes/edc/elm/button.edc
@@ -1472,6 +1472,7 @@ group { name: "elm/button/base/hoversel_horizontal_entry/default";
1472/******************* SPINNER BUTTONS STYLES **********************/ 1472/******************* SPINNER BUTTONS STYLES **********************/
1473 group { name: "elm/button/base/spinner/increase/default"; 1473 group { name: "elm/button/base/spinner/increase/default";
1474 alias: "elm/button/base/spinner/increase/colorselector/default"; 1474 alias: "elm/button/base/spinner/increase/colorselector/default";
1475 alias: "elm/button/base/spin_button/increase/default";
1475 alias: "elm/button/base/calendar/increase/default"; 1476 alias: "elm/button/base/calendar/increase/default";
1476 alias: "elm/button/base/calendar/increase/double_spinners"; 1477 alias: "elm/button/base/calendar/increase/double_spinners";
1477 images.image: "sym_right_light_normal.png" COMP; 1478 images.image: "sym_right_light_normal.png" COMP;
@@ -1626,6 +1627,7 @@ group { name: "elm/button/base/hoversel_horizontal_entry/default";
1626 group { name: "elm/button/base/spinner/decrease/default"; 1627 group { name: "elm/button/base/spinner/decrease/default";
1627 alias: "elm/button/base/spinner/decrease/colorselector/default"; 1628 alias: "elm/button/base/spinner/decrease/colorselector/default";
1628 inherit: "elm/button/base/spinner/increase/default"; 1629 inherit: "elm/button/base/spinner/increase/default";
1630 alias: "elm/button/base/spin_button/decrease/default";
1629 alias: "elm/button/base/calendar/decrease/default"; 1631 alias: "elm/button/base/calendar/decrease/default";
1630 alias: "elm/button/base/calendar/decrease/double_spinners"; 1632 alias: "elm/button/base/calendar/decrease/double_spinners";
1631 images.image: "sym_left_light_normal.png" COMP; 1633 images.image: "sym_left_light_normal.png" COMP;
@@ -1654,6 +1656,8 @@ group { name: "elm/button/base/hoversel_horizontal_entry/default";
1654 group { name: "elm/button/base/spinner/default"; 1656 group { name: "elm/button/base/spinner/default";
1655 alias: "elm/button/base/spinner/colorselector/default"; 1657 alias: "elm/button/base/spinner/colorselector/default";
1656 alias: "elm/button/base/spinner/vertical"; 1658 alias: "elm/button/base/spinner/vertical";
1659 alias: "elm/button/base/spin_button/default";
1660 alias: "elm/button/base/spin_button/vertical";
1657 parts { 1661 parts {
1658 part { name: "bg"; 1662 part { name: "bg";
1659 type: SPACER; 1663 type: SPACER;
@@ -1730,6 +1734,7 @@ group { name: "elm/button/base/hoversel_horizontal_entry/default";
1730 } 1734 }
1731 group { name: "elm/button/base/spinner/increase/vertical"; 1735 group { name: "elm/button/base/spinner/increase/vertical";
1732 inherit: "elm/button/base/spinner/increase/default"; 1736 inherit: "elm/button/base/spinner/increase/default";
1737 alias: "elm/button/base/spin_button/increase/vertical";
1733 images.image: "sym_up_light_normal.png" COMP; 1738 images.image: "sym_up_light_normal.png" COMP;
1734 images.image: "sym_up_glow_normal.png" COMP; 1739 images.image: "sym_up_glow_normal.png" COMP;
1735 images.image: "sym_up_dark_normal.png" COMP; 1740 images.image: "sym_up_dark_normal.png" COMP;
@@ -1755,6 +1760,7 @@ group { name: "elm/button/base/hoversel_horizontal_entry/default";
1755 1760
1756 group { name: "elm/button/base/spinner/decrease/vertical"; 1761 group { name: "elm/button/base/spinner/decrease/vertical";
1757 inherit: "elm/button/base/spinner/decrease/default"; 1762 inherit: "elm/button/base/spinner/decrease/default";
1763 alias: "elm/button/base/spin_button/decrease/vertical";
1758 images.image: "sym_down_light_normal.png" COMP; 1764 images.image: "sym_down_light_normal.png" COMP;
1759 images.image: "sym_down_glow_normal.png" COMP; 1765 images.image: "sym_down_glow_normal.png" COMP;
1760 images.image: "sym_down_dark_normal.png" COMP; 1766 images.image: "sym_down_dark_normal.png" COMP;
diff --git a/data/elementary/themes/edc/elm/entry.edc b/data/elementary/themes/edc/elm/entry.edc
index 4c43cff..bf881da 100644
--- a/data/elementary/themes/edc/elm/entry.edc
+++ b/data/elementary/themes/edc/elm/entry.edc
@@ -854,6 +854,8 @@ group { name: "elm/entry/base-single/default";
854 854
855group { name: "elm/entry/base-single/spinner/default"; 855group { name: "elm/entry/base-single/spinner/default";
856 alias: "elm/entry/base-single/spinner/vertical"; 856 alias: "elm/entry/base-single/spinner/vertical";
857 alias: "elm/entry/base-single/spin_button/default";
858 alias: "elm/entry/base-single/spin_button/vertical";
857 inherit: "elm/entry/base-single/default"; 859 inherit: "elm/entry/base-single/default";
858 styles { 860 styles {
859 style { name: "entry_single_spinner_style"; 861 style { name: "entry_single_spinner_style";
diff --git a/data/elementary/themes/edc/elm/spin.edc b/data/elementary/themes/edc/elm/spin.edc
new file mode 100644
index 0000000..77cf917
--- /dev/null
+++ b/data/elementary/themes/edc/elm/spin.edc
@@ -0,0 +1,27 @@
1group { name: "elm/spin/base/default";
2 parts {
3 part { name: "bg";
4 type: RECT;
5 scale: 1;
6 description { state: "default" 0.0;
7 color: 0 0 0 0;
8 }
9 }
10 part { name: "elm.text";
11 type: TEXT;
12 mouse_events: 0;
13 scale: 1;
14 description { state: "default" 0.0;
15 color: FN_COL_DEFAULT;
16 text {
17 font: FNBD;
18 size: 10;
19 min: 1 1;
20 ellipsis: -1;
21 align: 0.5 0.5;
22 }
23 rel.to: "bg";
24 }
25 }
26 }
27}
diff --git a/data/elementary/themes/edc/elm/spin_button.edc b/data/elementary/themes/edc/elm/spin_button.edc
new file mode 100644
index 0000000..5b53382
--- /dev/null
+++ b/data/elementary/themes/edc/elm/spin_button.edc
@@ -0,0 +1,218 @@
1group { name: "elm/spin_button/base/default";
2 images.image: "vert_bar_inset.png" COMP;
3 parts {
4 part { name: "clip"; type: RECT;
5 description { state: "default" 0.0;
6 rel1.to: "elm.swallow.text_button";
7 rel2.to: "elm.swallow.text_button";
8 }
9 }
10 part { name: "bg";
11 type: RECT;
12 scale: 1;
13 description { state: "default" 0.0;
14 color_class: "spinner_bg";
15 }
16 }
17 part { name: "inset"; mouse_events: 0;
18 description { state: "default" 0.0;
19 rel1.offset: 0 1;
20 rel2.offset: -1 -2;
21 image.normal: "vert_bar_inset.png";
22 image.border: 1 1 8 6;
23 image.middle: 0;
24 fill.smooth: 0;
25 }
26 }
27 part { name: "access";
28 type: RECT;
29 repeat_events: 1;
30 description { state: "default" 0.0;
31 fixed: 1 1;
32 color: 0 0 0 0;
33 rel1.to: "inset";
34 rel2.to: "inset";
35 visible: 0;
36 }
37 description { state: "active" 0.0;
38 inherit: "default" 0.0;
39 visible: 1;
40 }
41 }
42 part { name: "elm.swallow.entry";
43 type: SWALLOW;
44 clip_to: "clip";
45 description { state: "default" 0.0;
46 fixed: 1 1;
47 rel1.to: "elm.swallow.text_button";
48 rel2.to: "elm.swallow.text_button";
49 visible: 0;
50 }
51 description { state: "active" 0.0;
52 inherit: "default" 0.0;
53 visible: 1;
54 }
55 }
56 part { name: "elm.swallow.dec_button";
57 type: SWALLOW;
58 scale: 1;
59 description { state: "default" 0.0;
60 fixed: 1 0;
61 rel1.to: "inset";
62 rel1.offset: 1 1;
63 rel2.to: "inset";
64 rel2.offset: 1 -2;
65 rel2.relative: 0.0 1.0;
66 align: 0.0 0.5;
67 min: 15 15;
68 aspect: 1.0 1.0; aspect_preference: VERTICAL;
69 }
70 }
71 part { name: "elm.swallow.inc_button";
72 type: SWALLOW;
73 scale: 1;
74 description { state: "default" 0.0;
75 fixed: 1 0;
76 rel1.to: "inset";
77 rel1.offset: 1 1;
78 rel1.relative: 1.0 0.0;
79 rel2.to: "inset";
80 rel2.offset: 1 -2;
81 align: 1.0 0.5;
82 min: 15 15;
83 aspect: 1.0 1.0; aspect_preference: VERTICAL;
84 }
85 }
86 part { name: "elm.swallow.text_button";
87 type: SWALLOW;
88 scale: 1;
89 description { state: "default" 0.0;
90 visible: 1;
91 rel1.to_y: "inset";
92 rel1.to_x: "elm.swallow.dec_button";
93 rel1.relative: 1.0 0.0;
94 rel1.offset: 1 1;
95 rel2.to_y: "inset";
96 rel2.to_x: "elm.swallow.inc_button";
97 rel2.relative: 0.0 1.0;
98 rel2.offset: -2 -2;
99 }
100 description { state: "inactive" 0.0;
101 inherit: "default" 0.0;
102 visible: 0;
103 }
104 }
105 part { name: "disabler";
106 type: RECT;
107 repeat_events: 0;
108 mouse_events: 0;
109 description { state: "default" 0.0;
110 color: 0 0 0 0;
111 visible: 0;
112 }
113 description { state: "disabled" 0.0;
114 inherit: "default" 0.0;
115 visible: 1;
116 }
117 }
118 }
119 programs {
120 program { name: "entry_active";
121 signal: "elm,state,entry,active";
122 source: "elm";
123 action: STATE_SET "active" 0.0;
124 target: "elm.swallow.entry";
125 }
126 program { name: "entry_inactive";
127 signal: "elm,state,entry,inactive";
128 source: "elm";
129 action: STATE_SET "default" 0.0;
130 target: "elm.swallow.entry";
131 }
132 program { name: "text_button_active";
133 signal: "elm,state,button,active";
134 source: "elm";
135 action: STATE_SET "default" 0.0;
136 target: "elm.swallow.text_button";
137 }
138 program { name: "text_button_inactive";
139 signal: "elm,state,button,inactive";
140 source: "elm";
141 action: STATE_SET "inactive" 0.0;
142 target: "elm.swallow.text_button";
143 }
144 program { name: "access_activate";
145 signal: "elm,state,access,active";
146 source: "elm";
147 action: STATE_SET "active" 0.0;
148 target: "access";
149 }
150 program { name: "access_inactivate";
151 signal: "elm,state,access,inactive";
152 source: "elm";
153 action: STATE_SET "default" 0.0;
154 target: "access";
155 }
156 program { name: "disable";
157 signal: "elm,state,disabled";
158 source: "elm";
159 action: STATE_SET "disabled" 0.0;
160 target: "disabler";
161 }
162 program { name: "enable";
163 signal: "elm,state,enabled";
164 source: "elm";
165 action: STATE_SET "default" 0.0;
166 target: "disabler";
167 }
168 }
169}
170
171group { name: "elm/spin_button/base/vertical";
172 inherit: "elm/spin_button/base/default";
173 parts {
174 part { name: "elm.swallow.inc_button";
175 type: SWALLOW;
176 scale: 1;
177 description { state: "default" 0.0;
178 rel1.to: "inset";
179 rel1.offset: 1 1;
180 rel1.relative: 1.0 0.0;
181 rel2.to: "inset";
182 rel2.offset: 1 -2;
183 align: 1.0 0.5;
184 }
185 }
186 part { name: "elm.swallow.text_button";
187 type: SWALLOW;
188 scale: 1;
189 description { state: "default" 0.0;
190 visible: 1;
191 rel1.to_y: "inset";
192 rel1.to_x: "elm.swallow.dec_button";
193 rel1.relative: 1.0 0.0;
194 rel1.offset: 1 1;
195 rel2.to_y: "inset";
196 rel2.to_x: "elm.swallow.inc_button";
197 rel2.relative: 0.0 1.0;
198 rel2.offset: -2 -2;
199 }
200 description { state: "active" 0.0;
201 inherit: "default" 0.0;
202 visible: 0;
203 }
204 }
205 part { name: "elm.swallow.dec_button";
206 type: SWALLOW;
207 scale: 1;
208 description { state: "default" 0.0;
209 rel1.to: "inset";
210 rel1.offset: 1 1;
211 rel2.to: "inset";
212 rel2.offset: 1 -2;
213 rel2.relative: 0.0 1.0;
214 align: 0.0 0.5;
215 }
216 }
217 }
218}
diff --git a/src/Makefile_Efl.am b/src/Makefile_Efl.am
index 39c7330..769abd6 100644
--- a/src/Makefile_Efl.am
+++ b/src/Makefile_Efl.am
@@ -57,7 +57,6 @@ efl_eolian_files = \
57 lib/efl/interfaces/efl_ui_base.eo \ 57 lib/efl/interfaces/efl_ui_base.eo \
58 lib/efl/interfaces/efl_ui_direction.eo \ 58 lib/efl/interfaces/efl_ui_direction.eo \
59 lib/efl/interfaces/efl_ui_drag.eo \ 59 lib/efl/interfaces/efl_ui_drag.eo \
60 lib/efl/interfaces/efl_ui_spin.eo \
61 lib/efl/interfaces/efl_ui_range.eo \ 60 lib/efl/interfaces/efl_ui_range.eo \
62 lib/efl/interfaces/efl_ui_view.eo \ 61 lib/efl/interfaces/efl_ui_view.eo \
63 lib/efl/interfaces/efl_ui_model_connect.eo \ 62 lib/efl/interfaces/efl_ui_model_connect.eo \
diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index be45275..3950d11 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -20,6 +20,8 @@ elm_public_eolian_files = \
20 lib/elementary/efl_ui_radio.eo \ 20 lib/elementary/efl_ui_radio.eo \
21 lib/elementary/efl_ui_slider.eo \ 21 lib/elementary/efl_ui_slider.eo \
22 lib/elementary/efl_ui_slider_interval.eo \ 22 lib/elementary/efl_ui_slider_interval.eo \
23 lib/elementary/efl_ui_spin.eo \
24 lib/elementary/efl_ui_spin_button.eo \
23 lib/elementary/efl_ui_video.eo \ 25 lib/elementary/efl_ui_video.eo \
24 lib/elementary/efl_ui_win.eo \ 26 lib/elementary/efl_ui_win.eo \
25 lib/elementary/efl_ui_win_inlined.eo \ 27 lib/elementary/efl_ui_win_inlined.eo \
@@ -311,6 +313,8 @@ includesunstable_HEADERS = \
311 lib/elementary/efl_ui_slider_private.h \ 313 lib/elementary/efl_ui_slider_private.h \
312 lib/elementary/elm_widget_slideshow.h \ 314 lib/elementary/elm_widget_slideshow.h \
313 lib/elementary/elm_widget_spinner.h \ 315 lib/elementary/elm_widget_spinner.h \
316 lib/elementary/efl_ui_spin_private.h \
317 lib/elementary/efl_ui_spin_button_private.h \
314 lib/elementary/elm_widget_table.h \ 318 lib/elementary/elm_widget_table.h \
315 lib/elementary/elm_widget_thumb.h \ 319 lib/elementary/elm_widget_thumb.h \
316 lib/elementary/elm_widget_toolbar.h \ 320 lib/elementary/elm_widget_toolbar.h \
@@ -656,6 +660,8 @@ lib_elementary_libelementary_la_SOURCES = \
656 lib/elementary/elm_separator.c \ 660 lib/elementary/elm_separator.c \
657 lib/elementary/efl_ui_slider.c \ 661 lib/elementary/efl_ui_slider.c \
658 lib/elementary/efl_ui_slider_interval.c \ 662 lib/elementary/efl_ui_slider_interval.c \
663 lib/elementary/efl_ui_spin.c \
664 lib/elementary/efl_ui_spin_button.c \
659 lib/elementary/elm_slideshow.c \ 665 lib/elementary/elm_slideshow.c \
660 lib/elementary/elm_spinner.c \ 666 lib/elementary/elm_spinner.c \
661 lib/elementary/elm_store.c \ 667 lib/elementary/elm_store.c \
@@ -877,6 +883,8 @@ bin/elementary/test_segment_control.c \
877bin/elementary/test_separator.c \ 883bin/elementary/test_separator.c \
878bin/elementary/test_slider.c \ 884bin/elementary/test_slider.c \
879bin/elementary/test_ui_slider_interval.c \ 885bin/elementary/test_ui_slider_interval.c \
886bin/elementary/test_ui_spin.c \
887bin/elementary/test_ui_spin_button.c \
880bin/elementary/test_slideshow.c \ 888bin/elementary/test_slideshow.c \
881bin/elementary/test_spinner.c \ 889bin/elementary/test_spinner.c \
882bin/elementary/test_store.c \ 890bin/elementary/test_store.c \
diff --git a/src/bin/elementary/Makefile.am b/src/bin/elementary/Makefile.am
index 0ce67b0..8f2a810 100644
--- a/src/bin/elementary/Makefile.am
+++ b/src/bin/elementary/Makefile.am
@@ -128,6 +128,8 @@ test_slider.c \
128test_ui_slider_interval.c \ 128test_ui_slider_interval.c \
129test_slideshow.c \ 129test_slideshow.c \
130test_spinner.c \ 130test_spinner.c \
131test_ui_spinner.c \
132test_ui_buttonspin.c \
131test_store.c \ 133test_store.c \
132test_sys_notify.c \ 134test_sys_notify.c \
133test_systray.c \ 135test_systray.c \
diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c
index c4f5e9b..68201b2 100644
--- a/src/bin/elementary/test.c
+++ b/src/bin/elementary/test.c
@@ -176,6 +176,8 @@ void test_scroller3(void *data, Evas_Object *obj, void *event_info);
176void test_scroller4(void *data, Evas_Object *obj, void *event_info); 176void test_scroller4(void *data, Evas_Object *obj, void *event_info);
177void test_scroller5(void *data, Evas_Object *obj, void *event_info); 177void test_scroller5(void *data, Evas_Object *obj, void *event_info);
178void test_spinner(void *data, Evas_Object *obj, void *event_info); 178void test_spinner(void *data, Evas_Object *obj, void *event_info);
179void test_ui_spin(void *data, Evas_Object *obj, void *event_info);
180void test_ui_spin_button(void *data, Evas_Object *obj, void *event_info);
179void test_index(void *data, Evas_Object *obj, void *event_info); 181void test_index(void *data, Evas_Object *obj, void *event_info);
180void test_index2(void *data, Evas_Object *obj, void *event_info); 182void test_index2(void *data, Evas_Object *obj, void *event_info);
181void test_index3(void *data, Evas_Object *obj, void *event_info); 183void test_index3(void *data, Evas_Object *obj, void *event_info);
@@ -1016,6 +1018,8 @@ add_tests:
1016 1018
1017 //------------------------------// 1019 //------------------------------//
1018 ADD_TEST(NULL, "Range Values", "Spinner", test_spinner); 1020 ADD_TEST(NULL, "Range Values", "Spinner", test_spinner);
1021 ADD_TEST(NULL, "Range Values", "Ui.Spin", test_ui_spin);
1022 ADD_TEST(NULL, "Range Values", "Ui.Spin.Button", test_ui_spin_button);
1019 ADD_TEST(NULL, "Range Values", "Slider", test_slider); 1023 ADD_TEST(NULL, "Range Values", "Slider", test_slider);
1020 ADD_TEST(NULL, "Range Values", "Progressbar", test_progressbar); 1024 ADD_TEST(NULL, "Range Values", "Progressbar", test_progressbar);
1021 ADD_TEST(NULL, "Range Values", "Progressbar 2", test_progressbar2); 1025 ADD_TEST(NULL, "Range Values", "Progressbar 2", test_progressbar2);
diff --git a/src/bin/elementary/test_flipselector.c b/src/bin/elementary/test_flipselector.c
index b9cd936..13216bd 100644
--- a/src/bin/elementary/test_flipselector.c
+++ b/src/bin/elementary/test_flipselector.c
@@ -186,10 +186,10 @@ test_flipselector(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *ev
186 186
187 fpd = elm_flipselector_add(bx); 187 fpd = elm_flipselector_add(bx);
188 evas_object_size_hint_weight_set(fpd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 188 evas_object_size_hint_weight_set(fpd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
189 efl_ui_spin_step_set(fpd, 1.5); 189 efl_ui_range_step_set(fpd, 1.5);
190 efl_ui_spin_min_max_set(fpd, 2.3, 10.1); 190 efl_ui_range_min_max_set(fpd, 2.3, 10.1);
191 efl_ui_spin_value_set(fpd, 5.3); 191 efl_ui_range_value_set(fpd, 5.3);
192 printf("Current value is %f\n", efl_ui_spin_value_get(fpd)); 192 printf("Current value is %f\n", efl_ui_range_value_get(fpd));
193 elm_box_pack_end(bx, fpd); 193 elm_box_pack_end(bx, fpd);
194 evas_object_show(fpd); 194 evas_object_show(fpd);
195 195
diff --git a/src/bin/elementary/test_ui_spin.c b/src/bin/elementary/test_ui_spin.c
new file mode 100644
index 0000000..be41b75
--- /dev/null
+++ b/src/bin/elementary/test_ui_spin.c
@@ -0,0 +1,71 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4#include <Elementary.h>
5
6static void
7_spin_changed_cb(void *data EINA_UNUSED, const Efl_Event *ev)
8{
9 printf("Value changed %d\n", (int)efl_ui_range_value_get(ev->object));
10}
11static void
12_spin_min_reached_cb(void *data EINA_UNUSED, const Efl_Event *ev)
13{
14 printf("Min reached %d\n", (int)efl_ui_range_value_get(ev->object));
15}
16static void
17_spin_max_reached_cb(void *data EINA_UNUSED, const Efl_Event *ev)
18{
19 printf("Max reached %d\n", (int)efl_ui_range_value_get(ev->object));
20}
21
22static void
23_inc_clicked(void *data, const Efl_Event *ev EINA_UNUSED)
24{
25 int val = (int)efl_ui_range_value_get(data);
26 efl_ui_range_value_set(data, ++val);
27}
28
29static void
30_dec_clicked(void *data, const Efl_Event *ev EINA_UNUSED)
31{
32 int val = (int)efl_ui_range_value_get(data);
33 efl_ui_range_value_set(data, --val);
34}
35
36void
37test_ui_spin(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
38{
39 Eo *win, *bx, *sp;
40
41 win = efl_add(EFL_UI_WIN_CLASS, NULL,
42 efl_ui_win_type_set(efl_added, EFL_UI_WIN_BASIC),
43 efl_text_set(efl_added, "Efl.Ui.Spin"),
44 efl_ui_win_autodel_set(efl_added, EINA_TRUE));
45
46 bx = efl_add(EFL_UI_BOX_CLASS, win,
47 efl_content_set(win, efl_added),
48 efl_ui_direction_set(efl_added, EFL_UI_DIR_DOWN));
49
50 sp = efl_add(EFL_UI_SPIN_CLASS, bx,
51 efl_ui_range_min_max_set(efl_added, 0, 10),
52 efl_ui_range_value_set(efl_added, 6),
53 efl_ui_range_step_set(efl_added, 2),
54 efl_ui_format_string_set(efl_added, "test %d"),
55 efl_event_callback_add(efl_added, EFL_UI_SPIN_EVENT_CHANGED,_spin_changed_cb, NULL),
56 efl_event_callback_add(efl_added, EFL_UI_SPIN_EVENT_MIN_REACHED,_spin_min_reached_cb, NULL),
57 efl_event_callback_add(efl_added, EFL_UI_SPIN_EVENT_MAX_REACHED,_spin_max_reached_cb, NULL),
58 efl_pack(bx, efl_added));
59
60 efl_add(EFL_UI_BUTTON_CLASS, bx,
61 efl_text_set(efl_added, "Increse Spinner value"),
62 efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED, _inc_clicked, sp),
63 efl_pack(bx, efl_added));
64
65 efl_add(EFL_UI_BUTTON_CLASS, bx,
66 efl_text_set(efl_added, "Decrease Spinner value"),
67 efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED, _dec_clicked, sp),
68 efl_pack(bx, efl_added));
69
70 efl_gfx_size_set(win, EINA_SIZE2D(100, 80));
71}
diff --git a/src/bin/elementary/test_ui_spin_button.c b/src/bin/elementary/test_ui_spin_button.c
new file mode 100644
index 0000000..e973072
--- /dev/null
+++ b/src/bin/elementary/test_ui_spin_button.c
@@ -0,0 +1,43 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4#include <Elementary.h>
5
6static void
7_spin_delay_changed_cb(void *data EINA_UNUSED, const Efl_Event *ev)
8{
9 printf("Value delay changed %d\n", (int)efl_ui_range_value_get(ev->object));
10}
11
12void
13test_ui_spin_button(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
14{
15 Eo *win, *bx;
16
17 win = efl_add(EFL_UI_WIN_CLASS, NULL,
18 efl_ui_win_type_set(efl_added, EFL_UI_WIN_BASIC),
19 efl_text_set(efl_added, "Efl.Ui.Spin_Button"),
20 efl_ui_win_autodel_set(efl_added, EINA_TRUE));
21
22 bx = efl_add(EFL_UI_BOX_CLASS, win,
23 efl_content_set(win, efl_added),
24 efl_ui_direction_set(efl_added, EFL_UI_DIR_DOWN));
25
26 efl_add(EFL_UI_SPIN_BUTTON_CLASS, bx,
27 efl_ui_range_min_max_set(efl_added, 0, 10),
28 efl_ui_range_value_set(efl_added, 6),
29 efl_ui_range_step_set(efl_added, 2),
30 efl_ui_spin_button_loop_set(efl_added, EINA_TRUE),
31 efl_ui_spin_button_editable_set(efl_added, EINA_TRUE),
32 efl_event_callback_add(efl_added, EFL_UI_SPIN_BUTTON_EVENT_DELAY_CHANGED,_spin_delay_changed_cb, NULL),
33 efl_pack(bx, efl_added));
34
35 efl_add(EFL_UI_SPIN_BUTTON_CLASS, bx,
36 efl_ui_range_min_max_set(efl_added, -100.0, 100.0),
37 efl_ui_range_value_set(efl_added, 0),
38 efl_ui_format_string_set(efl_added, "test float %0.2f"),
39 efl_ui_spin_button_editable_set(efl_added, EINA_FALSE),
40 efl_pack(bx, efl_added));
41
42 efl_gfx_size_set(win, EINA_SIZE2D(180, 100));
43}
diff --git a/src/lib/efl/CMakeLists.txt b/src/lib/efl/CMakeLists.txt
index af3c443..6637bed 100644
--- a/src/lib/efl/CMakeLists.txt
+++ b/src/lib/efl/CMakeLists.txt
@@ -54,7 +54,6 @@ set(PUBLIC_EO_FILES
54 interfaces/efl_ui_item.eo 54 interfaces/efl_ui_item.eo
55 interfaces/efl_ui_menu.eo 55 interfaces/efl_ui_menu.eo
56 interfaces/efl_ui_range.eo 56 interfaces/efl_ui_range.eo
57 interfaces/efl_ui_spin.eo
58 interfaces/efl_ui_autorepeat.eo 57 interfaces/efl_ui_autorepeat.eo
59 interfaces/efl_vpath.eo 58 interfaces/efl_vpath.eo
60 interfaces/efl_vpath_core.eo 59 interfaces/efl_vpath_core.eo
diff --git a/src/lib/efl/Efl.h b/src/lib/efl/Efl.h
index 8e1c6a6..683745f 100644
--- a/src/lib/efl/Efl.h
+++ b/src/lib/efl/Efl.h
@@ -90,7 +90,6 @@ typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command;
90#include "interfaces/efl_ui_base.eo.h" 90#include "interfaces/efl_ui_base.eo.h"
91#include "interfaces/efl_ui_direction.eo.h" 91#include "interfaces/efl_ui_direction.eo.h"
92#include "interfaces/efl_ui_drag.eo.h" 92#include "interfaces/efl_ui_drag.eo.h"
93#include "interfaces/efl_ui_spin.eo.h"
94#include "interfaces/efl_ui_range.eo.h" 93#include "interfaces/efl_ui_range.eo.h"
95#include "interfaces/efl_ui_item.eo.h" 94#include "interfaces/efl_ui_item.eo.h"
96#include "interfaces/efl_ui_menu.eo.h" 95#include "interfaces/efl_ui_menu.eo.h"
diff --git a/src/lib/efl/interfaces/efl_interfaces_main.c b/src/lib/efl/interfaces/efl_interfaces_main.c
index 5ebf073..e3b4e56 100644
--- a/src/lib/efl/interfaces/efl_interfaces_main.c
+++ b/src/lib/efl/interfaces/efl_interfaces_main.c
@@ -58,7 +58,6 @@
58#include "interfaces/efl_ui_base.eo.c" 58#include "interfaces/efl_ui_base.eo.c"
59#include "interfaces/efl_ui_direction.eo.c" 59#include "interfaces/efl_ui_direction.eo.c"
60#include "interfaces/efl_ui_drag.eo.c" 60#include "interfaces/efl_ui_drag.eo.c"
61#include "interfaces/efl_ui_spin.eo.c"
62#include "interfaces/efl_ui_range.eo.c" 61#include "interfaces/efl_ui_range.eo.c"
63#include "interfaces/efl_ui_menu.eo.c" 62#include "interfaces/efl_ui_menu.eo.c"
64#include "interfaces/efl_ui_autorepeat.eo.c" 63#include "interfaces/efl_ui_autorepeat.eo.c"
diff --git a/src/lib/efl/interfaces/efl_ui_range.eo b/src/lib/efl/interfaces/efl_ui_range.eo
index a13ce57..56d4f89 100644
--- a/src/lib/efl/interfaces/efl_ui_range.eo
+++ b/src/lib/efl/interfaces/efl_ui_range.eo
@@ -28,7 +28,7 @@ interface Efl.Ui.Range
28 If it is bigger then $max, will be updated to $max. Actual value 28 If it is bigger then $max, will be updated to $max. Actual value
29 can be get with @Efl.Ui.Range.range_value.get 29 can be get with @Efl.Ui.Range.range_value.get
30 30
31 By default, min is equal to 0.0, and max is equal to 1.0. 31 The minimum and maximum values may be different for each class.
32 32
33 Warning: maximum must be greater than minimum, otherwise behavior 33 Warning: maximum must be greater than minimum, otherwise behavior
34 is undefined. 34 is undefined.
@@ -46,5 +46,21 @@ interface Efl.Ui.Range
46 max: double; [[The maximum value.]] 46 max: double; [[The maximum value.]]
47 } 47 }
48 } 48 }
49 @property range_step {
50 [[Control the step used to increment or decrement values for given widget.
51
52 This value will be incremented or decremented to the displayed value.
53
54 By default step value is equal to 1.
55
56 Warning: The step value should be bigger than 0.]]
57 set {
58 }
59 get {
60 }
61 values {
62 step: double; [[The step value.]]
63 }
64 }
49 } 65 }
50} 66}
diff --git a/src/lib/efl/interfaces/efl_ui_spin.eo b/src/lib/efl/interfaces/efl_ui_spin.eo
deleted file mode 100644
index bfeca2b..0000000
--- a/src/lib/efl/interfaces/efl_ui_spin.eo
+++ /dev/null
@@ -1,84 +0,0 @@
1interface Efl.Ui.Spin()
2{
3 [[Efl UI spinner interface]]
4 methods {
5 @property min_max {
6 [[Control the minimum and maximum values for the spinner.
7
8 Define the allowed range of values to be selected by the user.
9
10 If actual value is less than $min, it will be updated to $min. If it
11 is bigger then $max, will be updated to $max.
12
13 By default, min is equal to 0, and max is equal to 100.
14
15 Warning: Maximum must be greater than minimum.]]
16 set {
17 }
18 get {
19 }
20 values {
21 min: double; [[The minimum value.]]
22 max: double; [[The maximum value.]]
23 }
24 }
25 @property step {
26 [[Control the step used to increment or decrement the spinner value.
27
28 This value will be incremented or decremented to the displayed value.
29 It will be incremented while the user keep right or top arrow pressed,
30 and will be decremented while the user keep left or bottom arrow pressed.
31
32 The interval to increment / decrement can be set with @.interval.set.
33
34 By default step value is equal to 1.]]
35 set {
36 }
37 get {
38 }
39 values {
40 step: double; [[The step value.]]
41 }
42 }
43 @property value {
44 [[Control the value the spinner displays.
45
46 Value will be presented on the label following format specified with
47 elm_spinner_format_set().
48
49 Warning The value must to be between min and max values. This values
50 are set by elm_spinner_min_max_set().]]
51 set {
52 }
53 get {
54 }
55 values {
56 val: double; [[The value to be displayed.]]
57 }
58 }
59 @property interval {
60 [[Control the interval on time updates for an user mouse button hold on spinner widgets' arrows.
61
62 This interval value is decreased while the user holds the
63 mouse pointer either incrementing or decrementing spinner's value.
64
65 This helps the user to get to a given value distant from the
66 current one easier/faster, as it will start to change quicker and
67 quicker on mouse button holds.
68
69 The calculation for the next change interval value, starting from
70 the one set with this call, is the previous interval divided by
71 $1.05, so it decreases a little bit.
72
73 The default starting interval value for automatic changes is
74 $0.85 seconds.]]
75 set {
76 }
77 get {
78 }
79 values {
80 interval: double; [[The (first) interval value in seconds.]]
81 }
82 }
83 }
84}
diff --git a/src/lib/elementary/Elementary.h b/src/lib/elementary/Elementary.h
index 431c1e8..64367ca 100644
--- a/src/lib/elementary/Elementary.h
+++ b/src/lib/elementary/Elementary.h
@@ -304,6 +304,8 @@ EAPI extern Elm_Version *elm_version;
304# include <efl_ui_text_editable.eo.h> 304# include <efl_ui_text_editable.eo.h>
305# include <efl_ui_text_async.eo.h> 305# include <efl_ui_text_async.eo.h>
306# include <efl_ui_clock.eo.h> 306# include <efl_ui_clock.eo.h>
307# include <efl_ui_spin.eo.h>
308# include <efl_ui_spin_button.eo.h>
307# include <efl_ui_image_factory.eo.h> 309# include <efl_ui_image_factory.eo.h>
308#endif 310#endif
309 311
diff --git a/src/lib/elementary/efl_ui_spin.c b/src/lib/elementary/efl_ui_spin.c
new file mode 100644
index 0000000..13dbadc
--- /dev/null
+++ b/src/lib/elementary/efl_ui_spin.c
@@ -0,0 +1,311 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#define EFL_ACCESS_PROTECTED
6#define EFL_ACCESS_VALUE_PROTECTED
7#define EFL_ACCESS_WIDGET_ACTION_PROTECTED
8
9#include <Elementary.h>
10
11#include "elm_priv.h"
12#include "efl_ui_spin_private.h"
13
14#define MY_CLASS EFL_UI_SPIN_CLASS
15
16#define MY_CLASS_NAME "Efl.Ui.Spin"
17
18static Eina_Bool
19_is_valid_digit(char x)
20{
21 return ((x >= '0' && x <= '9') || (x == '.')) ? EINA_TRUE : EINA_FALSE;
22}
23
24static Efl_Ui_Spin_Format_Type
25_is_label_format_integer(const char *fmt)
26{
27 const char *itr = NULL;
28 const char *start = NULL;
29 Eina_Bool found = EINA_FALSE;
30 Efl_Ui_Spin_Format_Type ret_type = SPIN_FORMAT_INVALID;
31
32 start = strchr(fmt, '%');
33 if (!start) return SPIN_FORMAT_INVALID;
34
35 while (start)
36 {
37 if (found && start[1] != '%')
38 {
39 return SPIN_FORMAT_INVALID;
40 }
41
42 if (start[1] != '%' && !found)
43 {
44 found = EINA_TRUE;
45 for (itr = start + 1; *itr != '\0'; itr++)
46 {
47 if ((*itr == 'd') || (*itr == 'u') || (*itr == 'i') ||
48 (*itr == 'o') || (*itr == 'x') || (*itr == 'X'))
49 {
50 ret_type = SPIN_FORMAT_INT;
51 break;
52 }
53 else if ((*itr == 'f') || (*itr == 'F'))
54 {
55 ret_type = SPIN_FORMAT_FLOAT;
56 break;
57 }
58 else if (_is_valid_digit(*itr))
59 {
60 continue;
61 }
62 else
63 {
64 return SPIN_FORMAT_INVALID;
65 }
66 }
67 }
68 start = strchr(start + 2, '%');
69 }
70
71 return ret_type;
72}
73static void
74_label_write(Evas_Object *obj)
75{
76 Efl_Ui_Spin_Data *sd = efl_data_scope_get(obj, MY_CLASS);
77
78 if (sd->format_cb)
79 {
80 const char *buf;
81 Eina_Value val;
82
83 if (sd->format_type == SPIN_FORMAT_INT)
84 {
85 eina_value_setup(&val, EINA_VALUE_TYPE_INT);
86 eina_value_set(&val, (int)sd->val);
87 }
88 else
89 {
90 eina_value_setup(&val, EINA_VALUE_TYPE_DOUBLE);
91 eina_value_set(&val, sd->val);
92 }
93 eina_strbuf_reset(sd->format_strbuf);
94 sd->format_cb(sd->format_cb_data, sd->format_strbuf, val);
95
96 buf = eina_strbuf_string_get(sd->format_strbuf);
97 eina_value_flush(&val);
98 elm_layout_text_set(obj, "elm.text", buf);
99 sd->templates = buf;
100 }
101 else
102 {
103 char buf[1024];
104 snprintf(buf, sizeof(buf), "%.0f", sd->val);
105 elm_layout_text_set(obj, "elm.text", buf);
106 }
107}
108
109static int
110_decimal_points_get(const char *label)
111{
112 char result[16] = "0";
113 const char *start = strchr(label, '%');
114
115 while (start)
116 {
117 if (start[1] != '%')
118 {
119 start = strchr(start, '.');
120 if (start)
121 start++;
122 break;
123 }
124 else
125 start = strchr(start + 2, '%');
126 }
127
128 if (start)
129 {
130 const char *p = strchr(start, 'f');
131
132 if ((p) && ((p - start) < 15))
133 sscanf(start, "%[^f]", result);
134 }
135
136 return atoi(result);
137}
138
139EOLIAN static void
140_efl_ui_spin_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Spin_Data *_pd EINA_UNUSED)
141{
142 Evas_Coord minw = -1, minh = -1;
143 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
144
145 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
146 edje_object_size_min_restricted_calc
147 (wd->resize_obj, &minw, &minh, minw, minh);
148 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
149 evas_object_size_hint_min_set(obj, minw, minh);
150 evas_object_size_hint_max_set(obj, -1, -1);
151}
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 Eo *
167_efl_ui_spin_efl_object_constructor(Eo *obj, Efl_Ui_Spin_Data *sd)
168{
169 obj = efl_constructor(efl_super(obj, MY_CLASS));
170
171 elm_widget_sub_object_parent_add(obj);
172
173 sd->val_max = 100.0;
174 sd->step = 1.0;
175
176 if (!elm_layout_theme_set(obj, "spin", "base",
177 elm_widget_style_get(obj)))
178 CRI("Failed to set layout!");
179
180 _label_write(obj);
181 elm_widget_can_focus_set(obj, EINA_TRUE);
182
183 elm_layout_sizing_eval(obj);
184
185 return obj;
186}
187
188EOLIAN static Eo *
189_efl_ui_spin_efl_object_finalize(Eo *obj, Efl_Ui_Spin_Data *sd EINA_UNUSED)
190{
191 obj = efl_finalize(efl_super(obj, MY_CLASS));
192
193 return obj;
194}
195
196EOLIAN static void
197_efl_ui_spin_efl_object_destructor(Eo *obj, Efl_Ui_Spin_Data *sd EINA_UNUSED)
198{
199 efl_ui_format_cb_set(obj, NULL, NULL, NULL);
200 efl_destructor(efl_super(obj, MY_CLASS));
201}
202
203EOLIAN static void
204_efl_ui_spin_efl_ui_format_format_cb_set(Eo *obj, Efl_Ui_Spin_Data *sd, void *func_data, Efl_Ui_Format_Func_Cb func, Eina_Free_Cb func_free_cb)
205{
206 if (sd->format_cb_data == func_data && sd->format_cb == func)
207 return;
208
209 if (sd->format_cb_data && sd->format_free_cb)
210 sd->format_free_cb(sd->format_cb_data);
211
212 sd->format_cb = func;
213 sd->format_cb_data = func_data;
214 sd->format_free_cb = func_free_cb;
215 if (!sd->format_strbuf) sd->format_strbuf = eina_strbuf_new();
216
217 const char *format = efl_ui_format_string_get(obj);
218 if (format)
219 {
220 sd->format_type = _is_label_format_integer(format);
221 if (sd->format_type == SPIN_FORMAT_INVALID)
222 {
223 ERR("format:\"%s\" is invalid, cannot be set", format);
224 return;
225 }
226 else if (sd->format_type == SPIN_FORMAT_FLOAT)
227 sd->decimal_points = _decimal_points_get(format);
228 }
229
230 _label_write(obj);
231 elm_layout_sizing_eval(obj);
232}
233
234EOLIAN static void
235_efl_ui_spin_efl_ui_range_range_min_max_set(Eo *obj, Efl_Ui_Spin_Data *sd, double min, double max)
236{
237 if (max < min)
238 {
239 ERR("Wrong params. min(%lf) is bigger than max(%lf). It will swaped.", min, max);
240 double t = min;
241 min = max;
242 max = t;
243 }
244 if ((EINA_DBL_EQ(sd->val_min, min)) && (EINA_DBL_EQ(sd->val_max, max))) return;
245
246 sd->val_min = min;
247 sd->val_max = max;
248
249 if (sd->val < sd->val_min) sd->val = sd->val_min;
250 if (sd->val > sd->val_max) sd->val = sd->val_max;
251
252 _label_write(obj);
253}
254
255EOLIAN static void
256_efl_ui_spin_efl_ui_range_range_min_max_get(Eo *obj EINA_UNUSED, Efl_Ui_Spin_Data *sd, double *min, double *max)
257{
258 if (min) *min = sd->val_min;
259 if (max) *max = sd->val_max;
260}
261
262EOLIAN static void
263_efl_ui_spin_efl_ui_range_range_step_set(Eo *obj EINA_UNUSED, Efl_Ui_Spin_Data *sd, double step)
264{
265 if (step <= 0)
266 {
267 ERR("Wrong param. The step(%lf) should be bigger than 0.0", step);
268 return;
269 }
270
271 sd->step = step;
272}
273
274EOLIAN static double
275_efl_ui_spin_efl_ui_range_range_step_get(Eo *obj EINA_UNUSED, Efl_Ui_Spin_Data *sd)
276{
277 return sd->step;
278}
279
280EOLIAN static void
281_efl_ui_spin_efl_ui_range_range_value_set(Eo *obj, Efl_Ui_Spin_Data *sd, double val)
282{
283 if (val < sd->val_min)
284 val = sd->val_min;
285 else if (val > sd->val_max)
286 val = sd->val_max;
287
288 if (EINA_DBL_EQ(val, sd->val)) return;
289
290 sd->val = val;
291
292 if (EINA_DBL_EQ(sd->val, sd->val_min))
293 efl_event_callback_call(obj, EFL_UI_SPIN_EVENT_MIN_REACHED, NULL);
294 else if (EINA_DBL_EQ(sd->val, sd->val_max))
295 efl_event_callback_call(obj, EFL_UI_SPIN_EVENT_MAX_REACHED, NULL);
296
297 efl_event_callback_call(obj, EFL_UI_SPIN_EVENT_CHANGED, NULL);
298
299 _label_write(obj);
300}
301
302EOLIAN static double
303_efl_ui_spin_efl_ui_range_range_value_get(Eo *obj EINA_UNUSED, Efl_Ui_Spin_Data *sd)
304{
305 return sd->val;
306}
307
308#define EFL_UI_SPIN_EXTRA_OPS \
309 ELM_LAYOUT_SIZING_EVAL_OPS(efl_ui_spin), \
310
311#include "efl_ui_spin.eo.c"
diff --git a/src/lib/elementary/efl_ui_spin.eo b/src/lib/elementary/efl_ui_spin.eo
new file mode 100644
index 0000000..df2e2bd
--- /dev/null
+++ b/src/lib/elementary/efl_ui_spin.eo
@@ -0,0 +1,26 @@
1class Efl.Ui.Spin (Efl.Ui.Layout, Efl.Ui.Range, Efl.Ui.Format,
2 Efl.Access.Value, Efl.Access.Widget.Action)
3{
4 [[A Spin.
5
6 This is a widget which allows the user to increase or decrease numeric values
7 using user interactions. It's base type of widget to picking a value and showing value.
8
9 @since 1.21
10 ]]
11 implements {
12 Efl.Object.constructor;
13 Efl.Object.finalize;
14 Efl.Object.destructor;
15 Elm.Widget.theme_apply;
16 Efl.Ui.Range.range_min_max { get; set; }
17 Efl.Ui.Range.range_step { get; set; }
18 Efl.Ui.Range.range_value { get; set; }
19 Efl.Ui.Format.format_cb { set; }
20 }
21 events {
22 changed; [[Called when spin changed]]
23 min,reached; [[Called when spin value reached min]]
24 max,reached; [[Called when spin value reached max]]
25 }
26}
diff --git a/src/lib/elementary/efl_ui_spin_button.c b/src/lib/elementary/efl_ui_spin_button.c
new file mode 100644
index 0000000..21b0e28
--- /dev/null
+++ b/src/lib/elementary/efl_ui_spin_button.c
@@ -0,0 +1,922 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#define EFL_ACCESS_PROTECTED
6#define EFL_ACCESS_VALUE_PROTECTED
7#define EFL_ACCESS_WIDGET_ACTION_PROTECTED
8#define EFL_UI_FOCUS_COMPOSITION_PROTECTED
9
10#include <Elementary.h>
11
12#include "elm_priv.h"
13#include "efl_ui_spin_button_private.h"
14#include "efl_ui_spin_private.h"
15#include "elm_entry.eo.h"
16
17#define MY_CLASS EFL_UI_SPIN_BUTTON_CLASS
18
19#define MY_CLASS_NAME "Efl.Ui.Spin_Button"
20
21#define EFL_UI_SPIN_BUTTON_DELAY_CHANGE_TIME 0.2
22
23static void
24_inc_dec_button_clicked_cb(void *data, const Efl_Event *event);
25static void
26_inc_dec_button_pressed_cb(void *data, const Efl_Event *event);
27static void
28_inc_dec_button_unpressed_cb(void *data, const Efl_Event *event);
29static void
30_inc_dec_button_mouse_move_cb(void *data, const Efl_Event *event);
31static void
32_entry_activated_cb(void *data, const Efl_Event *event);
33static void
34_entry_focus_changed_cb(void *data, const Efl_Event *event);
35static void
36_access_increment_decrement_info_say(Evas_Object *obj, Eina_Bool is_incremented);
37
38EFL_CALLBACKS_ARRAY_DEFINE(_inc_dec_button_cb,
39 { EFL_UI_EVENT_CLICKED, _inc_dec_button_clicked_cb},
40 { EFL_UI_EVENT_PRESSED, _inc_dec_button_pressed_cb},
41 { EFL_UI_EVENT_UNPRESSED, _inc_dec_button_unpressed_cb},
42 { EFL_EVENT_POINTER_MOVE, _inc_dec_button_mouse_move_cb }
43 );
44
45static void
46_entry_show(Evas_Object *obj)
47{
48 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(obj, MY_CLASS);
49 Efl_Ui_Spin_Data *pd = efl_data_scope_get(obj, EFL_UI_SPIN_CLASS);
50 char buf[32], fmt[32] = "%0.f";
51
52 /* try to construct just the format from given label
53 * completely ignoring pre/post words
54 */
55 if (pd->templates)
56 {
57 const char *start = strchr(pd->templates, '%');
58 while (start)
59 {
60 /* handle %% */
61 if (start[1] != '%')
62 break;
63 else
64 start = strchr(start + 2, '%');
65 }
66
67 if (start)
68 {
69 const char *itr, *end = NULL;
70 for (itr = start + 1; *itr != '\0'; itr++)
71 {
72 if ((*itr == 'd') || (*itr == 'u') || (*itr == 'i') || (*itr == 'o') ||
73 (*itr == 'x') || (*itr == 'X') || (*itr == 'f') || (*itr == 'F'))
74 {
75 end = itr + 1;
76 break;
77 }
78 }
79
80 if ((end) && ((size_t)(end - start + 1) < sizeof(fmt)))
81 {
82 memcpy(fmt, start, end - start);
83 fmt[end - start] = '\0';
84 }
85 }
86 }
87
88 if (pd->format_type == SPIN_FORMAT_INT)
89 snprintf(buf, sizeof(buf), fmt, (int)pd->val);
90 else
91 snprintf(buf, sizeof(buf), fmt, pd->val);
92
93 elm_object_text_set(sd->ent, buf);
94}
95
96static void
97_label_write(Evas_Object *obj)
98{
99 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(obj, MY_CLASS);
100
101 Efl_Ui_Spin_Data *pd = efl_data_scope_get(obj, EFL_UI_SPIN_CLASS);
102
103 if (pd->templates)
104 elm_layout_text_set(sd->text_button, "elm.text", pd->templates);
105 else
106 {
107 char buf[1024];
108
109 snprintf(buf, sizeof(buf), "%.0f", pd->val);
110 elm_layout_text_set(sd->text_button, "elm.text", buf);
111 }
112}
113
114static Eina_Bool
115_delay_change_timer_cb(void *data)
116{
117 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(data, MY_CLASS);
118
119 sd->delay_change_timer = NULL;
120 efl_event_callback_call(data, EFL_UI_SPIN_BUTTON_EVENT_DELAY_CHANGED, NULL);
121
122 return ECORE_CALLBACK_CANCEL;
123}
124
125static Eina_Bool
126_value_set(Evas_Object *obj,
127 double new_val)
128{
129 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(obj, MY_CLASS);
130 Efl_Ui_Spin_Data *pd = efl_data_scope_get(obj, EFL_UI_SPIN_CLASS);
131
132 if (sd->loop)
133 {
134 if (new_val < pd->val_min)
135 new_val = pd->val_max;
136 else if (new_val > pd->val_max)
137 new_val = pd->val_min;
138 }
139
140 efl_ui_range_value_set(obj, new_val);
141 ecore_timer_del(sd->delay_change_timer);
142 sd->delay_change_timer = ecore_timer_add(EFL_UI_SPIN_BUTTON_DELAY_CHANGE_TIME,
143 _delay_change_timer_cb, obj);
144
145 return EINA_TRUE;
146}
147
148static void
149_entry_hide(Evas_Object *obj)
150{
151 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(obj, MY_CLASS);
152
153 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");
156 evas_object_hide(sd->ent);
157
158 if (sd->entry_visible && !evas_focus_state_get(evas_object_evas_get(obj)))
159 sd->entry_reactivate = EINA_TRUE;
160
161 sd->entry_visible = EINA_FALSE;
162}
163
164static void
165_entry_value_apply(Evas_Object *obj)
166{
167 const char *str;
168 double val;
169 char *end;
170
171 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(obj, MY_CLASS);
172 Efl_Ui_Spin_Data *pd = efl_data_scope_get(obj, EFL_UI_SPIN_CLASS);
173
174 if (!sd->entry_visible) return;
175
176 efl_event_callback_del(sd->ent, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED,
177 _entry_focus_changed_cb, obj);
178 _entry_hide(obj);
179 str = elm_object_text_get(sd->ent);
180 if (!str) return;
181
182 val = strtod(str, &end);
183 if (((*end != '\0') && (!isspace(*end))) || (fabs(val - pd->val) < DBL_EPSILON)) return;
184 efl_ui_range_value_set(obj, val);
185
186 efl_event_callback_call(obj, EFL_UI_SPIN_EVENT_CHANGED, NULL);
187 ecore_timer_del(sd->delay_change_timer);
188 sd->delay_change_timer = ecore_timer_add(EFL_UI_SPIN_BUTTON_DELAY_CHANGE_TIME,
189 _delay_change_timer_cb, obj);
190}
191
192static void
193_invalid_input_validity_filter(void *data EINA_UNUSED, Evas_Object *obj, char **text)
194{
195 char *insert = NULL;
196 const char *str = NULL;
197 int cursor_pos = 0;
198 int read_idx = 0, read_char, cmp_char;
199
200 EINA_SAFETY_ON_NULL_RETURN(obj);
201 EINA_SAFETY_ON_NULL_RETURN(text);
202
203 insert = *text;
204 str = elm_object_text_get(obj);
205
206 evas_string_char_next_get(*text, 0, &read_char);
207 cursor_pos = elm_entry_cursor_pos_get(obj);
208 if (read_char)
209 {
210 if (read_char == '-')
211 {
212 if (cursor_pos != 0)
213 {
214 goto invalid_input;
215 }
216 }
217 if (read_char == '.')
218 {
219 read_idx = evas_string_char_next_get(str, 0, &cmp_char);
220 while (cmp_char)
221 {
222 if (read_char == cmp_char)
223 {
224 goto invalid_input;
225 }
226 read_idx = evas_string_char_next_get(str, read_idx, &cmp_char);
227 }
228 }
229 read_idx = evas_string_char_next_get(str, 0, &cmp_char);
230 if ((cmp_char == '-') && (cursor_pos == 0))
231 {
232 goto invalid_input;
233 }
234 }
235 return;
236
237invalid_input:
238 *insert = 0;
239}
240
241static void
242_entry_accept_filter_add(Evas_Object *obj)
243{
244 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(obj, MY_CLASS);
245 Efl_Ui_Spin_Data *pd = efl_data_scope_get(obj, EFL_UI_SPIN_CLASS);
246 static Elm_Entry_Filter_Accept_Set digits_filter_data;
247
248 if (!sd->ent) return;
249
250 elm_entry_markup_filter_remove(sd->ent, elm_entry_filter_accept_set, &digits_filter_data);
251
252 if (pd->decimal_points > 0)
253 digits_filter_data.accepted = "-.0123456789";
254 else
255 digits_filter_data.accepted = "-0123456789";
256
257 elm_entry_markup_filter_prepend(sd->ent, elm_entry_filter_accept_set, &digits_filter_data);
258}
259
260static char *
261_text_insert(const char *text, const char *input, int pos)
262{
263 char *result = NULL;
264 int text_len, input_len;
265
266 text_len = evas_string_char_len_get(text);
267 input_len = evas_string_char_len_get(input);
268 result = (char *)calloc(text_len + input_len + 1, sizeof(char));
269 if (!result) return NULL;
270
271 strncpy(result, text, pos);
272 strcpy(result + pos, input);
273 strcpy(result + pos + input_len, text + pos);
274
275 return result;
276}
277
278static void
279_min_max_validity_filter(void *data, Evas_Object *obj, char **text)
280{
281 const char *str, *point;
282 char *insert, *new_str = NULL;
283 double val;
284 int max_len, len;
285
286 EINA_SAFETY_ON_NULL_RETURN(data);
287 EINA_SAFETY_ON_NULL_RETURN(obj);
288 EINA_SAFETY_ON_NULL_RETURN(text);
289
290 Efl_Ui_Spin_Data *pd = efl_data_scope_get(data, EFL_UI_SPIN_CLASS);
291
292 str = elm_object_text_get(obj);
293 if (!str) return;
294
295 insert = *text;
296 new_str = _text_insert(str, insert, elm_entry_cursor_pos_get(obj));
297 if (!new_str) return;
298 max_len = log10(fabs(pd->val_max)) + 1;
299
300 new_str = _text_insert(str, insert, elm_entry_cursor_pos_get(obj));
301 if (pd->format_type == SPIN_FORMAT_INT)
302 {
303 len = strlen(new_str);
304 if (len < max_len) goto end;
305 }
306 else if (pd->format_type == SPIN_FORMAT_FLOAT)
307 {
308 point = strchr(new_str, '.');
309 if (point)
310 {
311 if ((int) strlen(point + 1) > pd->decimal_points)
312 {
313 *insert = 0;
314 goto end;
315 }
316 }
317 }
318
319 val = strtod(new_str, NULL);
320 if ((val < pd->val_min) || (val > pd->val_max))
321 *insert = 0;
322
323end:
324 free(new_str);
325}
326
327static void
328_entry_show_cb(void *data,
329 Evas *e EINA_UNUSED,
330 Evas_Object *obj,
331 void *event_info EINA_UNUSED)
332{
333 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(data, MY_CLASS);
334
335 _entry_show(data);
336 elm_object_focus_set(obj, EINA_TRUE);
337 elm_entry_select_all(obj);
338 sd->entry_visible = EINA_TRUE;
339 elm_layout_signal_emit(data, "elm,state,button,inactive", "elm");
340 evas_object_hide(sd->text_button);
341}
342
343static void
344_toggle_entry(Evas_Object *obj)
345{
346 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(obj, MY_CLASS);
347
348 if (elm_widget_disabled_get(obj)) return;
349 if (!sd->editable) return;
350 if (sd->entry_visible) _entry_value_apply(obj);
351 else
352 {
353 if (!sd->ent)
354 {
355 sd->ent = elm_entry_add(obj);
356 Eina_Strbuf *buf = eina_strbuf_new();
357 eina_strbuf_append_printf(buf, "spinner/%s", elm_widget_style_get(obj));
358 elm_widget_style_set(sd->ent, eina_strbuf_string_get(buf));
359 eina_strbuf_free(buf);
360 evas_object_event_callback_add
361 (sd->ent, EVAS_CALLBACK_SHOW, _entry_show_cb, obj);
362 elm_entry_single_line_set(sd->ent, EINA_TRUE);
363 elm_layout_content_set(obj, "elm.swallow.entry", sd->ent);
364 _entry_accept_filter_add(obj);
365 elm_entry_markup_filter_append(sd->ent, _invalid_input_validity_filter, NULL);
366 if (_elm_config->spinner_min_max_filter_enable)
367 elm_entry_markup_filter_append(sd->ent, _min_max_validity_filter, obj);
368 efl_event_callback_add(sd->ent, ELM_ENTRY_EVENT_ACTIVATED,
369 _entry_activated_cb, obj);
370 }
371
372 efl_event_callback_add(sd->ent, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED,
373 _entry_focus_changed_cb, obj);
374 sd->entry_visible = EINA_TRUE;
375 elm_layout_signal_emit(obj, "elm,state,entry,active", "elm");
376 evas_object_show(sd->ent);
377 {
378 Eina_List *items = NULL;
379
380 items = eina_list_append(items, sd->dec_button);
381 items = eina_list_append(items, sd->text_button);
382 items = eina_list_append(items, sd->ent);
383 items = eina_list_append(items, sd->inc_button);
384
385 efl_ui_focus_composition_elements_set(obj, items);
386 }
387
388 efl_ui_focus_manager_focus_set(efl_ui_focus_user_manager_get(obj), sd->ent);
389 }
390}
391
392static void
393_entry_toggle_cb(void *data EINA_UNUSED,
394 Evas_Object *obj,
395 const char *emission EINA_UNUSED,
396 const char *source EINA_UNUSED)
397{
398 _toggle_entry(obj);
399}
400
401static Eina_Bool
402_spin_value(void *data)
403{
404 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(data, MY_CLASS);
405 Efl_Ui_Spin_Data *pd = efl_data_scope_get(data, EFL_UI_SPIN_CLASS);
406
407 if (_value_set(data, pd->val + (sd->inc_val ? pd->step : -pd->step)))
408 _label_write(data);
409
410 return ECORE_CALLBACK_RENEW;
411}
412
413static void
414_spin_stop(Evas_Object *obj)
415{
416 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(obj, MY_CLASS);
417
418 ELM_SAFE_FREE(sd->spin_timer, ecore_timer_del);
419
420 elm_widget_scroll_freeze_pop(obj);
421}
422
423static Eina_Bool
424_inc_dec_button_press_start(void *data)
425{
426 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(data, MY_CLASS);
427
428 sd->interval = sd->first_interval;
429 sd->longpress_timer = NULL;
430 ecore_timer_del(sd->spin_timer);
431 sd->spin_timer = ecore_timer_add(sd->interval, _spin_value, data);
432 _spin_value(data);
433
434 elm_widget_scroll_freeze_push(data);
435
436 return ECORE_CALLBACK_CANCEL;
437}
438
439static void
440_inc_dec_button_clicked_cb(void *data, const Efl_Event *event)
441{
442 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(data, MY_CLASS);
443
444 _spin_stop(data);
445 sd->inc_val = sd->inc_button == event->object ? EINA_TRUE : EINA_FALSE;
446 _spin_value(data);
447
448 if (_elm_config->access_mode)
449 _access_increment_decrement_info_say(data, EINA_TRUE);
450}
451
452
453static void
454_inc_dec_button_pressed_cb(void *data, const Efl_Event *event)
455{
456 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(data, MY_CLASS);
457
458 sd->inc_val = sd->inc_button == event->object ? EINA_TRUE : EINA_FALSE;
459
460 if (sd->longpress_timer) ecore_timer_del(sd->longpress_timer);
461
462 sd->longpress_timer = ecore_timer_add
463 (_elm_config->longpress_timeout,
464 _inc_dec_button_press_start, data);
465
466 if (sd->entry_visible) _entry_value_apply(data);
467}
468
469static void
470_inc_dec_button_unpressed_cb(void *data, const Efl_Event *event EINA_UNUSED)
471{
472 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(data, MY_CLASS);
473
474 if (sd->longpress_timer)
475 {
476 ecore_timer_del(sd->longpress_timer);
477 sd->longpress_timer = NULL;
478 }
479
480 _spin_stop(data);
481}
482
483static void
484_inc_dec_button_mouse_move_cb(void *data, const Efl_Event *event)
485{
486 Efl_Input_Pointer *ev = event->info;
487 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(data, MY_CLASS);
488
489 if (efl_input_processed_get(ev) && sd->longpress_timer)
490 {
491 ecore_timer_del(sd->longpress_timer);
492 sd->longpress_timer = NULL;
493 }
494}
495
496static void
497_text_button_focus_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
498{
499 _toggle_entry(data);
500}
501
502static void
503_entry_activated_cb(void *data, const Efl_Event *event EINA_UNUSED)
504{
505 _toggle_entry(data);
506}
507
508static void
509_entry_focus_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
510{
511 _toggle_entry(data);
512}
513
514static void
515_text_button_clicked_cb(void *data, const Efl_Event *event EINA_UNUSED)
516{
517 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(data, MY_CLASS);
518
519 if (sd->entry_visible) return;
520 _toggle_entry(data);
521}
522
523static Eina_Bool
524_key_action_toggle(Evas_Object *obj, const char *params EINA_UNUSED)
525{
526 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(obj, MY_CLASS);
527
528 if (sd->spin_timer) _spin_stop(obj);
529 else if (sd->entry_visible) _entry_toggle_cb(NULL, obj, NULL, NULL);
530
531 return EINA_FALSE;
532}
533
534EOLIAN static Eina_Bool
535_efl_ui_spin_button_elm_widget_widget_event(Eo *obj, Efl_Ui_Spin_Button_Data *sd EINA_UNUSED, const Efl_Event *eo_event, Evas_Object *src EINA_UNUSED)
536{
537 Eo *ev = eo_event->info;
538
539 if (efl_input_processed_get(ev)) return EINA_FALSE;
540 if (eo_event->desc == EFL_EVENT_KEY_DOWN)
541 {
542 if (sd->spin_timer) _spin_stop(obj);
543 else return EINA_FALSE;
544 }
545 else if (eo_event->desc == EFL_EVENT_KEY_UP)
546 {
547 if (sd->spin_timer) _spin_stop(obj);
548 else return EINA_FALSE;
549 }
550 else if (eo_event->desc == EFL_EVENT_POINTER_WHEEL)
551 {
552 sd->interval = sd->first_interval;
553 if (efl_input_pointer_wheel_delta_get(ev) < 0)
554 sd->inc_val = EINA_TRUE;
555 else
556 sd->inc_val = EINA_FALSE;
557
558 _spin_value(obj);
559 }
560 else return EINA_FALSE;
561
562 efl_input_processed_set(ev, EINA_TRUE);
563 return EINA_TRUE;
564}
565
566EOLIAN static Eina_Bool
567_efl_ui_spin_button_elm_widget_on_focus_update(Eo *obj, Efl_Ui_Spin_Button_Data *sd, Elm_Object_Item *item EINA_UNUSED)
568{
569 Eina_Bool int_ret = EINA_FALSE;
570
571 int_ret = efl_ui_widget_on_focus_update(efl_super(obj, MY_CLASS), NULL);
572 if (!int_ret) return EINA_FALSE;
573
574 if (!elm_widget_focus_get(obj))
575 {
576 ELM_SAFE_FREE(sd->delay_change_timer, ecore_timer_del);
577 ELM_SAFE_FREE(sd->spin_timer, ecore_timer_del);
578 }
579 else
580 {
581 if (sd->entry_reactivate)
582 {
583 _toggle_entry(obj);
584
585 sd->entry_reactivate = EINA_FALSE;
586 }
587 }
588
589 return EINA_TRUE;
590}
591
592EOLIAN static void
593_efl_ui_spin_button_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Spin_Button_Data *_pd EINA_UNUSED)
594{
595 Evas_Coord minw = -1, minh = -1;
596 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
597
598 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
599 edje_object_size_min_restricted_calc
600 (wd->resize_obj, &minw, &minh, minw, minh);
601 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
602 evas_object_size_hint_min_set(obj, minw, minh);
603 evas_object_size_hint_max_set(obj, -1, -1);
604}
605
606static char *
607_access_info_cb(void *data, Evas_Object *obj EINA_UNUSED)
608{
609 const char *txt = NULL;
610 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(data, MY_CLASS);
611
612 if (sd->entry_visible)
613 txt = elm_object_text_get(sd->ent);
614 else
615 txt = elm_object_text_get(sd->text_button);
616
617 if (txt) return strdup(txt);
618
619 return NULL;
620}
621
622static char *
623_access_state_cb(void *data, Evas_Object *obj EINA_UNUSED)
624{
625 if (elm_widget_disabled_get(data))
626 return strdup(E_("State: Disabled"));
627
628 return NULL;
629}
630
631static void
632_access_activate_spin_button_cb(void *data,
633 Evas_Object *part_obj EINA_UNUSED,
634 Elm_Object_Item *item EINA_UNUSED)
635{
636 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(data, MY_CLASS);
637
638 if (elm_widget_disabled_get(data)) return;
639 if (!sd->entry_visible)
640 _toggle_entry(data);
641}
642
643static void
644_access_increment_decrement_info_say(Evas_Object *obj,
645 Eina_Bool is_incremented)
646{
647 Eina_Strbuf *buf;
648
649 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(obj, MY_CLASS);
650
651 buf = eina_strbuf_new();
652 if (is_incremented)
653 {
654 elm_object_signal_emit
655 (sd->inc_button, "elm,action,anim,activate", "elm");
656 eina_strbuf_append(buf, E_("incremented"));
657 }
658 else
659 {
660 elm_object_signal_emit
661 (sd->dec_button, "elm,action,anim,activate", "elm");
662 eina_strbuf_append(buf, E_("decremented"));
663 }
664
665 eina_strbuf_append_printf
666 (buf, "%s", elm_object_text_get(sd->text_button));
667
668 _elm_access_say(eina_strbuf_string_get(buf));
669 eina_strbuf_free(buf);
670}
671
672static void
673_access_spinner_register(Evas_Object *obj, Eina_Bool is_access)
674{
675 Evas_Object *ao;
676 Elm_Access_Info *ai;
677
678 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(obj, MY_CLASS);
679
680 if (!is_access)
681 {
682 /* unregister access */
683 _elm_access_edje_object_part_object_unregister
684 (obj, elm_layout_edje_get(obj), "access");
685 elm_layout_signal_emit(obj, "elm,state,access,inactive", "elm");
686 return;
687 }
688 elm_layout_signal_emit(obj, "elm,state,access,active", "elm");
689 ao = _elm_access_edje_object_part_object_register
690 (obj, elm_layout_edje_get(obj), "access");
691
692 ai = _elm_access_info_get(ao);
693 _elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("spinner"));
694 _elm_access_callback_set(ai, ELM_ACCESS_STATE, _access_state_cb, obj);
695 _elm_access_activate_callback_set(ai, _access_activate_spin_button_cb, obj);
696
697 /*Do not register spinner buttons if widget is disabled*/
698 if (!elm_widget_disabled_get(obj))
699 {
700 ai = _elm_access_info_get(sd->inc_button);
701 _elm_access_text_set(ai, ELM_ACCESS_TYPE,
702 E_("spinner increment button"));
703 ai = _elm_access_info_get(sd->dec_button);
704 _elm_access_text_set(ai, ELM_ACCESS_TYPE,
705 E_("spinner decrement button"));
706 ai = _elm_access_info_get(sd->text_button);
707 _elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("spinner text"));
708 _elm_access_callback_set(ai, ELM_ACCESS_INFO, _access_info_cb, obj);
709 }
710}
711
712EOLIAN static Efl_Ui_Theme_Apply
713_efl_ui_spin_button_elm_widget_theme_apply(Eo *obj, Efl_Ui_Spin_Button_Data *sd EINA_UNUSED)
714{
715 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_UI_THEME_APPLY_FAILED);
716
717 if (!elm_layout_theme_set(obj, "spin_button", "base", elm_widget_style_get(obj)))
718 CRI("Failed to set layout!");
719
720 if (sd->ent)
721 {
722 Eina_Strbuf *buf = eina_strbuf_new();
723 eina_strbuf_append_printf(buf, "spin_button/%s", elm_widget_style_get(obj));
724 elm_widget_style_set(sd->ent, eina_strbuf_string_get(buf));
725 eina_strbuf_free(buf);
726 }
727
728 if (sd->inc_button)
729 {
730 Eina_Strbuf *buf = eina_strbuf_new();
731 eina_strbuf_append_printf(buf, "spin_button/increase/%s", elm_widget_style_get(obj));
732 elm_widget_style_set(sd->inc_button, eina_strbuf_string_get(buf));
733 eina_strbuf_free(buf);
734 }
735
736 if (sd->text_button)
737 {
738 Eina_Strbuf *buf = eina_strbuf_new();
739 eina_strbuf_append_printf(buf, "spin_button/%s", elm_widget_style_get(obj));
740 elm_widget_style_set(sd->text_button, eina_strbuf_string_get(buf));
741 eina_strbuf_free(buf);
742 }
743
744 if (sd->dec_button)
745 {
746 Eina_Strbuf *buf = eina_strbuf_new();
747 eina_strbuf_append_printf(buf, "spin_button/decrease/%s", elm_widget_style_get(obj));
748 elm_widget_style_set(sd->dec_button, eina_strbuf_string_get(buf));
749 eina_strbuf_free(buf);
750 }
751
752 if (_elm_config->access_mode)
753 _access_spinner_register(obj, EINA_TRUE);
754
755 elm_layout_sizing_eval(obj);
756 return EFL_UI_THEME_APPLY_SUCCESS;
757}
758
759EOLIAN static Eo *
760_efl_ui_spin_button_efl_object_finalize(Eo *obj, Efl_Ui_Spin_Button_Data *sd)
761{
762 obj = efl_finalize(efl_super(obj, MY_CLASS));
763
764 elm_widget_sub_object_parent_add(obj);
765
766 sd->first_interval = 0.85;
767
768 if (!elm_layout_theme_set(obj, "spin_button", "base",
769 elm_widget_style_get(obj)))
770 CRI("Failed to set layout!");
771
772 sd->inc_button = elm_button_add(obj);
773 elm_object_style_set(sd->inc_button, "spinner/increase/default");
774
775 efl_event_callback_array_add(sd->inc_button, _inc_dec_button_cb(), obj);
776
777 elm_layout_content_set(obj, "elm.swallow.inc_button", sd->inc_button);
778 elm_widget_sub_object_add(obj, sd->inc_button);
779
780 sd->text_button = elm_button_add(obj);
781 elm_object_style_set(sd->text_button, "spinner/default");
782
783 efl_event_callback_add(sd->text_button, EFL_UI_EVENT_CLICKED,
784 _text_button_clicked_cb, obj);
785 efl_event_callback_add(sd->text_button,
786 EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED,
787 _text_button_focus_changed_cb, obj);
788
789 elm_layout_content_set(obj, "elm.swallow.text_button", sd->text_button);
790 elm_widget_sub_object_add(obj, sd->text_button);
791
792 sd->dec_button = elm_button_add(obj);
793 elm_object_style_set(sd->dec_button, "spinner/decrease/default");
794
795 efl_event_callback_array_add(sd->dec_button, _inc_dec_button_cb(), obj);
796
797 elm_layout_content_set(obj, "elm.swallow.dec_button", sd->dec_button);
798 elm_widget_sub_object_add(obj, sd->dec_button);
799
800 {
801 Eina_List *items = NULL;
802
803 items = eina_list_append(items, sd->dec_button);
804 items = eina_list_append(items, sd->text_button);
805 items = eina_list_append(items, sd->inc_button);
806
807 efl_ui_focus_composition_elements_set(obj, items);
808 }
809
810 elm_layout_signal_callback_add
811 (obj, "elm,action,entry,toggle", "*", _entry_toggle_cb, NULL);
812
813 _label_write(obj);
814 elm_widget_can_focus_set(obj, EINA_TRUE);
815
816 elm_layout_sizing_eval(obj);
817 efl_access_role_set(obj, EFL_ACCESS_ROLE_SPIN_BUTTON);
818
819 return obj;
820}
821
822EOLIAN static void
823_efl_ui_spin_button_efl_ui_range_range_value_set(Eo *obj, Efl_Ui_Spin_Button_Data *sd EINA_UNUSED, double val)
824{
825 efl_ui_range_value_set(efl_super(obj, MY_CLASS), val);
826
827 _label_write(obj);
828}
829
830EOLIAN static void
831_efl_ui_spin_button_editable_set(Eo *obj EINA_UNUSED, Efl_Ui_Spin_Button_Data *sd, Eina_Bool editable)
832{
833 sd->editable = editable;
834}
835
836EOLIAN static Eina_Bool
837_efl_ui_spin_button_editable_get(Eo *obj EINA_UNUSED, Efl_Ui_Spin_Button_Data *sd)
838{
839 return sd->editable;
840}
841
842EOLIAN static void
843_efl_ui_spin_button_loop_set(Eo *obj EINA_UNUSED, Efl_Ui_Spin_Button_Data *sd, Eina_Bool loop)
844{
845 sd->loop = loop;
846}
847
848EOLIAN static Eina_Bool
849_efl_ui_spin_button_loop_get(Eo *obj EINA_UNUSED, Efl_Ui_Spin_Button_Data *sd)
850{
851 return sd->loop;
852}
853
854EOLIAN static const Efl_Access_Action_Data *
855_efl_ui_spin_button_efl_access_widget_action_elm_actions_get(Eo *obj EINA_UNUSED, Efl_Ui_Spin_Button_Data *sd EINA_UNUSED)
856{
857 static Efl_Access_Action_Data atspi_actions[] = {
858 { "toggle", "toggle", NULL, _key_action_toggle},
859 { NULL, NULL, NULL, NULL }
860 };
861 return &atspi_actions[0];
862}
863
864// A11Y Accessibility
865
866EOLIAN static void
867_efl_ui_spin_button_efl_access_value_value_and_text_get(Eo *obj EINA_UNUSED, Efl_Ui_Spin_Button_Data *sd EINA_UNUSED, double *value, const char **text)
868{
869 Efl_Ui_Spin_Data *pd = efl_data_scope_get(obj, EFL_UI_SPIN_CLASS);
870
871 if (value) *value = pd->val;
872 if (text) *text = NULL;
873}
874
875EOLIAN static Eina_Bool
876_efl_ui_spin_button_efl_access_value_value_and_text_set(Eo *obj, Efl_Ui_Spin_Button_Data *sd EINA_UNUSED, double value, const char *text EINA_UNUSED)
877{
878 Efl_Ui_Spin_Data *pd = efl_data_scope_get(obj, EFL_UI_SPIN_CLASS);
879
880 if (pd->val_min > value) return EINA_FALSE;
881 if (pd->val_max < value) return EINA_FALSE;
882
883 pd->val = value;
884 efl_ui_range_value_set(efl_super(obj, MY_CLASS), value);
885
886 return EINA_TRUE;
887}
888
889EOLIAN static void
890_efl_ui_spin_button_efl_access_value_range_get(Eo *obj EINA_UNUSED, Efl_Ui_Spin_Button_Data *sd EINA_UNUSED, double *lower, double *upper, const char **descr)
891{
892 Efl_Ui_Spin_Data *pd = efl_data_scope_get(obj, EFL_UI_SPIN_CLASS);
893
894 if (lower) *lower = pd->val_min;
895 if (upper) *upper = pd->val_max;
896 if (descr) *descr = NULL;
897}
898
899EOLIAN static double
900_efl_ui_spin_button_efl_access_value_increment_get(Eo *obj EINA_UNUSED, Efl_Ui_Spin_Button_Data *sd EINA_UNUSED)
901{
902 Efl_Ui_Spin_Data *pd = efl_data_scope_get(obj, EFL_UI_SPIN_CLASS);
903
904 return pd->step;
905}
906
907EOLIAN static const char*
908_efl_ui_spin_button_efl_access_name_get(Eo *obj, Efl_Ui_Spin_Button_Data *sd EINA_UNUSED)
909{
910 const char *name;
911 name = efl_access_name_get(efl_super(obj, EFL_UI_SPIN_BUTTON_CLASS));
912 if (name) return name;
913 const char *ret = elm_layout_text_get(obj, "elm.text");
914 return ret;
915}
916
917// A11Y Accessibility - END
918
919#define EFL_UI_SPIN_BUTTON_EXTRA_OPS \
920 ELM_LAYOUT_SIZING_EVAL_OPS(efl_ui_spin_button), \
921
922#include "efl_ui_spin_button.eo.c"
diff --git a/src/lib/elementary/efl_ui_spin_button.eo b/src/lib/elementary/efl_ui_spin_button.eo
new file mode 100644
index 0000000..06c604e
--- /dev/null
+++ b/src/lib/elementary/efl_ui_spin_button.eo
@@ -0,0 +1,80 @@
1class Efl.Ui.Spin_Button (Efl.Ui.Spin, Efl.Ui.Focus.Composition,
2 Efl.Access.Value, Efl.Access.Widget.Action)
3{
4 [[A Button Spin.
5
6 This is a widget which allows the user to increase or decrease
7 numeric values using arrow buttons, or edit values directly, clicking
8 over it and typing the new value.
9
10 @since 1.21
11 ]]
12 methods {
13 @property loop {
14 [[Control whether the spin should loop when it reaches its minimum or maximum value.
15
16 Disabled by default. If disabled, when the user tries to increment the
17 value,
18 but displayed value plus step value is bigger than maximum value,
19 the new value will be the maximum value.
20 The same happens when the user tries to decrement it,
21 but the value less step is less than minimum value. In this case,
22 the new displayed value will be the minimum value.
23
24 When loop is enabled, when the user tries to increment the value,
25 but displayed value plus step value is bigger than maximum value,
26 the new value will be the minimum value. When the the user tries to
27 decrement it, but the value less step is less than minimum value,
28 the new displayed value will be the maximum value.
29
30 E.g.:
31 $min = 10
32 $max = 50
33 $step = 20
34 $displayed = 20
35
36 When the user decrement value (using left or bottom arrow), it will
37 displays $50.]]
38 set {
39 }
40 get {
41 }
42 values {
43 loop: bool(false); [[$true to enable loop or $false to disable it.]]
44 }
45 }
46 @property editable {
47 [[Control whether the spin can be directly edited by the user or not.
48
49 Spin objects can have edition disabled, in which state they will
50 be changed only by arrows.
51 Useful for contexts
52 where you don't want your users to interact with it writing the value.
53 Specially
54 when using special values, the user can see real value instead
55 of special label on edition.]]
56 set {
57 }
58 get {
59 }
60 values {
61 editable: bool(false); [[$true to allow users to edit it or $false to don't allow users to edit it directly.]]
62 }
63 }
64 }
65 implements {
66 Efl.Object.finalize;
67 Elm.Widget.theme_apply;
68 Elm.Widget.widget_event;
69 Elm.Widget.on_focus_update;
70 Efl.Ui.Range.range_value { set; }
71 Efl.Access.name { get; }
72 Efl.Access.Value.value_and_text { get; set; }
73 Efl.Access.Value.range { get; }
74 Efl.Access.Value.increment { get; }
75 Efl.Access.Widget.Action.elm_actions { get; }
76 }
77 events {
78 delay,changed; [[Called when spin delay changed]]
79 }
80}
diff --git a/src/lib/elementary/efl_ui_spin_button_private.h b/src/lib/elementary/efl_ui_spin_button_private.h
new file mode 100644
index 0000000..4b59f7c
--- /dev/null
+++ b/src/lib/elementary/efl_ui_spin_button_private.h
@@ -0,0 +1,20 @@
1#ifndef EFL_UI_SPIN_BUTTON_PRIVATE_H
2#define EFL_UI_SPIN_BUTTON_PRIVATE_H
3
4typedef struct _Efl_Ui_Spin_Button_Data Efl_Ui_Spin_Button_Data;
5struct _Efl_Ui_Spin_Button_Data
6{
7 double interval, first_interval;
8 Evas_Object *ent, *inc_button, *dec_button, *text_button;
9 Ecore_Timer *delay_change_timer; /**< a timer for a delay,changed smart callback */
10 Ecore_Timer *spin_timer; /**< a timer for a repeated spinner value change on mouse down */
11 Ecore_Timer *longpress_timer; /**< a timer to detect long press. After lonpress timeout,
12 start continuous change of values until mouse up */
13 Eina_Bool entry_visible : 1;
14 Eina_Bool entry_reactivate : 1;
15 Eina_Bool editable : 1;
16 Eina_Bool inc_val : 1;
17 Eina_Bool loop : 1;
18};
19
20#endif
diff --git a/src/lib/elementary/efl_ui_spin_private.h b/src/lib/elementary/efl_ui_spin_private.h
new file mode 100644
index 0000000..a8065dc
--- /dev/null
+++ b/src/lib/elementary/efl_ui_spin_private.h
@@ -0,0 +1,29 @@
1#ifndef EFL_UI_SPIN_PRIVATE_H
2#define EFL_UI_SPIN_PRIVATE_H
3
4#include "Elementary.h"
5
6typedef enum _Efl_Ui_Spin_Format_Type
7{
8 SPIN_FORMAT_FLOAT,
9 SPIN_FORMAT_INT,
10 SPIN_FORMAT_INVALID
11} Efl_Ui_Spin_Format_Type;
12
13typedef struct _Efl_Ui_Spin_Data Efl_Ui_Spin_Data;
14struct _Efl_Ui_Spin_Data
15{
16 const char *templates;
17 double val, val_min, val_max;
18 double step; /**< step for the value change. 1 by default. */
19 int decimal_points;
20 Ecore_Timer *spin_timer; /**< a timer for a repeated spin value change on mouse down */
21 Efl_Ui_Spin_Format_Type format_type;
22
23 Efl_Ui_Format_Func_Cb format_cb;
24 Eina_Free_Cb format_free_cb;
25 void *format_cb_data;
26 Eina_Strbuf *format_strbuf;
27};
28
29#endif
diff --git a/src/lib/elementary/elm_flipselector.c b/src/lib/elementary/elm_flipselector.c
index 6a80600..ac69bd6 100644
--- a/src/lib/elementary/elm_flipselector.c
+++ b/src/lib/elementary/elm_flipselector.c
@@ -470,7 +470,7 @@ _items_add(Evas_Object *obj)
470} 470}
471 471
472EOLIAN static void 472EOLIAN static void
473_elm_flipselector_efl_ui_spin_min_max_set(Eo *obj, Elm_Flipselector_Data *sd, double min, double max) 473_elm_flipselector_efl_ui_range_range_min_max_set(Eo *obj, Elm_Flipselector_Data *sd, double min, double max)
474{ 474{
475 if (min > max) return; 475 if (min > max) return;
476 if ((sd->val_min == min) && (sd->val_max == max)) return; 476 if ((sd->val_min == min) && (sd->val_max == max)) return;
@@ -482,14 +482,14 @@ _elm_flipselector_efl_ui_spin_min_max_set(Eo *obj, Elm_Flipselector_Data *sd, do
482} 482}
483 483
484EOLIAN static void 484EOLIAN static void
485_elm_flipselector_efl_ui_spin_min_max_get(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd, double *min, double *max) 485_elm_flipselector_efl_ui_range_range_min_max_get(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd, double *min, double *max)
486{ 486{
487 if (min) *min = sd->val_min; 487 if (min) *min = sd->val_min;
488 if (max) *max = sd->val_max; 488 if (max) *max = sd->val_max;
489} 489}
490 490
491EOLIAN static void 491EOLIAN static void
492_elm_flipselector_efl_ui_spin_step_set(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd, double step) 492_elm_flipselector_efl_ui_range_range_step_set(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd, double step)
493{ 493{
494 if (sd->step == step) return; 494 if (sd->step == step) return;
495 495
@@ -498,13 +498,13 @@ _elm_flipselector_efl_ui_spin_step_set(Eo *obj EINA_UNUSED, Elm_Flipselector_Dat
498} 498}
499 499
500EOLIAN static double 500EOLIAN static double
501_elm_flipselector_efl_ui_spin_step_get(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd) 501_elm_flipselector_efl_ui_range_range_step_get(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd)
502{ 502{
503 return sd->step; 503 return sd->step;
504} 504}
505 505
506EOLIAN static double 506EOLIAN static double
507_elm_flipselector_efl_ui_spin_value_get(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd) 507_elm_flipselector_efl_ui_range_range_value_get(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd)
508{ 508{
509 if (sd->val_min == 0 && sd->val_max == 0) 509 if (sd->val_min == 0 && sd->val_max == 0)
510 { 510 {
@@ -516,7 +516,7 @@ _elm_flipselector_efl_ui_spin_value_get(Eo *obj EINA_UNUSED, Elm_Flipselector_Da
516} 516}
517 517
518EOLIAN static void 518EOLIAN static void
519_elm_flipselector_efl_ui_spin_value_set(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd, double val) 519_elm_flipselector_efl_ui_range_range_value_set(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd, double val)
520{ 520{
521 Eina_List *l; 521 Eina_List *l;
522 Elm_Object_Item *it; 522 Elm_Object_Item *it;
@@ -657,18 +657,6 @@ elm_flipselector_add(Evas_Object *parent)
657 return elm_legacy_add(MY_CLASS, parent); 657 return elm_legacy_add(MY_CLASS, parent);
658} 658}
659 659
660EAPI void
661elm_flipselector_first_interval_set(Evas_Object *obj, double interval)
662{
663 efl_ui_spin_interval_set(obj, interval);
664}
665
666EAPI double
667elm_flipselector_first_interval_get(const Evas_Object *obj)
668{
669 return efl_ui_spin_interval_get(obj);
670}
671
672EOLIAN static Eo * 660EOLIAN static Eo *
673_elm_flipselector_efl_object_constructor(Eo *obj, Elm_Flipselector_Data *sd) 661_elm_flipselector_efl_object_constructor(Eo *obj, Elm_Flipselector_Data *sd)
674{ 662{
@@ -869,14 +857,14 @@ _elm_flipselector_item_next_get(const Eo *eo_item,
869 return NULL; 857 return NULL;
870} 858}
871 859
872EOLIAN static void 860EOLIAN void
873_elm_flipselector_efl_ui_spin_interval_set(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd, double interval) 861_elm_flipselector_first_interval_set(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd, double interval)
874{ 862{
875 sd->first_interval = interval; 863 sd->first_interval = interval;
876} 864}
877 865
878EOLIAN static double 866EOLIAN double
879_elm_flipselector_efl_ui_spin_interval_get(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd) 867_elm_flipselector_first_interval_get(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd)
880{ 868{
881 return sd->first_interval; 869 return sd->first_interval;
882} 870}
diff --git a/src/lib/elementary/elm_flipselector.eo b/src/lib/elementary/elm_flipselector.eo
index 964cc59..4ba48de 100644
--- a/src/lib/elementary/elm_flipselector.eo
+++ b/src/lib/elementary/elm_flipselector.eo
@@ -1,4 +1,4 @@
1class Elm.Flipselector (Efl.Ui.Layout, Efl.Ui.Spin, 1class Elm.Flipselector (Efl.Ui.Layout, Efl.Ui.Range,
2 Efl.Access.Widget.Action, 2 Efl.Access.Widget.Action,
3 Efl.Ui.Selectable) 3 Efl.Ui.Selectable)
4{ 4{
@@ -60,6 +60,40 @@ class Elm.Flipselector (Efl.Ui.Layout, Efl.Ui.Spin,
60 60
61 } 61 }
62 } 62 }
63 @property first_interval {
64 set {
65 [[Set the interval on time updates for a user mouse button hold
66 on a flip selector widget.
67
68 This interval value is decreased while the user holds the
69 mouse pointer either flipping up or flipping down a given flip
70 selector.
71
72 This helps the user to get to a given item distant from the
73 current one easier/faster, as it will start to flip quicker and
74 quicker on mouse button holds.
75
76 The calculation for the next flip interval value, starting from
77 the one set with this call, is the previous interval divided by
78 1.05, so it decreases a little bit.
79
80 The default starting interval value for automatic flips is
81 0.85 seconds.
82
83 See also @.first_interval.get.
84 ]]
85 }
86 get {
87 [[Get the interval on time updates for an user mouse button hold
88 on a flip selector widget.
89
90 See also @.first_interval.set for more details.
91 ]]
92 }
93 values {
94 interval: double; [[The (first) interval value in seconds.]]
95 }
96 }
63 item_prepend { 97 item_prepend {
64 [[Prepend a (text) item to a flip selector widget 98 [[Prepend a (text) item to a flip selector widget
65 99
@@ -129,10 +163,9 @@ class Elm.Flipselector (Efl.Ui.Layout, Efl.Ui.Spin,
129 Efl.Object.constructor; 163 Efl.Object.constructor;
130 Elm.Widget.theme_apply; 164 Elm.Widget.theme_apply;
131 Elm.Widget.widget_event; 165 Elm.Widget.widget_event;
132 Efl.Ui.Spin.min_max { get; set; } 166 Efl.Ui.Range.range_min_max { get; set; }
133 Efl.Ui.Spin.step { get; set; } 167 Efl.Ui.Range.range_step { get; set; }
134 Efl.Ui.Spin.value { get; set; } 168 Efl.Ui.Range.range_value { get; set; }
135 Efl.Ui.Spin.interval { get; set; }
136 Efl.Access.Widget.Action.elm_actions { get; } 169 Efl.Access.Widget.Action.elm_actions { get; }
137 } 170 }
138 events { 171 events {
diff --git a/src/lib/elementary/elm_flipselector_legacy.h b/src/lib/elementary/elm_flipselector_legacy.h
index f928d35..a2fbd58 100644
--- a/src/lib/elementary/elm_flipselector_legacy.h
+++ b/src/lib/elementary/elm_flipselector_legacy.h
@@ -11,42 +11,5 @@
11 */ 11 */
12EAPI Evas_Object *elm_flipselector_add(Evas_Object *parent); 12EAPI Evas_Object *elm_flipselector_add(Evas_Object *parent);
13 13
14/**
15 * @brief Set the interval on time updates for a user mouse button hold on a
16 * flip selector widget.
17 *
18 * This interval value is decreased while the user holds the mouse pointer
19 * either flipping up or flipping down a given flip selector.
20 *
21 * This helps the user to get to a given item distant from the current one
22 * easier/faster, as it will start to flip quicker and quicker on mouse button
23 * holds.
24 *
25 * The calculation for the next flip interval value, starting from the one set
26 * with this call, is the previous interval divided by 1.05, so it decreases a
27 * little bit.
28 *
29 * The default starting interval value for automatic flips is 0.85 seconds.
30 *
31 * See also @ref elm_obj_flipselector_first_interval_get.
32 *
33 * @param[in] interval The (first) interval value in seconds.
34 *
35 * @ingroup Elm_Flipselector
36 */
37EAPI void elm_flipselector_first_interval_set(Evas_Object *obj, double interval);
38
39/**
40 * @brief Get the interval on time updates for an user mouse button hold on a
41 * flip selector widget.
42 *
43 * See also @ref elm_obj_flipselector_first_interval_set for more details.
44 *
45 * @return The (first) interval value in seconds.
46 *
47 * @ingroup Elm_Flipselector
48 */
49EAPI double elm_flipselector_first_interval_get(const Evas_Object *obj);
50
51#include "elm_flipselector_item.eo.legacy.h" 14#include "elm_flipselector_item.eo.legacy.h"
52#include "elm_flipselector.eo.legacy.h" 15#include "elm_flipselector.eo.legacy.h"
diff --git a/src/lib/elementary/elm_spinner.c b/src/lib/elementary/elm_spinner.c
index 96fc4eb..b1de7ef 100644
--- a/src/lib/elementary/elm_spinner.c
+++ b/src/lib/elementary/elm_spinner.c
@@ -1359,49 +1359,37 @@ elm_spinner_add(Evas_Object *parent)
1359EAPI void 1359EAPI void
1360elm_spinner_min_max_set(Evas_Object *obj, double min, double max) 1360elm_spinner_min_max_set(Evas_Object *obj, double min, double max)
1361{ 1361{
1362 efl_ui_spin_min_max_set(obj, min, max); 1362 efl_ui_range_min_max_set(obj, min, max);
1363} 1363}
1364 1364
1365EAPI void 1365EAPI void
1366elm_spinner_min_max_get(const Evas_Object *obj, double *min, double *max) 1366elm_spinner_min_max_get(const Evas_Object *obj, double *min, double *max)
1367{ 1367{
1368 efl_ui_spin_min_max_get(obj, min, max); 1368 efl_ui_range_min_max_get(obj, min, max);
1369} 1369}
1370 1370
1371EAPI void 1371EAPI void
1372elm_spinner_step_set(Evas_Object *obj, double step) 1372elm_spinner_step_set(Evas_Object *obj, double step)
1373{ 1373{
1374 efl_ui_spin_step_set(obj, step); 1374 efl_ui_range_step_set(obj, step);
1375} 1375}
1376 1376
1377EAPI double 1377EAPI double
1378elm_spinner_step_get(const Evas_Object *obj) 1378elm_spinner_step_get(const Evas_Object *obj)
1379{ 1379{
1380 return efl_ui_spin_step_get(obj); 1380 return efl_ui_range_step_get(obj);
1381}
1382
1383EAPI void
1384elm_spinner_interval_set(Evas_Object *obj, double interval)
1385{
1386 efl_ui_spin_interval_set(obj, interval);
1387}
1388
1389EAPI double
1390elm_spinner_interval_get(const Evas_Object *obj)
1391{
1392 return efl_ui_spin_interval_get(obj);
1393} 1381}
1394 1382
1395EAPI void 1383EAPI void
1396elm_spinner_value_set(Evas_Object *obj, double val) 1384elm_spinner_value_set(Evas_Object *obj, double val)
1397{ 1385{
1398 efl_ui_spin_value_set(obj, val); 1386 efl_ui_range_value_set(obj, val);
1399} 1387}
1400 1388
1401EAPI double 1389EAPI double
1402elm_spinner_value_get(const Evas_Object *obj) 1390elm_spinner_value_get(const Evas_Object *obj)
1403{ 1391{
1404 return efl_ui_spin_value_get(obj); 1392 return efl_ui_range_value_get(obj);
1405} 1393}
1406 1394
1407EOLIAN static Eo * 1395EOLIAN static Eo *
@@ -1447,7 +1435,7 @@ _elm_spinner_label_format_get(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd)
1447} 1435}
1448 1436
1449EOLIAN static void 1437EOLIAN static void
1450_elm_spinner_efl_ui_spin_min_max_set(Eo *obj, Elm_Spinner_Data *sd, double min, double max) 1438_elm_spinner_efl_ui_range_range_min_max_set(Eo *obj, Elm_Spinner_Data *sd, double min, double max)
1451{ 1439{
1452 if ((sd->val_min == min) && (sd->val_max == max)) return; 1440 if ((sd->val_min == min) && (sd->val_max == max)) return;
1453 1441
@@ -1462,26 +1450,26 @@ _elm_spinner_efl_ui_spin_min_max_set(Eo *obj, Elm_Spinner_Data *sd, double min,
1462} 1450}
1463 1451
1464EOLIAN static void 1452EOLIAN static void
1465_elm_spinner_efl_ui_spin_min_max_get(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd, double *min, double *max) 1453_elm_spinner_efl_ui_range_range_min_max_get(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd, double *min, double *max)
1466{ 1454{
1467 if (min) *min = sd->val_min; 1455 if (min) *min = sd->val_min;
1468 if (max) *max = sd->val_max; 1456 if (max) *max = sd->val_max;
1469} 1457}
1470 1458
1471EOLIAN static void 1459EOLIAN static void
1472_elm_spinner_efl_ui_spin_step_set(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd, double step) 1460_elm_spinner_efl_ui_range_range_step_set(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd, double step)
1473{ 1461{
1474 sd->step = step; 1462 sd->step = step;
1475} 1463}
1476 1464
1477EOLIAN static double 1465EOLIAN static double
1478_elm_spinner_efl_ui_spin_step_get(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd) 1466_elm_spinner_efl_ui_range_range_step_get(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd)
1479{ 1467{
1480 return sd->step; 1468 return sd->step;
1481} 1469}
1482 1470
1483EOLIAN static void 1471EOLIAN static void
1484_elm_spinner_efl_ui_spin_value_set(Eo *obj, Elm_Spinner_Data *sd, double val) 1472_elm_spinner_efl_ui_range_range_value_set(Eo *obj, Elm_Spinner_Data *sd, double val)
1485{ 1473{
1486 if (sd->val == val) return; 1474 if (sd->val == val) return;
1487 1475
@@ -1504,7 +1492,7 @@ _elm_spinner_efl_ui_spin_value_set(Eo *obj, Elm_Spinner_Data *sd, double val)
1504} 1492}
1505 1493
1506EOLIAN static double 1494EOLIAN static double
1507_elm_spinner_efl_ui_spin_value_get(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd) 1495_elm_spinner_efl_ui_range_range_value_get(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd)
1508{ 1496{
1509 return sd->val; 1497 return sd->val;
1510} 1498}
@@ -1601,13 +1589,13 @@ _elm_spinner_editable_get(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd)
1601} 1589}
1602 1590
1603EOLIAN static void 1591EOLIAN static void
1604_elm_spinner_efl_ui_spin_interval_set(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd, double interval) 1592_elm_spinner_interval_set(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd, double interval)
1605{ 1593{
1606 sd->first_interval = interval; 1594 sd->first_interval = interval;
1607} 1595}
1608 1596
1609EOLIAN static double 1597EOLIAN static double
1610_elm_spinner_efl_ui_spin_interval_get(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd) 1598_elm_spinner_interval_get(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd)
1611{ 1599{
1612 return sd->first_interval; 1600 return sd->first_interval;
1613} 1601}
diff --git a/src/lib/elementary/elm_spinner.eo b/src/lib/elementary/elm_spinner.eo
index 8809167..f149610 100644
--- a/src/lib/elementary/elm_spinner.eo
+++ b/src/lib/elementary/elm_spinner.eo
@@ -1,4 +1,4 @@
1class Elm.Spinner (Efl.Ui.Layout, Efl.Ui.Spin, Efl.Ui.Focus.Composition, 1class Elm.Spinner (Efl.Ui.Layout, Efl.Ui.Range, Efl.Ui.Focus.Composition,
2 Efl.Access.Value, Efl.Access.Widget.Action) 2 Efl.Access.Value, Efl.Access.Widget.Action)
3{ 3{
4 [[Elementary spinner class]] 4 [[Elementary spinner class]]
@@ -39,6 +39,30 @@ class Elm.Spinner (Efl.Ui.Layout, Efl.Ui.Spin, Efl.Ui.Focus.Composition,
39 wrap: bool; [[$true to enable wrap or $false to disable it.]] 39 wrap: bool; [[$true to enable wrap or $false to disable it.]]
40 } 40 }
41 } 41 }
42 @property interval {
43 [[Control the interval on time updates for an user mouse button hold on spinner widgets' arrows.
44
45 This interval value is decreased while the user holds the
46 mouse pointer either incrementing or decrementing spinner's value.
47
48 This helps the user to get to a given value distant from the
49 current one easier/faster, as it will start to change quicker and
50 quicker on mouse button holds.
51
52 The calculation for the next change interval value, starting from
53 the one set with this call, is the previous interval divided by
54 $1.05, so it decreases a little bit.
55
56 The default starting interval value for automatic changes is
57 $0.85 seconds.]]
58 set {
59 }
60 get {
61 }
62 values {
63 interval: double; [[The (first) interval value in seconds.]]
64 }
65 }
42 @property round { 66 @property round {
43 [[Control the round value for rounding 67 [[Control the round value for rounding
44 68
@@ -150,10 +174,9 @@ class Elm.Spinner (Efl.Ui.Layout, Efl.Ui.Spin, Efl.Ui.Focus.Composition,
150 Elm.Widget.on_access_update; 174 Elm.Widget.on_access_update;
151 Elm.Widget.on_focus_update; 175 Elm.Widget.on_focus_update;
152 Elm.Widget.widget_event; 176 Elm.Widget.widget_event;
153 Efl.Ui.Spin.min_max { get; set; } 177 Efl.Ui.Range.range_min_max { get; set; }
154 Efl.Ui.Spin.step { get; set; } 178 Efl.Ui.Range.range_step { get; set; }
155 Efl.Ui.Spin.value { get; set; } 179 Efl.Ui.Range.range_value { get; set; }
156 Efl.Ui.Spin.interval { get; set; }
157 Efl.Access.name { get; } 180 Efl.Access.name { get; }
158 Efl.Access.Value.value_and_text { get; set; } 181 Efl.Access.Value.value_and_text { get; set; }
159 Efl.Access.Value.range { get; } 182 Efl.Access.Value.range { get; }
diff --git a/src/lib/elementary/elm_spinner_legacy.h b/src/lib/elementary/elm_spinner_legacy.h
index a09c19d..8c4812b 100644
--- a/src/lib/elementary/elm_spinner_legacy.h
+++ b/src/lib/elementary/elm_spinner_legacy.h
@@ -119,52 +119,6 @@ EAPI void elm_spinner_step_set(Evas_Object *obj, double step);
119EAPI double elm_spinner_step_get(const Evas_Object *obj); 119EAPI double elm_spinner_step_get(const Evas_Object *obj);
120 120
121/** 121/**
122 * @brief Control the interval on time updates for an user mouse button hold on
123 * spinner widgets' arrows.
124 *
125 * This interval value is decreased while the user holds the mouse pointer
126 * either incrementing or decrementing spinner's value.
127 *
128 * This helps the user to get to a given value distant from the current one
129 * easier/faster, as it will start to change quicker and quicker on mouse
130 * button holds.
131 *
132 * The calculation for the next change interval value, starting from the one
133 * set with this call, is the previous interval divided by $1.05, so it
134 * decreases a little bit.
135 *
136 * The default starting interval value for automatic changes is $0.85 seconds.
137 *
138 * @param[in] interval The (first) interval value in seconds.
139 *
140 * @ingroup Elm_Spinner
141 */
142EAPI void elm_spinner_interval_set(Evas_Object *obj, double interval);
143
144/**
145 * @brief Control the interval on time updates for an user mouse button hold on
146 * spinner widgets' arrows.
147 *
148 * This interval value is decreased while the user holds the mouse pointer
149 * either incrementing or decrementing spinner's value.
150 *
151 * This helps the user to get to a given value distant from the current one
152 * easier/faster, as it will start to change quicker and quicker on mouse
153 * button holds.
154 *
155 * The calculation for the next change interval value, starting from the one
156 * set with this call, is the previous interval divided by $1.05, so it
157 * decreases a little bit.
158 *
159 * The default starting interval value for automatic changes is $0.85 seconds.
160 *
161 * @return The (first) interval value in seconds.
162 *
163 * @ingroup Elm_Spinner
164 */
165EAPI double elm_spinner_interval_get(const Evas_Object *obj);
166
167/**
168 * @brief Control the value the spinner displays. 122 * @brief Control the value the spinner displays.
169 * 123 *
170 * Value will be presented on the label following format specified with 124 * Value will be presented on the label following format specified with