summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWoochan Lee <wc0917.lee@samsung.com>2017-11-28 20:03:06 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2017-11-28 20:03:06 +0900
commite8238522be7a096aa1b2287ef343564a425b67cb (patch)
treea0f190e0e02b02508612cdc63a2dedd6e5e8734e
parent434be7dbfa708247baec25ddc300201185c2110f (diff)
efl_ui_spin: Support value change using mouse wheel.
Summary: Enable value change using wheel. (Up, Down key value change will be supported after D4933 dicussing.) Test Plan: elementary_test efl_ui_spin test sample. Reviewers: Jaehyun_Cho, jpeg, woohyun Reviewed By: Jaehyun_Cho Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D5546
Diffstat (limited to '')
-rw-r--r--src/bin/elementary/test_ui_spin.c6
-rw-r--r--src/lib/elementary/efl_ui_spin.c21
-rw-r--r--src/lib/elementary/efl_ui_spin.eo1
3 files changed, 24 insertions, 4 deletions
diff --git a/src/bin/elementary/test_ui_spin.c b/src/bin/elementary/test_ui_spin.c
index be41b75f5f..ba0a166adf 100644
--- a/src/bin/elementary/test_ui_spin.c
+++ b/src/bin/elementary/test_ui_spin.c
@@ -22,15 +22,13 @@ _spin_max_reached_cb(void *data EINA_UNUSED, const Efl_Event *ev)
22static void 22static void
23_inc_clicked(void *data, const Efl_Event *ev EINA_UNUSED) 23_inc_clicked(void *data, const Efl_Event *ev EINA_UNUSED)
24{ 24{
25 int val = (int)efl_ui_range_value_get(data); 25 efl_ui_range_value_set(data, (efl_ui_range_value_get(data) + efl_ui_range_step_get(data)));
26 efl_ui_range_value_set(data, ++val);
27} 26}
28 27
29static void 28static void
30_dec_clicked(void *data, const Efl_Event *ev EINA_UNUSED) 29_dec_clicked(void *data, const Efl_Event *ev EINA_UNUSED)
31{ 30{
32 int val = (int)efl_ui_range_value_get(data); 31 efl_ui_range_value_set(data, (efl_ui_range_value_get(data) - efl_ui_range_step_get(data)));
33 efl_ui_range_value_set(data, --val);
34} 32}
35 33
36void 34void
diff --git a/src/lib/elementary/efl_ui_spin.c b/src/lib/elementary/efl_ui_spin.c
index 13dbadc872..dadb404041 100644
--- a/src/lib/elementary/efl_ui_spin.c
+++ b/src/lib/elementary/efl_ui_spin.c
@@ -163,6 +163,27 @@ _efl_ui_spin_elm_widget_theme_apply(Eo *obj, Efl_Ui_Spin_Data *sd EINA_UNUSED)
163 return EFL_UI_THEME_APPLY_SUCCESS; 163 return EFL_UI_THEME_APPLY_SUCCESS;
164} 164}
165 165
166EOLIAN 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)
168{
169 Eo *ev = eo_event->info;
170
171 if (efl_input_processed_get(ev)) return EINA_FALSE;
172
173 if (eo_event->desc == EFL_EVENT_POINTER_WHEEL)
174 {
175 if (efl_input_pointer_wheel_delta_get(ev) < 0)
176 efl_ui_range_value_set(obj, (efl_ui_range_value_get(obj) + sd->step));
177 else
178 efl_ui_range_value_set(obj, (efl_ui_range_value_get(obj) - sd->step));
179 }
180 else
181 return EINA_FALSE;
182
183 efl_input_processed_set(ev, EINA_TRUE);
184 return EINA_TRUE;
185}
186
166EOLIAN static Eo * 187EOLIAN static Eo *
167_efl_ui_spin_efl_object_constructor(Eo *obj, Efl_Ui_Spin_Data *sd) 188_efl_ui_spin_efl_object_constructor(Eo *obj, Efl_Ui_Spin_Data *sd)
168{ 189{
diff --git a/src/lib/elementary/efl_ui_spin.eo b/src/lib/elementary/efl_ui_spin.eo
index df2e2bd1dc..fae80d1e40 100644
--- a/src/lib/elementary/efl_ui_spin.eo
+++ b/src/lib/elementary/efl_ui_spin.eo
@@ -13,6 +13,7 @@ class Efl.Ui.Spin (Efl.Ui.Layout, Efl.Ui.Range, Efl.Ui.Format,
13 Efl.Object.finalize; 13 Efl.Object.finalize;
14 Efl.Object.destructor; 14 Efl.Object.destructor;
15 Elm.Widget.theme_apply; 15 Elm.Widget.theme_apply;
16 Elm.Widget.widget_event;
16 Efl.Ui.Range.range_min_max { get; set; } 17 Efl.Ui.Range.range_min_max { get; set; }
17 Efl.Ui.Range.range_step { get; set; } 18 Efl.Ui.Range.range_step { get; set; }
18 Efl.Ui.Range.range_value { get; set; } 19 Efl.Ui.Range.range_value { get; set; }