From f7e1be206238c04e62824fb20c347e65bc2eca3d Mon Sep 17 00:00:00 2001 From: Yeshwanth Reddivari Date: Fri, 29 Apr 2016 16:49:12 -0700 Subject: [PATCH] spin interface: common interface for flipselector and spinner Summary: Added common interface for flipselector and spinner. Implemented APIs of spinner like min_max_set, step_set, value_set etc in flipselector. Test Plan: elementary_test Reviewers: raster, jpeg, singh.amitesh, woohyun, SanghyeonLee, cedric Reviewed By: cedric Differential Revision: https://phab.enlightenment.org/D3905 Signed-off-by: Cedric Bail --- src/Makefile_Efl.am | 1 + src/bin/elementary/test_flipselector.c | 9 ++ src/lib/efl/Efl.h | 1 + src/lib/efl/Makefile.am | 1 + src/lib/efl/interfaces/efl_interfaces_main.c | 1 + src/lib/efl/interfaces/efl_ui_spin.eo | 84 ++++++++++ src/lib/elementary/elm_flipselector.c | 103 ++++++++++++- src/lib/elementary/elm_flipselector.eo | 41 +---- src/lib/elementary/elm_flipselector_legacy.h | 37 +++++ src/lib/elementary/elm_spinner.c | 64 +++++++- src/lib/elementary/elm_spinner.eo | 86 +---------- src/lib/elementary/elm_spinner_legacy.h | 154 ++++++++++++++++++- src/lib/elementary/elm_widget_flipselector.h | 2 + 13 files changed, 458 insertions(+), 126 deletions(-) create mode 100644 src/lib/efl/interfaces/efl_ui_spin.eo diff --git a/src/Makefile_Efl.am b/src/Makefile_Efl.am index 3faf4501f2..480ecfa6b7 100644 --- a/src/Makefile_Efl.am +++ b/src/Makefile_Efl.am @@ -35,6 +35,7 @@ efl_eolian_files = \ lib/efl/interfaces/efl_vpath_file.eo \ lib/efl/interfaces/efl_vpath_core.eo \ lib/efl/interfaces/efl_vpath_file_core.eo \ + lib/efl/interfaces/efl_ui_spin.eo \ lib/efl/interfaces/efl_ui_progress.eo \ $(efl_eolian_legacy_files) \ $(NULL) diff --git a/src/bin/elementary/test_flipselector.c b/src/bin/elementary/test_flipselector.c index 62a67cff09..b9cd93657b 100644 --- a/src/bin/elementary/test_flipselector.c +++ b/src/bin/elementary/test_flipselector.c @@ -184,5 +184,14 @@ test_flipselector(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *ev elm_box_pack_end(bx, bt); evas_object_show(bt); + fpd = elm_flipselector_add(bx); + evas_object_size_hint_weight_set(fpd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + efl_ui_spin_step_set(fpd, 1.5); + efl_ui_spin_min_max_set(fpd, 2.3, 10.1); + efl_ui_spin_value_set(fpd, 5.3); + printf("Current value is %f\n", efl_ui_spin_value_get(fpd)); + elm_box_pack_end(bx, fpd); + evas_object_show(fpd); + evas_object_show(win); } diff --git a/src/lib/efl/Efl.h b/src/lib/efl/Efl.h index ce4399f000..074d0359d3 100644 --- a/src/lib/efl/Efl.h +++ b/src/lib/efl/Efl.h @@ -76,6 +76,7 @@ typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command; #include "interfaces/efl_text_properties.eo.h" #include "interfaces/efl_orientation.eo.h" #include "interfaces/efl_flipable.eo.h" +#include "interfaces/efl_ui_spin.eo.h" #include "interfaces/efl_ui_progress.eo.h" #define EFL_ORIENT_0 EFL_ORIENT_UP diff --git a/src/lib/efl/Makefile.am b/src/lib/efl/Makefile.am index 760e868e51..673b789fcb 100644 --- a/src/lib/efl/Makefile.am +++ b/src/lib/efl/Makefile.am @@ -34,6 +34,7 @@ interfaces/efl_vpath_manager.eo \ interfaces/efl_vpath_file.eo \ interfaces/efl_vpath_core.eo \ interfaces/efl_vpath_file_core.eo \ +interfaces/efl_ui_spin.eo \ interfaces/efl_ui_progress.eo \ $(efl_eolian_legacy_files) \ $(NULL) diff --git a/src/lib/efl/interfaces/efl_interfaces_main.c b/src/lib/efl/interfaces/efl_interfaces_main.c index 116c2d3a9c..dbdb4fb2fe 100644 --- a/src/lib/efl/interfaces/efl_interfaces_main.c +++ b/src/lib/efl/interfaces/efl_interfaces_main.c @@ -43,6 +43,7 @@ EAPI const Eo_Event_Description _EFL_GFX_PATH_CHANGED = #include "interfaces/efl_animator.eo.c" #include "interfaces/efl_orientation.eo.c" #include "interfaces/efl_flipable.eo.c" +#include "interfaces/efl_ui_spin.eo.c" #include "interfaces/efl_ui_progress.eo.c" EAPI void diff --git a/src/lib/efl/interfaces/efl_ui_spin.eo b/src/lib/efl/interfaces/efl_ui_spin.eo new file mode 100644 index 0000000000..20ac64b30f --- /dev/null +++ b/src/lib/efl/interfaces/efl_ui_spin.eo @@ -0,0 +1,84 @@ +interface Efl.Ui.Spin() +{ + legacy_prefix: null; + methods { + @property min_max { + [[Control the minimum and maximum values for the spinner. + + Define the allowed range of values to be selected by the user. + + If actual value is less than $min, it will be updated to $min. If it + is bigger then $max, will be updated to $max. + + By default, min is equal to 0, and max is equal to 100. + + Warning: Maximum must be greater than minimum.]] + set { + } + get { + } + values { + min: double; [[The minimum value.]] + max: double; [[The maximum value.]] + } + } + @property step { + [[Control the step used to increment or decrement the spinner value. + + This value will be incremented or decremented to the displayed value. + It will be incremented while the user keep right or top arrow pressed, + and will be decremented while the user keep left or bottom arrow pressed. + + The interval to increment / decrement can be set with @.interval.set. + + By default step value is equal to 1.]] + set { + } + get { + } + values { + step: double; [[The step value.]] + } + } + @property value { + [[Control the value the spinner displays. + + Value will be presented on the label following format specified with + elm_spinner_format_set(). + + Warning The value must to be between min and max values. This values + are set by elm_spinner_min_max_set().]] + set { + } + get { + } + values { + val: double; [[The value to be displayed.]] + } + } + @property interval { + [[Control the interval on time updates for an user mouse button hold on spinner widgets' arrows. + + This interval value is decreased while the user holds the + mouse pointer either incrementing or decrementing spinner's value. + + This helps the user to get to a given value distant from the + current one easier/faster, as it will start to change quicker and + quicker on mouse button holds. + + The calculation for the next change interval value, starting from + the one set with this call, is the previous interval divided by + $1.05, so it decreases a little bit. + + The default starting interval value for automatic changes is + $0.85 seconds.]] + set { + } + get { + } + values { + interval: double; [[The (first) interval value in seconds.]] + } + } + } +} diff --git a/src/lib/elementary/elm_flipselector.c b/src/lib/elementary/elm_flipselector.c index 2e789e7bac..569f4f9459 100644 --- a/src/lib/elementary/elm_flipselector.c +++ b/src/lib/elementary/elm_flipselector.c @@ -423,6 +423,92 @@ _key_action_flip(Evas_Object *obj, const char *params) return EINA_TRUE; } +static void +_clear_items(Evas_Object *obj) +{ + ELM_FLIPSELECTOR_DATA_GET(obj, sd); + sd->current = NULL; + while(sd->items) + elm_object_item_del(DATA_GET(sd->items)); +} + +static void +_items_add(Evas_Object *obj) +{ + double d; + char buf[16]; + + ELM_FLIPSELECTOR_DATA_GET(obj, sd); + _clear_items(obj); + for (d = sd->val_min; d < sd->val_max; d = d + sd->step) + { + snprintf(buf, sizeof(buf), "%.2f", d); + elm_flipselector_item_append(obj, buf, NULL, NULL); + } + snprintf(buf, sizeof(buf), "%.2f", sd->val_max); + elm_flipselector_item_append(obj, buf, NULL, NULL); +} + +EOLIAN static void +_elm_flipselector_efl_ui_spin_min_max_set(Eo *obj, Elm_Flipselector_Data *sd, double min, double max) +{ + if (min > max) return; + if ((sd->val_min == min) && (sd->val_max == max)) return; + + sd->val_min = min; + sd->val_max = max; + + _items_add(obj); +} + +EOLIAN static void +_elm_flipselector_efl_ui_spin_min_max_get(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd, double *min, double *max) +{ + if (min) *min = sd->val_min; + if (max) *max = sd->val_max; +} + +EOLIAN static void +_elm_flipselector_efl_ui_spin_step_set(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd, double step) +{ + if (sd->step == step) return; + + sd->step = step; + _items_add(obj); +} + +EOLIAN static double +_elm_flipselector_efl_ui_spin_step_get(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd) +{ + return sd->step; +} + +EOLIAN static double +_elm_flipselector_efl_ui_spin_value_get(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd) +{ + if (sd->val_min == 0 && sd->val_max == 0) + { + WRN("This API can be used only if you set min and max and flipselector values are numericals"); + return 0; + } + ELM_FLIPSELECTOR_ITEM_DATA_GET(sd->current->data, item); + return atof(item->label); +} + +EOLIAN static void +_elm_flipselector_efl_ui_spin_value_set(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd, double val) +{ + Eina_List *l; + Elm_Object_Item *it; + + EINA_LIST_FOREACH(sd->items, l, it) + { + if (atof(elm_object_item_text_get(it)) >= val) + break; + } + elm_flipselector_item_selected_set(it, EINA_TRUE); +} + EOLIAN static Eina_Bool _elm_flipselector_elm_widget_event(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd EINA_UNUSED, Evas_Object *src, Evas_Callback_Type type, void *event_info) { @@ -537,6 +623,7 @@ _elm_flipselector_evas_object_smart_add(Eo *obj, Elm_Flipselector_Data *priv) (obj, "elm,action,down,stop", "*", _signal_val_change_stop, obj); priv->first_interval = FLIP_FIRST_INTERVAL; + priv->step = 1.0; elm_widget_can_focus_set(obj, EINA_TRUE); @@ -566,6 +653,18 @@ elm_flipselector_add(Evas_Object *parent) return obj; } +EAPI void +elm_flipselector_first_interval_set(Evas_Object *obj, double interval) +{ + efl_ui_spin_interval_set(obj, interval); +} + +EAPI double +elm_flipselector_first_interval_get(const Evas_Object *obj) +{ + return efl_ui_spin_interval_get(obj); +} + EOLIAN static Eo * _elm_flipselector_eo_base_constructor(Eo *obj, Elm_Flipselector_Data *sd) { @@ -767,13 +866,13 @@ _elm_flipselector_item_next_get(const Eo *eo_item, } EOLIAN static void -_elm_flipselector_first_interval_set(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd, double interval) +_elm_flipselector_efl_ui_spin_interval_set(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd, double interval) { sd->first_interval = interval; } EOLIAN static double -_elm_flipselector_first_interval_get(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd) +_elm_flipselector_efl_ui_spin_interval_get(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd) { return sd->first_interval; } diff --git a/src/lib/elementary/elm_flipselector.eo b/src/lib/elementary/elm_flipselector.eo index ee059a2e7c..d20924fac8 100644 --- a/src/lib/elementary/elm_flipselector.eo +++ b/src/lib/elementary/elm_flipselector.eo @@ -1,42 +1,9 @@ -class Elm.Flipselector (Elm.Layout, Elm.Interface_Atspi_Widget_Action, +class Elm.Flipselector (Elm.Layout, Efl.Ui.Spin, + Elm.Interface_Atspi_Widget_Action, Evas.Selectable_Interface) { eo_prefix: elm_obj_flipselector; methods { - @property first_interval { - set { - [[Set the interval on time updates for a user mouse button hold - on a flip selector widget. - - This interval value is decreased while the user holds the - mouse pointer either flipping up or flipping down a given flip - selector. - - This helps the user to get to a given item distant from the - current one easier/faster, as it will start to flip quicker and - quicker on mouse button holds. - - The calculation for the next flip interval value, starting from - the one set with this call, is the previous interval divided by - 1.05, so it decreases a little bit. - - The default starting interval value for automatic flips is - 0.85 seconds. - - See also @.first_interval.get. - ]] - } - get { - [[Get the interval on time updates for an user mouse button hold - on a flip selector widget. - - See also @.first_interval.set for more details. - ]] - } - values { - interval: double; [[The (first) interval value in seconds.]] - } - } @property items { get { [[Get the internal list of items in a given flip selector widget. @@ -164,6 +131,10 @@ class Elm.Flipselector (Elm.Layout, Elm.Interface_Atspi_Widget_Action, Elm.Widget.focus_direction_manager_is; Elm.Widget.event; Elm.Layout.sizing_eval; + Efl.Ui.Spin.min_max; + Efl.Ui.Spin.step; + Efl.Ui.Spin.value; + Efl.Ui.Spin.interval; Elm.Interface_Atspi_Widget_Action.elm_actions.get; } events { diff --git a/src/lib/elementary/elm_flipselector_legacy.h b/src/lib/elementary/elm_flipselector_legacy.h index a2fbd58ae0..f928d35a8d 100644 --- a/src/lib/elementary/elm_flipselector_legacy.h +++ b/src/lib/elementary/elm_flipselector_legacy.h @@ -11,5 +11,42 @@ */ EAPI Evas_Object *elm_flipselector_add(Evas_Object *parent); +/** + * @brief Set the interval on time updates for a user mouse button hold on a + * flip selector widget. + * + * This interval value is decreased while the user holds the mouse pointer + * either flipping up or flipping down a given flip selector. + * + * This helps the user to get to a given item distant from the current one + * easier/faster, as it will start to flip quicker and quicker on mouse button + * holds. + * + * The calculation for the next flip interval value, starting from the one set + * with this call, is the previous interval divided by 1.05, so it decreases a + * little bit. + * + * The default starting interval value for automatic flips is 0.85 seconds. + * + * See also @ref elm_obj_flipselector_first_interval_get. + * + * @param[in] interval The (first) interval value in seconds. + * + * @ingroup Elm_Flipselector + */ +EAPI void elm_flipselector_first_interval_set(Evas_Object *obj, double interval); + +/** + * @brief Get the interval on time updates for an user mouse button hold on a + * flip selector widget. + * + * See also @ref elm_obj_flipselector_first_interval_set for more details. + * + * @return The (first) interval value in seconds. + * + * @ingroup Elm_Flipselector + */ +EAPI double elm_flipselector_first_interval_get(const Evas_Object *obj); + #include "elm_flipselector_item.eo.legacy.h" #include "elm_flipselector.eo.legacy.h" diff --git a/src/lib/elementary/elm_spinner.c b/src/lib/elementary/elm_spinner.c index c6bd8de1d2..bf44223a8e 100644 --- a/src/lib/elementary/elm_spinner.c +++ b/src/lib/elementary/elm_spinner.c @@ -1411,6 +1411,54 @@ elm_spinner_add(Evas_Object *parent) return obj; } +EAPI void +elm_spinner_min_max_set(Evas_Object *obj, double min, double max) +{ + efl_ui_spin_min_max_set(obj, min, max); +} + +EAPI void +elm_spinner_min_max_get(const Evas_Object *obj, double *min, double *max) +{ + efl_ui_spin_min_max_get(obj, min, max); +} + +EAPI void +elm_spinner_step_set(Evas_Object *obj, double step) +{ + efl_ui_spin_step_set(obj, step); +} + +EAPI double +elm_spinner_step_get(const Evas_Object *obj) +{ + return efl_ui_spin_step_get(obj); +} + +EAPI void +elm_spinner_interval_set(Evas_Object *obj, double interval) +{ + efl_ui_spin_interval_set(obj, interval); +} + +EAPI double +elm_spinner_interval_get(const Evas_Object *obj) +{ + return efl_ui_spin_interval_get(obj); +} + +EAPI void +elm_spinner_value_set(Evas_Object *obj, double val) +{ + efl_ui_spin_value_set(obj, val); +} + +EAPI double +elm_spinner_value_get(const Evas_Object *obj) +{ + return efl_ui_spin_value_get(obj); +} + EOLIAN static Eo * _elm_spinner_eo_base_constructor(Eo *obj, Elm_Spinner_Data *_pd EINA_UNUSED) { @@ -1454,7 +1502,7 @@ _elm_spinner_label_format_get(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd) } EOLIAN static void -_elm_spinner_min_max_set(Eo *obj, Elm_Spinner_Data *sd, double min, double max) +_elm_spinner_efl_ui_spin_min_max_set(Eo *obj, Elm_Spinner_Data *sd, double min, double max) { if ((sd->val_min == min) && (sd->val_max == max)) return; @@ -1469,26 +1517,26 @@ _elm_spinner_min_max_set(Eo *obj, Elm_Spinner_Data *sd, double min, double max) } EOLIAN static void -_elm_spinner_min_max_get(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd, double *min, double *max) +_elm_spinner_efl_ui_spin_min_max_get(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd, double *min, double *max) { if (min) *min = sd->val_min; if (max) *max = sd->val_max; } EOLIAN static void -_elm_spinner_step_set(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd, double step) +_elm_spinner_efl_ui_spin_step_set(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd, double step) { sd->step = step; } EOLIAN static double -_elm_spinner_step_get(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd) +_elm_spinner_efl_ui_spin_step_get(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd) { return sd->step; } EOLIAN static void -_elm_spinner_value_set(Eo *obj, Elm_Spinner_Data *sd, double val) +_elm_spinner_efl_ui_spin_value_set(Eo *obj, Elm_Spinner_Data *sd, double val) { if (sd->val == val) return; @@ -1511,7 +1559,7 @@ _elm_spinner_value_set(Eo *obj, Elm_Spinner_Data *sd, double val) } EOLIAN static double -_elm_spinner_value_get(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd) +_elm_spinner_efl_ui_spin_value_get(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd) { return sd->val; } @@ -1608,13 +1656,13 @@ _elm_spinner_editable_get(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd) } EOLIAN static void -_elm_spinner_interval_set(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd, double interval) +_elm_spinner_efl_ui_spin_interval_set(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd, double interval) { sd->first_interval = interval; } EOLIAN static double -_elm_spinner_interval_get(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd) +_elm_spinner_efl_ui_spin_interval_get(Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd) { return sd->first_interval; } diff --git a/src/lib/elementary/elm_spinner.eo b/src/lib/elementary/elm_spinner.eo index ae39f55813..14907acfe3 100644 --- a/src/lib/elementary/elm_spinner.eo +++ b/src/lib/elementary/elm_spinner.eo @@ -1,46 +1,8 @@ -class Elm.Spinner (Elm.Layout, Elm.Interface_Atspi_Value, Elm.Interface_Atspi_Widget_Action) +class Elm.Spinner (Elm.Layout, Efl.Ui.Spin, + Elm.Interface_Atspi_Value, Elm.Interface_Atspi_Widget_Action) { eo_prefix: elm_obj_spinner; methods { - @property min_max { - [[Control the minimum and maximum values for the spinner. - - Define the allowed range of values to be selected by the user. - - If actual value is less than $min, it will be updated to $min. If it - is bigger then $max, will be updated to $max. Actual value can be - get with @.value.get. - - By default, min is equal to 0, and max is equal to 100. - - Warning: Maximum must be greater than minimum.]] - set { - } - get { - } - values { - min: double; [[The minimum value.]] - max: double; [[The maximum value.]] - } - } - @property step { - [[Control the step used to increment or decrement the spinner value. - - This value will be incremented or decremented to the displayed value. - It will be incremented while the user keep right or top arrow pressed, - and will be decremented while the user keep left or bottom arrow pressed. - - The interval to increment / decrement can be set with @.interval.set. - - By default step value is equal to 1.]] - set { - } - get { - } - values { - step: double; [[The step value.]] - } - } @property wrap { [[Control whether the spinner should wrap when it reaches its minimum or maximum value. @@ -74,30 +36,6 @@ class Elm.Spinner (Elm.Layout, Elm.Interface_Atspi_Value, Elm.Interface_Atspi_Wi wrap: bool; [[$true to enable wrap or $false to disable it.]] } } - @property interval { - [[Control the interval on time updates for an user mouse button hold on spinner widgets' arrows. - - This interval value is decreased while the user holds the - mouse pointer either incrementing or decrementing spinner's value. - - This helps the user to get to a given value distant from the - current one easier/faster, as it will start to change quicker and - quicker on mouse button holds. - - The calculation for the next change interval value, starting from - the one set with this call, is the previous interval divided by - $1.05, so it decreases a little bit. - - The default starting interval value for automatic changes is - $0.85 seconds.]] - set { - } - get { - } - values { - interval: double; [[The (first) interval value in seconds.]] - } - } @property round { [[Control the round value for rounding @@ -155,22 +93,6 @@ class Elm.Spinner (Elm.Layout, Elm.Interface_Atspi_Value, Elm.Interface_Atspi_Wi base: double; [[The base value]] } } - @property value { - [[Control the value the spinner displays. - - Value will be presented on the label following format specified with - elm_spinner_format_set(). - - Warning The value must to be between min and max values. This values - are set by elm_spinner_min_max_set().]] - set { - } - get { - } - values { - val: double; [[The value to be displayed.]] - } - } @property label_format { [[Control the format string of the displayed label. @@ -232,6 +154,10 @@ class Elm.Spinner (Elm.Layout, Elm.Interface_Atspi_Value, Elm.Interface_Atspi_Wi Elm.Widget.on_focus; Elm.Widget.event; Elm.Layout.sizing_eval; + Efl.Ui.Spin.min_max; + Efl.Ui.Spin.step; + Efl.Ui.Spin.value; + Efl.Ui.Spin.interval; Elm.Interface_Atspi_Accessible.name.get; Elm.Interface_Atspi_Value.value_and_text.get; Elm.Interface_Atspi_Value.value_and_text.set; diff --git a/src/lib/elementary/elm_spinner_legacy.h b/src/lib/elementary/elm_spinner_legacy.h index 1317e9a286..a09c19d14a 100644 --- a/src/lib/elementary/elm_spinner_legacy.h +++ b/src/lib/elementary/elm_spinner_legacy.h @@ -42,4 +42,156 @@ EAPI void elm_spinner_special_value_del(Evas_Object *obj, double value); */ EAPI const char *elm_spinner_special_value_get(Evas_Object *obj, double value); -#include "elm_spinner.eo.legacy.h" \ No newline at end of file +/** + * @brief Control the minimum and maximum values for the spinner. + * + * Define the allowed range of values to be selected by the user. + * + * If actual value is less than @c min, it will be updated to @c min. If it is + * bigger then @c max, will be updated to @c max. Actual value can be get with + * @ref elm_obj_spinner_value_get. + * + * By default, min is equal to 0, and max is equal to 100. + * + * @warning Maximum must be greater than minimum. + * + * @param[in] min The minimum value. + * @param[in] max The maximum value. + * + * @ingroup Elm_Spinner + */ +EAPI void elm_spinner_min_max_set(Evas_Object *obj, double min, double max); + +/** + * @brief Control the minimum and maximum values for the spinner. + * + * Define the allowed range of values to be selected by the user. + * + * If actual value is less than @c min, it will be updated to @c min. If it is + * bigger then @c max, will be updated to @c max. Actual value can be get with + * @ref elm_obj_spinner_value_get. + * + * By default, min is equal to 0, and max is equal to 100. + * + * @warning Maximum must be greater than minimum. + * + * @param[out] min The minimum value. + * @param[out] max The maximum value. + * + * @ingroup Elm_Spinner + */ +EAPI void elm_spinner_min_max_get(const Evas_Object *obj, double *min, double *max); + +/** + * @brief Control the step used to increment or decrement the spinner value. + * + * This value will be incremented or decremented to the displayed value. It + * will be incremented while the user keep right or top arrow pressed, and will + * be decremented while the user keep left or bottom arrow pressed. + * + * The interval to increment / decrement can be set with + * @ref elm_obj_spinner_interval_set. + * + * By default step value is equal to 1. + * + * @param[in] step The step value. + * + * @ingroup Elm_Spinner + */ +EAPI void elm_spinner_step_set(Evas_Object *obj, double step); + +/** + * @brief Control the step used to increment or decrement the spinner value. + * + * This value will be incremented or decremented to the displayed value. It + * will be incremented while the user keep right or top arrow pressed, and will + * be decremented while the user keep left or bottom arrow pressed. + * + * The interval to increment / decrement can be set with + * @ref elm_obj_spinner_interval_set. + * + * By default step value is equal to 1. + * + * @return The step value. + * + * @ingroup Elm_Spinner + */ +EAPI double elm_spinner_step_get(const Evas_Object *obj); + +/** + * @brief Control the interval on time updates for an user mouse button hold on + * spinner widgets' arrows. + * + * This interval value is decreased while the user holds the mouse pointer + * either incrementing or decrementing spinner's value. + * + * This helps the user to get to a given value distant from the current one + * easier/faster, as it will start to change quicker and quicker on mouse + * button holds. + * + * The calculation for the next change interval value, starting from the one + * set with this call, is the previous interval divided by $1.05, so it + * decreases a little bit. + * + * The default starting interval value for automatic changes is $0.85 seconds. + * + * @param[in] interval The (first) interval value in seconds. + * + * @ingroup Elm_Spinner + */ +EAPI void elm_spinner_interval_set(Evas_Object *obj, double interval); + +/** + * @brief Control the interval on time updates for an user mouse button hold on + * spinner widgets' arrows. + * + * This interval value is decreased while the user holds the mouse pointer + * either incrementing or decrementing spinner's value. + * + * This helps the user to get to a given value distant from the current one + * easier/faster, as it will start to change quicker and quicker on mouse + * button holds. + * + * The calculation for the next change interval value, starting from the one + * set with this call, is the previous interval divided by $1.05, so it + * decreases a little bit. + * + * The default starting interval value for automatic changes is $0.85 seconds. + * + * @return The (first) interval value in seconds. + * + * @ingroup Elm_Spinner + */ +EAPI double elm_spinner_interval_get(const Evas_Object *obj); + +/** + * @brief Control the value the spinner displays. + * + * Value will be presented on the label following format specified with + * elm_spinner_format_set(). + * + * Warning The value must to be between min and max values. This values are set + * by elm_spinner_min_max_set(). + * + * @param[in] val The value to be displayed. + * + * @ingroup Elm_Spinner + */ +EAPI void elm_spinner_value_set(Evas_Object *obj, double val); + +/** + * @brief Control the value the spinner displays. + * + * Value will be presented on the label following format specified with + * elm_spinner_format_set(). + * + * Warning The value must to be between min and max values. This values are set + * by elm_spinner_min_max_set(). + * + * @return The value to be displayed. + * + * @ingroup Elm_Spinner + */ +EAPI double elm_spinner_value_get(const Evas_Object *obj); + +#include "elm_spinner.eo.legacy.h" diff --git a/src/lib/elementary/elm_widget_flipselector.h b/src/lib/elementary/elm_widget_flipselector.h index d5ef440fda..1b8b865cff 100644 --- a/src/lib/elementary/elm_widget_flipselector.h +++ b/src/lib/elementary/elm_widget_flipselector.h @@ -35,6 +35,8 @@ struct _Elm_Flipselector_Data unsigned int max_len; double interval, first_interval; + double val_min, val_max; + double step; /**< step for the value change. 1 by default. */ int walking; Eina_Bool evaluating : 1;