aboutsummaryrefslogtreecommitdiffstats
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
parenttest_part_bg: Clean up code. (diff)
downloadefl-e8238522be7a096aa1b2287ef343564a425b67cb.tar.gz
efl_ui_spin: Support value change using mouse wheel.
Summary: Enable value change using wheel. (Up, Down key value change will be supported after https://phab.enlightenment.org/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
-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)
static void
_inc_clicked(void *data, const Efl_Event *ev EINA_UNUSED)
{
- int val = (int)efl_ui_range_value_get(data);
- efl_ui_range_value_set(data, ++val);
+ efl_ui_range_value_set(data, (efl_ui_range_value_get(data) + efl_ui_range_step_get(data)));
}
static void
_dec_clicked(void *data, const Efl_Event *ev EINA_UNUSED)
{
- int val = (int)efl_ui_range_value_get(data);
- efl_ui_range_value_set(data, --val);
+ efl_ui_range_value_set(data, (efl_ui_range_value_get(data) - efl_ui_range_step_get(data)));
}
void
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)
return EFL_UI_THEME_APPLY_SUCCESS;
}
+EOLIAN static Eina_Bool
+_efl_ui_spin_elm_widget_widget_event(Eo *obj, Efl_Ui_Spin_Data *sd, const Efl_Event *eo_event, Evas_Object *src EINA_UNUSED)
+{
+ Eo *ev = eo_event->info;
+
+ if (efl_input_processed_get(ev)) return EINA_FALSE;
+
+ if (eo_event->desc == EFL_EVENT_POINTER_WHEEL)
+ {
+ if (efl_input_pointer_wheel_delta_get(ev) < 0)
+ efl_ui_range_value_set(obj, (efl_ui_range_value_get(obj) + sd->step));
+ else
+ efl_ui_range_value_set(obj, (efl_ui_range_value_get(obj) - sd->step));
+ }
+ else
+ return EINA_FALSE;
+
+ efl_input_processed_set(ev, EINA_TRUE);
+ return EINA_TRUE;
+}
+
EOLIAN static Eo *
_efl_ui_spin_efl_object_constructor(Eo *obj, Efl_Ui_Spin_Data *sd)
{
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,
Efl.Object.finalize;
Efl.Object.destructor;
Elm.Widget.theme_apply;
+ Elm.Widget.widget_event;
Efl.Ui.Range.range_min_max { get; set; }
Efl.Ui.Range.range_step { get; set; }
Efl.Ui.Range.range_value { get; set; }