aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-08-01 13:55:06 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-08-01 14:00:18 +0200
commit07761aecb6dda4fdd892c02ee03a877dd6e74882 (patch)
treecf7c036223888d3cee361f484558a5d5602f269f
parentefl_ui_spin_button: fix initial displaying of formatting string (diff)
downloadefl-devs/bu5hm4n/work_spin.tar.gz
efl_ui_spin: move the step implementation to spin_buttondevs/bu5hm4n/work_spin
having efl_ui_spin implementing efl.ui.range_interactive does not make sense. Efl.Ui.Spin is a not interactive widget, so it should not implement that interface. ref https://phab.enlightenment.org/T7897 Differential Revision: https://phab.enlightenment.org/D9475
-rw-r--r--src/lib/elementary/efl_ui_spin.c19
-rw-r--r--src/lib/elementary/efl_ui_spin.eo5
-rw-r--r--src/lib/elementary/efl_ui_spin_button.c25
-rw-r--r--src/lib/elementary/efl_ui_spin_button.eo4
-rw-r--r--src/lib/elementary/efl_ui_spin_button_private.h2
-rw-r--r--src/lib/elementary/efl_ui_spin_private.h1
-rw-r--r--src/tests/elementary/spec/efl_test_range_interactive.c4
7 files changed, 27 insertions, 33 deletions
diff --git a/src/lib/elementary/efl_ui_spin.c b/src/lib/elementary/efl_ui_spin.c
index 0e50457f33..b8dfa169ba 100644
--- a/src/lib/elementary/efl_ui_spin.c
+++ b/src/lib/elementary/efl_ui_spin.c
@@ -39,7 +39,6 @@ _efl_ui_spin_efl_object_constructor(Eo *obj, Efl_Ui_Spin_Data *sd)
obj = efl_constructor(efl_super(obj, MY_CLASS));
sd->val_max = 100.0;
- sd->step = 1.0;
if (elm_widget_theme_object_set(obj, wd->resize_obj,
elm_widget_theme_klass_get(obj),
@@ -98,24 +97,6 @@ _efl_ui_spin_efl_ui_range_display_range_limits_get(const Eo *obj EINA_UNUSED, Ef
}
EOLIAN static void
-_efl_ui_spin_efl_ui_range_interactive_range_step_set(Eo *obj EINA_UNUSED, Efl_Ui_Spin_Data *sd, double step)
-{
- if (step <= 0)
- {
- ERR("Wrong param. The step(%lf) should be bigger than 0.0", step);
- return;
- }
-
- sd->step = step;
-}
-
-EOLIAN static double
-_efl_ui_spin_efl_ui_range_interactive_range_step_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spin_Data *sd)
-{
- return sd->step;
-}
-
-EOLIAN static void
_efl_ui_spin_efl_ui_range_display_range_value_set(Eo *obj, Efl_Ui_Spin_Data *sd, double val)
{
if (val < sd->val_min)
diff --git a/src/lib/elementary/efl_ui_spin.eo b/src/lib/elementary/efl_ui_spin.eo
index 717c569e0d..9f55338ee2 100644
--- a/src/lib/elementary/efl_ui_spin.eo
+++ b/src/lib/elementary/efl_ui_spin.eo
@@ -1,5 +1,5 @@
-class @beta Efl.Ui.Spin extends Efl.Ui.Layout_Base implements Efl.Ui.Range_Interactive, Efl.Ui.Format,
- Efl.Access.Value, Efl.Access.Widget.Action
+class @beta Efl.Ui.Spin extends Efl.Ui.Layout_Base implements Efl.Ui.Range_Display,
+Efl.Ui.Format, Efl.Access.Value, Efl.Access.Widget.Action
{
[[A Spin.
@@ -10,7 +10,6 @@ class @beta Efl.Ui.Spin extends Efl.Ui.Layout_Base implements Efl.Ui.Range_Inter
Efl.Object.constructor;
Efl.Object.destructor;
Efl.Ui.Range_Display.range_limits { get; set; }
- Efl.Ui.Range_Interactive.range_step { get; set; }
Efl.Ui.Range_Display.range_value { get; set; }
Efl.Ui.Format.apply_formatted_value;
}
diff --git a/src/lib/elementary/efl_ui_spin_button.c b/src/lib/elementary/efl_ui_spin_button.c
index 0419022df1..d71e10135c 100644
--- a/src/lib/elementary/efl_ui_spin_button.c
+++ b/src/lib/elementary/efl_ui_spin_button.c
@@ -404,7 +404,7 @@ _entry_toggle_cb(void *data EINA_UNUSED,
static void
_spin_value(Efl_Ui_Spin *obj, Eina_Bool inc)
{
- Efl_Ui_Spin_Data *pd = efl_data_scope_get(obj, EFL_UI_SPIN_CLASS);
+ Efl_Ui_Spin_Button_Data *pd = efl_data_scope_get(obj, EFL_UI_SPIN_BUTTON_CLASS);
int absolut_value = efl_ui_range_value_get(obj) + (inc ? pd->step : -pd->step);
@@ -643,6 +643,7 @@ _efl_ui_spin_button_efl_object_constructor(Eo *obj, Efl_Ui_Spin_Button_Data *sd)
obj = efl_constructor(efl_super(obj, MY_CLASS));
_sync_widget_theme_klass(obj, sd);
+ sd->step = 1.0;
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
@@ -788,10 +789,8 @@ _efl_ui_spin_button_efl_access_value_range_get(const Eo *obj EINA_UNUSED, Efl_Ui
}
EOLIAN static double
-_efl_ui_spin_button_efl_access_value_increment_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spin_Button_Data *sd EINA_UNUSED)
+_efl_ui_spin_button_efl_access_value_increment_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spin_Button_Data *pd)
{
- Efl_Ui_Spin_Data *pd = efl_data_scope_get(obj, EFL_UI_SPIN_CLASS);
-
return pd->step;
}
@@ -812,6 +811,24 @@ _efl_ui_spin_button_efl_ui_format_apply_formatted_value(Eo *obj, Efl_Ui_Spin_But
efl_canvas_group_change(obj);
}
+EOLIAN static void
+_efl_ui_spin_button_efl_ui_range_interactive_range_step_set(Eo *obj EINA_UNUSED, Efl_Ui_Spin_Button_Data *sd, double step)
+{
+ if (step <= 0)
+ {
+ ERR("Wrong param. The step(%lf) should be bigger than 0.0", step);
+ return;
+ }
+
+ sd->step = step;
+}
+
+EOLIAN static double
+_efl_ui_spin_button_efl_ui_range_interactive_range_step_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spin_Button_Data *sd)
+{
+ return sd->step;
+}
+
// A11Y Accessibility - END
#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
index 45b16b7af8..06a57f111d 100644
--- a/src/lib/elementary/efl_ui_spin_button.eo
+++ b/src/lib/elementary/efl_ui_spin_button.eo
@@ -1,5 +1,4 @@
-class @beta Efl.Ui.Spin_Button extends Efl.Ui.Spin implements Efl.Ui.Focus.Composition, Efl.Ui.Layout_Orientable,
- Efl.Access.Widget.Action
+class @beta Efl.Ui.Spin_Button extends Efl.Ui.Spin implements Efl.Ui.Focus.Composition, Efl.Ui.Layout_Orientable, Efl.Ui.Range_Interactive, Efl.Access.Widget.Action
{
[[A Button Spin.
@@ -73,5 +72,6 @@ class @beta Efl.Ui.Spin_Button extends Efl.Ui.Spin implements Efl.Ui.Focus.Compo
Efl.Access.Value.increment { get; }
Efl.Access.Widget.Action.elm_actions { get; }
Efl.Ui.Format.apply_formatted_value;
+ Efl.Ui.Range_Interactive.range_step { get; set; }
}
}
diff --git a/src/lib/elementary/efl_ui_spin_button_private.h b/src/lib/elementary/efl_ui_spin_button_private.h
index daab1ad4e1..642b08eb27 100644
--- a/src/lib/elementary/efl_ui_spin_button_private.h
+++ b/src/lib/elementary/efl_ui_spin_button_private.h
@@ -8,7 +8,7 @@ struct _Efl_Ui_Spin_Button_Data
Eina_Future *delay_change_timer; /**< a timer for a delay,changed smart callback */
Efl_Ui_Layout_Orientation dir;
-
+ double step;
Eina_Bool entry_visible : 1;
Eina_Bool entry_reactivate : 1;
Eina_Bool editable : 1;
diff --git a/src/lib/elementary/efl_ui_spin_private.h b/src/lib/elementary/efl_ui_spin_private.h
index 3dbc06b4ea..e67f326fdc 100644
--- a/src/lib/elementary/efl_ui_spin_private.h
+++ b/src/lib/elementary/efl_ui_spin_private.h
@@ -7,7 +7,6 @@ typedef struct _Efl_Ui_Spin_Data Efl_Ui_Spin_Data;
struct _Efl_Ui_Spin_Data
{
double val, val_min, val_max;
- double step; /**< step for the value change. 1 by default. */
};
#endif
diff --git a/src/tests/elementary/spec/efl_test_range_interactive.c b/src/tests/elementary/spec/efl_test_range_interactive.c
index b7fd4ad793..c900524120 100644
--- a/src/tests/elementary/spec/efl_test_range_interactive.c
+++ b/src/tests/elementary/spec/efl_test_range_interactive.c
@@ -10,7 +10,7 @@
/* spec-meta-start
{"test-interface":"Efl.Ui.Range_Display_Interactive",
- "test-widgets": ["Efl.Ui.Spin", "Efl.Ui.Slider", "Efl.Ui.Spin_Button"]}
+ "test-widgets": ["Efl.Ui.Slider", "Efl.Ui.Spin_Button"]}
spec-meta-end */
EFL_START_TEST(step_setting)
@@ -52,8 +52,6 @@ EFL_START_TEST(steady_event)
Evas *e;
int count = 0;
- if (efl_isa(widget, EFL_UI_SPIN_CLASS)) return;
-
efl_event_callback_add(widget, EFL_UI_RANGE_EVENT_STEADY, _steady_cb, &count),
efl_ui_range_limits_set(widget, 0, 100);
efl_ui_range_step_set(widget, 10);