From f549d1c2718fa9250a8f4463bcb010eb77ee4794 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 5 Mar 2019 17:00:37 -0500 Subject: [PATCH] elm_clock: remove all legacy usage from eo files this takes the current generated output from eolian for legacy code in efl and adds it to the tree, then removes legacy references from the corresponding eo files. in the case where the entire eo file was for a legacy object, that eo file has been removed from the tree ref T7724 Reviewed-by: Daniel Kolesa Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D8157 --- src/Makefile_Elementary.am | 5 +- src/lib/elementary/elm_clock.c | 2 +- src/lib/elementary/elm_clock.eo | 172 ------------- src/lib/elementary/elm_clock_eo.c | 249 ++++++++++++++++++ src/lib/elementary/elm_clock_eo.h | 305 ++++++++++++++++++++++- src/lib/elementary/elm_clock_eo.legacy.c | 84 +++++++ src/lib/elementary/elm_clock_eo.legacy.h | 281 +++++++++++++++++++++ src/lib/elementary/elm_clock_legacy.h | 2 +- src/lib/elementary/elm_widget_clock.h | 2 +- src/lib/elementary/meson.build | 3 +- 10 files changed, 927 insertions(+), 178 deletions(-) delete mode 100644 src/lib/elementary/elm_clock.eo create mode 100644 src/lib/elementary/elm_clock_eo.c create mode 100644 src/lib/elementary/elm_clock_eo.legacy.c create mode 100644 src/lib/elementary/elm_clock_eo.legacy.h diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am index d998a60b4e..4647a3f5c2 100644 --- a/src/Makefile_Elementary.am +++ b/src/Makefile_Elementary.am @@ -188,7 +188,6 @@ elm_legacy_eolian_files = \ lib/elementary/efl_ui_clock_legacy.eo \ lib/elementary/elm_code_widget_legacy.eo \ lib/elementary/elm_interface_fileselector.eo \ - lib/elementary/elm_clock.eo \ lib/elementary/elm_colorselector.eo \ lib/elementary/elm_conformant.eo \ lib/elementary/elm_ctxpopup.eo \ @@ -336,6 +335,8 @@ lib/elementary/elm_bubble_eo.legacy.c \ lib/elementary/elm_calendar_eo.c \ lib/elementary/elm_calendar_eo.legacy.c \ lib/elementary/elm_calendar_item_eo.c \ +lib/elementary/elm_clock_eo.c \ +lib/elementary/elm_clock_eo.legacy.c \ lib/elementary/elm_hoversel_eo.c \ lib/elementary/elm_hoversel_item_eo.c \ lib/elementary/elm_hoversel_item_eo.legacy.c @@ -396,6 +397,8 @@ lib/elementary/elm_calendar_eo.h \ lib/elementary/elm_calendar_eo.legacy.h \ lib/elementary/elm_calendar_item_eo.h \ lib/elementary/elm_calendar_item_eo.legacy.h \ +lib/elementary/elm_clock_eo.h \ +lib/elementary/elm_clock_eo.legacy.h \ lib/elementary/elm_hoversel_eo.h \ lib/elementary/elm_hoversel_eo.legacy.h \ lib/elementary/elm_hoversel_item_eo.h \ diff --git a/src/lib/elementary/elm_clock.c b/src/lib/elementary/elm_clock.c index 529a280651..948ec7cb4b 100644 --- a/src/lib/elementary/elm_clock.c +++ b/src/lib/elementary/elm_clock.c @@ -964,4 +964,4 @@ _elm_clock_class_constructor(Efl_Class *klass) #define ELM_CLOCK_EXTRA_OPS \ EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_clock) -#include "elm_clock.eo.c" +#include "elm_clock_eo.c" diff --git a/src/lib/elementary/elm_clock.eo b/src/lib/elementary/elm_clock.eo deleted file mode 100644 index 9535c5c415..0000000000 --- a/src/lib/elementary/elm_clock.eo +++ /dev/null @@ -1,172 +0,0 @@ -enum Elm.Clock.Edit_Mode -{ - [[Identifiers for which clock digits should be editable, when a - clock widget is in editing mode. Values may be OR-ed together to - make a mask, naturally. - - See also @Elm.Clock.edit.set, @Elm.Clock.edit_mode.set. - ]] - - legacy: elm_clock_edit; - default = 0, [[Default value. Means that all digits are editable, when in editing mode.]] - hour_decimal = 1 << 0, [[Decimal digit of hours value should be editable.]] - hour_unit = 1 << 1, [[Unit digit of hours value should be editable.]] - min_decimal = 1 << 2, [[Decimal digit of minutes value should be editable.]] - min_unit = 1 << 3, [[Unit digit of minutes value should be editable.]] - sec_decimal = 1 << 4, [[Decimal digit of seconds value should be editable.]] - sec_unit = 1 << 5, [[Unit digit of seconds value should be editable.]] - all = (1 << 6) - 1 [[All digits should be editable.]] -} - -class Elm.Clock extends Efl.Ui.Layout_Base implements Efl.Ui.Focus.Composition, Efl.Ui.Legacy -{ - [[Digital clock widget - - This is a digital clock widget. In its default theme, it has a vintage "flipping numbers clock" - appearance, which will animate sheets of individual algorisms individually as time goes by. - - A newly created clock will fetch system's time (already considering local time adjustments) to - start with, and will tick accordingly. - ]] - legacy_prefix: elm_clock; - eo_prefix: elm_obj_clock; - event_prefix: elm_clock; - methods { - @property show_am_pm { - [[If the given clock widget must show hours in military or am/pm mode - - Set if the clock must show hours in military or am/pm mode. In some - countries like Brazil the military mode (00-24h-format) is used, in - opposition to the USA, where the am/pm mode is more commonly used. - ]] - set { - } - get { - } - values { - am_pm: bool; [[$true to put it in am/pm mode, $false to military mode]] - } - } - @property first_interval { - [[The first interval on time updates for a user mouse button hold - on clock widgets' time editing. - - This interval value is decreased while the user holds the - mouse pointer either incrementing or decrementing a given the - clock digit's value. - - This helps the user to get to a given time 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. - ]] - set { - } - get { - } - values { - interval: double; [[The first interval value in seconds]] - } - } - @property show_seconds { - [[If the given clock widget must show time with seconds or not - - This function sets if the given clock must show or not elapsed - seconds. By default, they are not shown. - ]] - set { - } - get { - } - values { - seconds: bool; [[$true to show seconds, $false otherwise.]] - } - } - @property edit { - [[Whether a given clock widget is under editing mode or - under (default) displaying-only mode. - - This function makes a clock's time to be editable or not by - user interaction. When in editing mode, clocks stop - ticking, until one brings them back to display mode. The - @.edit_mode.set function will influence which digits - of the clock will be editable. - - Note: am/pm sheets, if being shown, will always be editable - under editing mode. - ]] - set { - } - get { - } - values { - edit: bool; [[$true to put it in editing, $false to - put it back to "displaying only" mode]] - } - } - @property pause { - [[Whether the given clock widget should be paused or not. - - This function pauses or starts the clock widget. - - @since 1.9 - ]] - set { - } - get { - } - values { - paused: bool; [[$true to pause clock, $false otherwise]] - } - } - @property time { - [[Clock widget's time - - Values must be set within 0-23 for hours and - 0-59 for minutes and seconds, even if the clock - is not in "military" mode. - ]] - set { - [[Warning: The behavior for values set out of those ranges is - undefined. - ]] - } - get { - [[Note: Use $null pointers on the time values you're not - interested in: they'll be ignored by the function. - ]] - } - values { - hrs: int; [[The hours to set]] - min: int; [[The minutes to set]] - sec: int; [[The seconds to set]] - } - } - @property edit_mode { - [[Digits of the given clock widget should be editable when in editing mode.]] - set { - } - get { - } - values { - digedit: Elm.Clock.Edit_Mode; [[Bit mask indicating the digits to be editable - (values in @Elm.Clock.Edit_Mode).]] - } - } - } - implements { - class.constructor; - Efl.Object.constructor; - Efl.Ui.Widget.on_access_update; - Efl.Ui.Widget.theme_apply; - } - events { - changed: void; [[The clock's user changed the time]] - } -} diff --git a/src/lib/elementary/elm_clock_eo.c b/src/lib/elementary/elm_clock_eo.c new file mode 100644 index 0000000000..e30f3e650d --- /dev/null +++ b/src/lib/elementary/elm_clock_eo.c @@ -0,0 +1,249 @@ +EWAPI const Efl_Event_Description _ELM_CLOCK_EVENT_CHANGED = + EFL_EVENT_DESCRIPTION("changed"); + +void _elm_clock_show_am_pm_set(Eo *obj, Elm_Clock_Data *pd, Eina_Bool am_pm); + + +static Eina_Error +__eolian_elm_clock_show_am_pm_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; Eina_Bool cval; + if (!eina_value_bool_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_clock_show_am_pm_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_clock_show_am_pm_set, EFL_FUNC_CALL(am_pm), Eina_Bool am_pm); + +Eina_Bool _elm_clock_show_am_pm_get(const Eo *obj, Elm_Clock_Data *pd); + + +static Eina_Value +__eolian_elm_clock_show_am_pm_get_reflect(Eo *obj) +{ + Eina_Bool val = elm_obj_clock_show_am_pm_get(obj); + return eina_value_bool_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_clock_show_am_pm_get, Eina_Bool, 0); + +void _elm_clock_first_interval_set(Eo *obj, Elm_Clock_Data *pd, double interval); + + +static Eina_Error +__eolian_elm_clock_first_interval_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; double cval; + if (!eina_value_double_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_clock_first_interval_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_clock_first_interval_set, EFL_FUNC_CALL(interval), double interval); + +double _elm_clock_first_interval_get(const Eo *obj, Elm_Clock_Data *pd); + + +static Eina_Value +__eolian_elm_clock_first_interval_get_reflect(Eo *obj) +{ + double val = elm_obj_clock_first_interval_get(obj); + return eina_value_double_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_clock_first_interval_get, double, 0); + +void _elm_clock_show_seconds_set(Eo *obj, Elm_Clock_Data *pd, Eina_Bool seconds); + + +static Eina_Error +__eolian_elm_clock_show_seconds_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; Eina_Bool cval; + if (!eina_value_bool_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_clock_show_seconds_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_clock_show_seconds_set, EFL_FUNC_CALL(seconds), Eina_Bool seconds); + +Eina_Bool _elm_clock_show_seconds_get(const Eo *obj, Elm_Clock_Data *pd); + + +static Eina_Value +__eolian_elm_clock_show_seconds_get_reflect(Eo *obj) +{ + Eina_Bool val = elm_obj_clock_show_seconds_get(obj); + return eina_value_bool_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_clock_show_seconds_get, Eina_Bool, 0); + +void _elm_clock_edit_set(Eo *obj, Elm_Clock_Data *pd, Eina_Bool edit); + + +static Eina_Error +__eolian_elm_clock_edit_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; Eina_Bool cval; + if (!eina_value_bool_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_clock_edit_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_clock_edit_set, EFL_FUNC_CALL(edit), Eina_Bool edit); + +Eina_Bool _elm_clock_edit_get(const Eo *obj, Elm_Clock_Data *pd); + + +static Eina_Value +__eolian_elm_clock_edit_get_reflect(Eo *obj) +{ + Eina_Bool val = elm_obj_clock_edit_get(obj); + return eina_value_bool_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_clock_edit_get, Eina_Bool, 0); + +void _elm_clock_pause_set(Eo *obj, Elm_Clock_Data *pd, Eina_Bool paused); + + +static Eina_Error +__eolian_elm_clock_pause_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; Eina_Bool cval; + if (!eina_value_bool_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_clock_pause_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_clock_pause_set, EFL_FUNC_CALL(paused), Eina_Bool paused); + +Eina_Bool _elm_clock_pause_get(const Eo *obj, Elm_Clock_Data *pd); + + +static Eina_Value +__eolian_elm_clock_pause_get_reflect(Eo *obj) +{ + Eina_Bool val = elm_obj_clock_pause_get(obj); + return eina_value_bool_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_clock_pause_get, Eina_Bool, 0); + +void _elm_clock_time_set(Eo *obj, Elm_Clock_Data *pd, int hrs, int min, int sec); + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_clock_time_set, EFL_FUNC_CALL(hrs, min, sec), int hrs, int min, int sec); + +void _elm_clock_time_get(const Eo *obj, Elm_Clock_Data *pd, int *hrs, int *min, int *sec); + +EOAPI EFL_VOID_FUNC_BODYV_CONST(elm_obj_clock_time_get, EFL_FUNC_CALL(hrs, min, sec), int *hrs, int *min, int *sec); + +void _elm_clock_edit_mode_set(Eo *obj, Elm_Clock_Data *pd, Elm_Clock_Edit_Mode digedit); + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_clock_edit_mode_set, EFL_FUNC_CALL(digedit), Elm_Clock_Edit_Mode digedit); + +Elm_Clock_Edit_Mode _elm_clock_edit_mode_get(const Eo *obj, Elm_Clock_Data *pd); + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_clock_edit_mode_get, Elm_Clock_Edit_Mode, 0); + +Efl_Object *_elm_clock_efl_object_constructor(Eo *obj, Elm_Clock_Data *pd); + + +void _elm_clock_efl_ui_widget_on_access_update(Eo *obj, Elm_Clock_Data *pd, Eina_Bool enable); + + +Eina_Error _elm_clock_efl_ui_widget_theme_apply(Eo *obj, Elm_Clock_Data *pd); + + +static Eina_Bool +_elm_clock_class_initializer(Efl_Class *klass) +{ + const Efl_Object_Ops *opsp = NULL; + + const Efl_Object_Property_Reflection_Ops *ropsp = NULL; + +#ifndef ELM_CLOCK_EXTRA_OPS +#define ELM_CLOCK_EXTRA_OPS +#endif + + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC(elm_obj_clock_show_am_pm_set, _elm_clock_show_am_pm_set), + EFL_OBJECT_OP_FUNC(elm_obj_clock_show_am_pm_get, _elm_clock_show_am_pm_get), + EFL_OBJECT_OP_FUNC(elm_obj_clock_first_interval_set, _elm_clock_first_interval_set), + EFL_OBJECT_OP_FUNC(elm_obj_clock_first_interval_get, _elm_clock_first_interval_get), + EFL_OBJECT_OP_FUNC(elm_obj_clock_show_seconds_set, _elm_clock_show_seconds_set), + EFL_OBJECT_OP_FUNC(elm_obj_clock_show_seconds_get, _elm_clock_show_seconds_get), + EFL_OBJECT_OP_FUNC(elm_obj_clock_edit_set, _elm_clock_edit_set), + EFL_OBJECT_OP_FUNC(elm_obj_clock_edit_get, _elm_clock_edit_get), + EFL_OBJECT_OP_FUNC(elm_obj_clock_pause_set, _elm_clock_pause_set), + EFL_OBJECT_OP_FUNC(elm_obj_clock_pause_get, _elm_clock_pause_get), + EFL_OBJECT_OP_FUNC(elm_obj_clock_time_set, _elm_clock_time_set), + EFL_OBJECT_OP_FUNC(elm_obj_clock_time_get, _elm_clock_time_get), + EFL_OBJECT_OP_FUNC(elm_obj_clock_edit_mode_set, _elm_clock_edit_mode_set), + EFL_OBJECT_OP_FUNC(elm_obj_clock_edit_mode_get, _elm_clock_edit_mode_get), + EFL_OBJECT_OP_FUNC(efl_constructor, _elm_clock_efl_object_constructor), + EFL_OBJECT_OP_FUNC(efl_ui_widget_on_access_update, _elm_clock_efl_ui_widget_on_access_update), + EFL_OBJECT_OP_FUNC(efl_ui_widget_theme_apply, _elm_clock_efl_ui_widget_theme_apply), + ELM_CLOCK_EXTRA_OPS + ); + opsp = &ops; + + static const Efl_Object_Property_Reflection refl_table[] = { + {"show_am_pm", __eolian_elm_clock_show_am_pm_set_reflect, __eolian_elm_clock_show_am_pm_get_reflect}, + {"first_interval", __eolian_elm_clock_first_interval_set_reflect, __eolian_elm_clock_first_interval_get_reflect}, + {"show_seconds", __eolian_elm_clock_show_seconds_set_reflect, __eolian_elm_clock_show_seconds_get_reflect}, + {"edit", __eolian_elm_clock_edit_set_reflect, __eolian_elm_clock_edit_get_reflect}, + {"pause", __eolian_elm_clock_pause_set_reflect, __eolian_elm_clock_pause_get_reflect}, + }; + static const Efl_Object_Property_Reflection_Ops rops = { + refl_table, EINA_C_ARRAY_LENGTH(refl_table) + }; + ropsp = &rops; + + return efl_class_functions_set(klass, opsp, ropsp); +} + +static const Efl_Class_Description _elm_clock_class_desc = { + EO_VERSION, + "Elm.Clock", + EFL_CLASS_TYPE_REGULAR, + sizeof(Elm_Clock_Data), + _elm_clock_class_initializer, + _elm_clock_class_constructor, + NULL +}; + +EFL_DEFINE_CLASS(elm_clock_class_get, &_elm_clock_class_desc, EFL_UI_LAYOUT_BASE_CLASS, EFL_UI_FOCUS_COMPOSITION_MIXIN, EFL_UI_LEGACY_INTERFACE, NULL); + +#include "elm_clock_eo.legacy.c" diff --git a/src/lib/elementary/elm_clock_eo.h b/src/lib/elementary/elm_clock_eo.h index 2af6c1bf69..0236dd26c4 100644 --- a/src/lib/elementary/elm_clock_eo.h +++ b/src/lib/elementary/elm_clock_eo.h @@ -1 +1,304 @@ -#include "elm_clock.eo.h" \ No newline at end of file +#ifndef _ELM_CLOCK_EO_H_ +#define _ELM_CLOCK_EO_H_ + +#ifndef _ELM_CLOCK_EO_CLASS_TYPE +#define _ELM_CLOCK_EO_CLASS_TYPE + +typedef Eo Elm_Clock; + +#endif + +#ifndef _ELM_CLOCK_EO_TYPES +#define _ELM_CLOCK_EO_TYPES + +/** + * @brief Identifiers for which clock digits should be editable, when a clock + * widget is in editing mode. Values may be OR-ed together to make a mask, + * naturally. + * + * See also @ref elm_obj_clock_edit_set, @ref elm_obj_clock_edit_mode_set. + * + * @ingroup Elm_Clock + */ +typedef enum +{ + ELM_CLOCK_EDIT_DEFAULT = 0, /**< Default value. Means that all digits are + * editable, when in editing mode. */ + ELM_CLOCK_EDIT_HOUR_DECIMAL = 1 /* 1 >> 0 */, /**< Decimal digit of hours + * value should be editable. */ + ELM_CLOCK_EDIT_HOUR_UNIT = 2 /* 1 >> 1 */, /**< Unit digit of hours value + * should be editable. */ + ELM_CLOCK_EDIT_MIN_DECIMAL = 4 /* 1 >> 2 */, /**< Decimal digit of minutes + * value should be editable. */ + ELM_CLOCK_EDIT_MIN_UNIT = 8 /* 1 >> 3 */, /**< Unit digit of minutes value + * should be editable. */ + ELM_CLOCK_EDIT_SEC_DECIMAL = 16 /* 1 >> 4 */, /**< Decimal digit of seconds + * value should be editable. */ + ELM_CLOCK_EDIT_SEC_UNIT = 32 /* 1 >> 5 */, /**< Unit digit of seconds value + * should be editable. */ + ELM_CLOCK_EDIT_ALL = 63 /* (1 >> 6) * 1 */ /**< All digits should be editable. + */ +} Elm_Clock_Edit_Mode; + + +#endif +/** + * @brief Digital clock widget + * + * This is a digital clock widget. In its default theme, it has a vintage + * "flipping numbers clock" appearance, which will animate sheets of individual + * algorisms individually as time goes by. + * + * A newly created clock will fetch system's time (already considering local + * time adjustments) to start with, and will tick accordingly. + * + * @ingroup Elm_Clock + */ +#define ELM_CLOCK_CLASS elm_clock_class_get() + +EWAPI const Efl_Class *elm_clock_class_get(void); + +/** + * @brief If the given clock widget must show hours in military or am/pm mode + * + * Set if the clock must show hours in military or am/pm mode. In some + * countries like Brazil the military mode (00-24h-format) is used, in + * opposition to the USA, where the am/pm mode is more commonly used. + * + * @param[in] obj The object. + * @param[in] am_pm @c true to put it in am/pm mode, @c false to military mode + * + * @ingroup Elm_Clock + */ +EOAPI void elm_obj_clock_show_am_pm_set(Eo *obj, Eina_Bool am_pm); + +/** + * @brief If the given clock widget must show hours in military or am/pm mode + * + * Set if the clock must show hours in military or am/pm mode. In some + * countries like Brazil the military mode (00-24h-format) is used, in + * opposition to the USA, where the am/pm mode is more commonly used. + * + * @param[in] obj The object. + * + * @return @c true to put it in am/pm mode, @c false to military mode + * + * @ingroup Elm_Clock + */ +EOAPI Eina_Bool elm_obj_clock_show_am_pm_get(const Eo *obj); + +/** + * @brief The first interval on time updates for a user mouse button hold on + * clock widgets' time editing. + * + * This interval value is decreased while the user holds the mouse pointer + * either incrementing or decrementing a given the clock digit's value. + * + * This helps the user to get to a given time 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. + * + * @param[in] obj The object. + * @param[in] interval The first interval value in seconds + * + * @ingroup Elm_Clock + */ +EOAPI void elm_obj_clock_first_interval_set(Eo *obj, double interval); + +/** + * @brief The first interval on time updates for a user mouse button hold on + * clock widgets' time editing. + * + * This interval value is decreased while the user holds the mouse pointer + * either incrementing or decrementing a given the clock digit's value. + * + * This helps the user to get to a given time 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. + * + * @param[in] obj The object. + * + * @return The first interval value in seconds + * + * @ingroup Elm_Clock + */ +EOAPI double elm_obj_clock_first_interval_get(const Eo *obj); + +/** + * @brief If the given clock widget must show time with seconds or not + * + * This function sets if the given clock must show or not elapsed seconds. By + * default, they are not shown. + * + * @param[in] obj The object. + * @param[in] seconds @c true to show seconds, @c false otherwise. + * + * @ingroup Elm_Clock + */ +EOAPI void elm_obj_clock_show_seconds_set(Eo *obj, Eina_Bool seconds); + +/** + * @brief If the given clock widget must show time with seconds or not + * + * This function sets if the given clock must show or not elapsed seconds. By + * default, they are not shown. + * + * @param[in] obj The object. + * + * @return @c true to show seconds, @c false otherwise. + * + * @ingroup Elm_Clock + */ +EOAPI Eina_Bool elm_obj_clock_show_seconds_get(const Eo *obj); + +/** + * @brief Whether a given clock widget is under editing mode or under (default) + * displaying-only mode. + * + * This function makes a clock's time to be editable or not by user + * interaction. When in editing mode, clocks stop ticking, until one brings + * them back to display mode. The @ref elm_obj_clock_edit_mode_set function + * will influence which digits of the clock will be editable. + * + * @note am/pm sheets, if being shown, will always be editable under editing + * mode. + * + * @param[in] obj The object. + * @param[in] edit @c true to put it in editing, @c false to put it back to + * "displaying only" mode + * + * @ingroup Elm_Clock + */ +EOAPI void elm_obj_clock_edit_set(Eo *obj, Eina_Bool edit); + +/** + * @brief Whether a given clock widget is under editing mode or under (default) + * displaying-only mode. + * + * This function makes a clock's time to be editable or not by user + * interaction. When in editing mode, clocks stop ticking, until one brings + * them back to display mode. The @ref elm_obj_clock_edit_mode_set function + * will influence which digits of the clock will be editable. + * + * @note am/pm sheets, if being shown, will always be editable under editing + * mode. + * + * @param[in] obj The object. + * + * @return @c true to put it in editing, @c false to put it back to "displaying + * only" mode + * + * @ingroup Elm_Clock + */ +EOAPI Eina_Bool elm_obj_clock_edit_get(const Eo *obj); + +/** + * @brief Whether the given clock widget should be paused or not. + * + * This function pauses or starts the clock widget. + * + * @param[in] obj The object. + * @param[in] paused @c true to pause clock, @c false otherwise + * + * @since 1.9 + * + * @ingroup Elm_Clock + */ +EOAPI void elm_obj_clock_pause_set(Eo *obj, Eina_Bool paused); + +/** + * @brief Whether the given clock widget should be paused or not. + * + * This function pauses or starts the clock widget. + * + * @param[in] obj The object. + * + * @return @c true to pause clock, @c false otherwise + * + * @since 1.9 + * + * @ingroup Elm_Clock + */ +EOAPI Eina_Bool elm_obj_clock_pause_get(const Eo *obj); + +/** + * @brief Clock widget's time + * + * Values must be set within 0-23 for hours and 0-59 for minutes and seconds, + * even if the clock is not in "military" mode. + * + * @warning The behavior for values set out of those ranges is undefined. + * + * @param[in] obj The object. + * @param[in] hrs The hours to set + * @param[in] min The minutes to set + * @param[in] sec The seconds to set + * + * @ingroup Elm_Clock + */ +EOAPI void elm_obj_clock_time_set(Eo *obj, int hrs, int min, int sec); + +/** + * @brief Clock widget's time + * + * Values must be set within 0-23 for hours and 0-59 for minutes and seconds, + * even if the clock is not in "military" mode. + * + * @note Use @c null pointers on the time values you're not interested in: + * they'll be ignored by the function. + * + * @param[in] obj The object. + * @param[out] hrs The hours to set + * @param[out] min The minutes to set + * @param[out] sec The seconds to set + * + * @ingroup Elm_Clock + */ +EOAPI void elm_obj_clock_time_get(const Eo *obj, int *hrs, int *min, int *sec); + +/** + * @brief Digits of the given clock widget should be editable when in editing + * mode. + * + * @param[in] obj The object. + * @param[in] digedit Bit mask indicating the digits to be editable (values in + * @ref Elm_Clock_Edit_Mode). + * + * @ingroup Elm_Clock + */ +EOAPI void elm_obj_clock_edit_mode_set(Eo *obj, Elm_Clock_Edit_Mode digedit); + +/** + * @brief Digits of the given clock widget should be editable when in editing + * mode. + * + * @param[in] obj The object. + * + * @return Bit mask indicating the digits to be editable (values in + * @ref Elm_Clock_Edit_Mode). + * + * @ingroup Elm_Clock + */ +EOAPI Elm_Clock_Edit_Mode elm_obj_clock_edit_mode_get(const Eo *obj); + +EWAPI extern const Efl_Event_Description _ELM_CLOCK_EVENT_CHANGED; + +/** The clock's user changed the time + * + * @ingroup Elm_Clock + */ +#define ELM_CLOCK_EVENT_CHANGED (&(_ELM_CLOCK_EVENT_CHANGED)) + +#endif diff --git a/src/lib/elementary/elm_clock_eo.legacy.c b/src/lib/elementary/elm_clock_eo.legacy.c new file mode 100644 index 0000000000..1764596e17 --- /dev/null +++ b/src/lib/elementary/elm_clock_eo.legacy.c @@ -0,0 +1,84 @@ + +EAPI void +elm_clock_show_am_pm_set(Elm_Clock *obj, Eina_Bool am_pm) +{ + elm_obj_clock_show_am_pm_set(obj, am_pm); +} + +EAPI Eina_Bool +elm_clock_show_am_pm_get(const Elm_Clock *obj) +{ + return elm_obj_clock_show_am_pm_get(obj); +} + +EAPI void +elm_clock_first_interval_set(Elm_Clock *obj, double interval) +{ + elm_obj_clock_first_interval_set(obj, interval); +} + +EAPI double +elm_clock_first_interval_get(const Elm_Clock *obj) +{ + return elm_obj_clock_first_interval_get(obj); +} + +EAPI void +elm_clock_show_seconds_set(Elm_Clock *obj, Eina_Bool seconds) +{ + elm_obj_clock_show_seconds_set(obj, seconds); +} + +EAPI Eina_Bool +elm_clock_show_seconds_get(const Elm_Clock *obj) +{ + return elm_obj_clock_show_seconds_get(obj); +} + +EAPI void +elm_clock_edit_set(Elm_Clock *obj, Eina_Bool edit) +{ + elm_obj_clock_edit_set(obj, edit); +} + +EAPI Eina_Bool +elm_clock_edit_get(const Elm_Clock *obj) +{ + return elm_obj_clock_edit_get(obj); +} + +EAPI void +elm_clock_pause_set(Elm_Clock *obj, Eina_Bool paused) +{ + elm_obj_clock_pause_set(obj, paused); +} + +EAPI Eina_Bool +elm_clock_pause_get(const Elm_Clock *obj) +{ + return elm_obj_clock_pause_get(obj); +} + +EAPI void +elm_clock_time_set(Elm_Clock *obj, int hrs, int min, int sec) +{ + elm_obj_clock_time_set(obj, hrs, min, sec); +} + +EAPI void +elm_clock_time_get(const Elm_Clock *obj, int *hrs, int *min, int *sec) +{ + elm_obj_clock_time_get(obj, hrs, min, sec); +} + +EAPI void +elm_clock_edit_mode_set(Elm_Clock *obj, Elm_Clock_Edit_Mode digedit) +{ + elm_obj_clock_edit_mode_set(obj, digedit); +} + +EAPI Elm_Clock_Edit_Mode +elm_clock_edit_mode_get(const Elm_Clock *obj) +{ + return elm_obj_clock_edit_mode_get(obj); +} diff --git a/src/lib/elementary/elm_clock_eo.legacy.h b/src/lib/elementary/elm_clock_eo.legacy.h new file mode 100644 index 0000000000..957150e1f5 --- /dev/null +++ b/src/lib/elementary/elm_clock_eo.legacy.h @@ -0,0 +1,281 @@ +#ifndef _ELM_CLOCK_EO_LEGACY_H_ +#define _ELM_CLOCK_EO_LEGACY_H_ + +#ifndef _ELM_CLOCK_EO_CLASS_TYPE +#define _ELM_CLOCK_EO_CLASS_TYPE + +typedef Eo Elm_Clock; + +#endif + +#ifndef _ELM_CLOCK_EO_TYPES +#define _ELM_CLOCK_EO_TYPES + +/** + * @brief Identifiers for which clock digits should be editable, when a clock + * widget is in editing mode. Values may be OR-ed together to make a mask, + * naturally. + * + * See also @ref elm_clock_edit_set, @ref elm_clock_edit_mode_set. + * + * @ingroup Elm_Clock + */ +typedef enum +{ + ELM_CLOCK_EDIT_DEFAULT = 0, /**< Default value. Means that all digits are + * editable, when in editing mode. */ + ELM_CLOCK_EDIT_HOUR_DECIMAL = 1 /* 1 >> 0 */, /**< Decimal digit of hours + * value should be editable. */ + ELM_CLOCK_EDIT_HOUR_UNIT = 2 /* 1 >> 1 */, /**< Unit digit of hours value + * should be editable. */ + ELM_CLOCK_EDIT_MIN_DECIMAL = 4 /* 1 >> 2 */, /**< Decimal digit of minutes + * value should be editable. */ + ELM_CLOCK_EDIT_MIN_UNIT = 8 /* 1 >> 3 */, /**< Unit digit of minutes value + * should be editable. */ + ELM_CLOCK_EDIT_SEC_DECIMAL = 16 /* 1 >> 4 */, /**< Decimal digit of seconds + * value should be editable. */ + ELM_CLOCK_EDIT_SEC_UNIT = 32 /* 1 >> 5 */, /**< Unit digit of seconds value + * should be editable. */ + ELM_CLOCK_EDIT_ALL = 63 /* (1 >> 6) * 1 */ /**< All digits should be editable. + */ +} Elm_Clock_Edit_Mode; + + +#endif + +/** + * @brief If the given clock widget must show hours in military or am/pm mode + * + * Set if the clock must show hours in military or am/pm mode. In some + * countries like Brazil the military mode (00-24h-format) is used, in + * opposition to the USA, where the am/pm mode is more commonly used. + * + * @param[in] obj The object. + * @param[in] am_pm @c true to put it in am/pm mode, @c false to military mode + * + * @ingroup Elm_Clock_Group + */ +EAPI void elm_clock_show_am_pm_set(Elm_Clock *obj, Eina_Bool am_pm); + +/** + * @brief If the given clock widget must show hours in military or am/pm mode + * + * Set if the clock must show hours in military or am/pm mode. In some + * countries like Brazil the military mode (00-24h-format) is used, in + * opposition to the USA, where the am/pm mode is more commonly used. + * + * @param[in] obj The object. + * + * @return @c true to put it in am/pm mode, @c false to military mode + * + * @ingroup Elm_Clock_Group + */ +EAPI Eina_Bool elm_clock_show_am_pm_get(const Elm_Clock *obj); + +/** + * @brief The first interval on time updates for a user mouse button hold on + * clock widgets' time editing. + * + * This interval value is decreased while the user holds the mouse pointer + * either incrementing or decrementing a given the clock digit's value. + * + * This helps the user to get to a given time 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. + * + * @param[in] obj The object. + * @param[in] interval The first interval value in seconds + * + * @ingroup Elm_Clock_Group + */ +EAPI void elm_clock_first_interval_set(Elm_Clock *obj, double interval); + +/** + * @brief The first interval on time updates for a user mouse button hold on + * clock widgets' time editing. + * + * This interval value is decreased while the user holds the mouse pointer + * either incrementing or decrementing a given the clock digit's value. + * + * This helps the user to get to a given time 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. + * + * @param[in] obj The object. + * + * @return The first interval value in seconds + * + * @ingroup Elm_Clock_Group + */ +EAPI double elm_clock_first_interval_get(const Elm_Clock *obj); + +/** + * @brief If the given clock widget must show time with seconds or not + * + * This function sets if the given clock must show or not elapsed seconds. By + * default, they are not shown. + * + * @param[in] obj The object. + * @param[in] seconds @c true to show seconds, @c false otherwise. + * + * @ingroup Elm_Clock_Group + */ +EAPI void elm_clock_show_seconds_set(Elm_Clock *obj, Eina_Bool seconds); + +/** + * @brief If the given clock widget must show time with seconds or not + * + * This function sets if the given clock must show or not elapsed seconds. By + * default, they are not shown. + * + * @param[in] obj The object. + * + * @return @c true to show seconds, @c false otherwise. + * + * @ingroup Elm_Clock_Group + */ +EAPI Eina_Bool elm_clock_show_seconds_get(const Elm_Clock *obj); + +/** + * @brief Whether a given clock widget is under editing mode or under (default) + * displaying-only mode. + * + * This function makes a clock's time to be editable or not by user + * interaction. When in editing mode, clocks stop ticking, until one brings + * them back to display mode. The @ref elm_clock_edit_mode_set function will + * influence which digits of the clock will be editable. + * + * @note am/pm sheets, if being shown, will always be editable under editing + * mode. + * + * @param[in] obj The object. + * @param[in] edit @c true to put it in editing, @c false to put it back to + * "displaying only" mode + * + * @ingroup Elm_Clock_Group + */ +EAPI void elm_clock_edit_set(Elm_Clock *obj, Eina_Bool edit); + +/** + * @brief Whether a given clock widget is under editing mode or under (default) + * displaying-only mode. + * + * This function makes a clock's time to be editable or not by user + * interaction. When in editing mode, clocks stop ticking, until one brings + * them back to display mode. The @ref elm_clock_edit_mode_set function will + * influence which digits of the clock will be editable. + * + * @note am/pm sheets, if being shown, will always be editable under editing + * mode. + * + * @param[in] obj The object. + * + * @return @c true to put it in editing, @c false to put it back to "displaying + * only" mode + * + * @ingroup Elm_Clock_Group + */ +EAPI Eina_Bool elm_clock_edit_get(const Elm_Clock *obj); + +/** + * @brief Whether the given clock widget should be paused or not. + * + * This function pauses or starts the clock widget. + * + * @param[in] obj The object. + * @param[in] paused @c true to pause clock, @c false otherwise + * + * @since 1.9 + * + * @ingroup Elm_Clock_Group + */ +EAPI void elm_clock_pause_set(Elm_Clock *obj, Eina_Bool paused); + +/** + * @brief Whether the given clock widget should be paused or not. + * + * This function pauses or starts the clock widget. + * + * @param[in] obj The object. + * + * @return @c true to pause clock, @c false otherwise + * + * @since 1.9 + * + * @ingroup Elm_Clock_Group + */ +EAPI Eina_Bool elm_clock_pause_get(const Elm_Clock *obj); + +/** + * @brief Clock widget's time + * + * Values must be set within 0-23 for hours and 0-59 for minutes and seconds, + * even if the clock is not in "military" mode. + * + * @warning The behavior for values set out of those ranges is undefined. + * + * @param[in] obj The object. + * @param[in] hrs The hours to set + * @param[in] min The minutes to set + * @param[in] sec The seconds to set + * + * @ingroup Elm_Clock_Group + */ +EAPI void elm_clock_time_set(Elm_Clock *obj, int hrs, int min, int sec); + +/** + * @brief Clock widget's time + * + * Values must be set within 0-23 for hours and 0-59 for minutes and seconds, + * even if the clock is not in "military" mode. + * + * @note Use @c null pointers on the time values you're not interested in: + * they'll be ignored by the function. + * + * @param[in] obj The object. + * @param[out] hrs The hours to set + * @param[out] min The minutes to set + * @param[out] sec The seconds to set + * + * @ingroup Elm_Clock_Group + */ +EAPI void elm_clock_time_get(const Elm_Clock *obj, int *hrs, int *min, int *sec); + +/** + * @brief Digits of the given clock widget should be editable when in editing + * mode. + * + * @param[in] obj The object. + * @param[in] digedit Bit mask indicating the digits to be editable (values in + * @ref Elm_Clock_Edit_Mode). + * + * @ingroup Elm_Clock_Group + */ +EAPI void elm_clock_edit_mode_set(Elm_Clock *obj, Elm_Clock_Edit_Mode digedit); + +/** + * @brief Digits of the given clock widget should be editable when in editing + * mode. + * + * @param[in] obj The object. + * + * @return Bit mask indicating the digits to be editable (values in + * @ref Elm_Clock_Edit_Mode). + * + * @ingroup Elm_Clock_Group + */ +EAPI Elm_Clock_Edit_Mode elm_clock_edit_mode_get(const Elm_Clock *obj); + +#endif diff --git a/src/lib/elementary/elm_clock_legacy.h b/src/lib/elementary/elm_clock_legacy.h index 22381ac054..1a777820ab 100644 --- a/src/lib/elementary/elm_clock_legacy.h +++ b/src/lib/elementary/elm_clock_legacy.h @@ -11,4 +11,4 @@ */ EAPI Evas_Object *elm_clock_add(Evas_Object *parent); -#include "elm_clock.eo.legacy.h" \ No newline at end of file +#include "elm_clock_eo.legacy.h" \ No newline at end of file diff --git a/src/lib/elementary/elm_widget_clock.h b/src/lib/elementary/elm_widget_clock.h index 195dab4687..d84d45734a 100644 --- a/src/lib/elementary/elm_widget_clock.h +++ b/src/lib/elementary/elm_widget_clock.h @@ -5,7 +5,7 @@ #include -#include "elm_clock.eo.h" +#include "elm_clock_eo.h" /* DO NOT USE THIS HEADER UNLESS YOU ARE PREPARED FOR BREAKING OF YOUR * CODE. THIS IS ELEMENTARY'S INTERNAL WIDGET API (for now) AND IS NOT diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build index 3ed9a36a09..b625f8c4d9 100644 --- a/src/lib/elementary/meson.build +++ b/src/lib/elementary/meson.build @@ -2,7 +2,6 @@ pub_legacy_eo_files = [ 'efl_ui_clock_legacy.eo', 'elm_code_widget_legacy.eo', 'elm_interface_fileselector.eo', - 'elm_clock.eo', 'elm_colorselector.eo', 'elm_conformant.eo', 'elm_ctxpopup.eo', @@ -728,6 +727,8 @@ elementary_pub_headers = [ 'elm_calendar_eo.legacy.h', 'elm_calendar_item_eo.h', 'elm_calendar_item_eo.legacy.h', + 'elm_clock_eo.h', + 'elm_clock_eo.legacy.h', 'elm_hoversel_eo.h', 'elm_hoversel_eo.legacy.h', 'elm_hoversel_item_eo.h',