diff options
author | Amitesh Singh <amitesh.sh@samsung.com> | 2017-05-16 15:57:16 +0900 |
---|---|---|
committer | Amitesh Singh <amitesh.sh@samsung.com> | 2017-05-16 19:45:56 +0900 |
commit | a818b6bdfd183b38653ae514825394d4850c51ef (patch) | |
tree | 610c66d33c740c4d40235850a5b79e7a30f469be | |
parent | 53735832883bc560d6ac445d0d35737dbeb1a6cf (diff) | |
download | efl-devs/ami/ui_btn.tar.gz |
Add efl autorepeat interfacedevs/ami/ui_btn
-rw-r--r-- | src/Makefile_Efl.am | 1 | ||||
-rw-r--r-- | src/lib/efl/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/lib/efl/Efl.h | 1 | ||||
-rw-r--r-- | src/lib/efl/interfaces/efl_ui_autorepeat.eo | 54 | ||||
-rw-r--r-- | src/lib/elementary/elc_combobox.c | 4 | ||||
-rw-r--r-- | src/lib/elementary/elc_fileselector_button.c | 2 | ||||
-rw-r--r-- | src/lib/elementary/elc_hoversel.c | 2 | ||||
-rw-r--r-- | src/lib/elementary/elm_button.c | 56 | ||||
-rw-r--r-- | src/lib/elementary/elm_button.eo | 68 | ||||
-rw-r--r-- | src/lib/elementary/elm_button_legacy.h | 100 | ||||
-rw-r--r-- | src/lib/elementary/elm_combobox.eo | 2 | ||||
-rw-r--r-- | src/lib/elementary/elm_fileselector_button.eo | 2 | ||||
-rw-r--r-- | src/lib/elementary/elm_hoversel.eo | 2 |
13 files changed, 215 insertions, 80 deletions
diff --git a/src/Makefile_Efl.am b/src/Makefile_Efl.am index a8fbf038c7..5cde197bd2 100644 --- a/src/Makefile_Efl.am +++ b/src/Makefile_Efl.am @@ -59,6 +59,7 @@ efl_eolian_files = \ lib/efl/interfaces/efl_observable.eo \ lib/efl/interfaces/efl_ui_item.eo \ lib/efl/interfaces/efl_ui_menu.eo \ + lib/efl/interfaces/efl_ui_autorepeat.eo \ $(efl_eolian_legacy_files) \ $(NULL) diff --git a/src/lib/efl/CMakeLists.txt b/src/lib/efl/CMakeLists.txt index 359c3f2826..b0391072dd 100644 --- a/src/lib/efl/CMakeLists.txt +++ b/src/lib/efl/CMakeLists.txt @@ -54,6 +54,7 @@ set(PUBLIC_EO_FILES interfaces/efl_ui_menu.eo interfaces/efl_ui_progress.eo interfaces/efl_ui_spin.eo + interfaces/efl_ui_autorepeat.eo interfaces/efl_vpath.eo interfaces/efl_vpath_core.eo interfaces/efl_vpath_file.eo diff --git a/src/lib/efl/Efl.h b/src/lib/efl/Efl.h index bbf8c71cdb..4a3f858d11 100644 --- a/src/lib/efl/Efl.h +++ b/src/lib/efl/Efl.h @@ -85,6 +85,7 @@ typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command; #include "interfaces/efl_ui_progress.eo.h" #include "interfaces/efl_ui_item.eo.h" #include "interfaces/efl_ui_menu.eo.h" +#include "interfaces/efl_ui_autorepeat.eo.h" #include "interfaces/efl_screen.eo.h" diff --git a/src/lib/efl/interfaces/efl_ui_autorepeat.eo b/src/lib/efl/interfaces/efl_ui_autorepeat.eo new file mode 100644 index 0000000000..3116bab99f --- /dev/null +++ b/src/lib/efl/interfaces/efl_ui_autorepeat.eo @@ -0,0 +1,54 @@ +interface Efl.Ui.Autorepeat { + [[Efl UI autorepeat interface]] + methods { + @property initial_timeout { + [[The initial timeout before the autorepeat event is generated + + Sets the timeout, in seconds, since the button is pressed until the + first $repeated signal is emitted. If $t is 0.0 or less, there + won't be any delay and the event will be fired the moment the button is + pressed. + + See also @.enabled.set, @.gap_timeout.set. + ]] + values { + t: double; [[Timeout in seconds]] + } + } + @property gap_timeout { + [[The interval between each generated autorepeat event + + After the first $repeated event is fired, all subsequent ones will + follow after a delay of $t seconds for each. + + See also @.initial_timeout.set. + ]] + values { + t: double; [[Interval in seconds]] + } + } + @property enabled { + [[Turn on/off the autorepeat event generated when the button is kept pressed + + When off, no autorepeat is performed and buttons emit a normal $clicked + signal when they are clicked. + + When on, keeping a button pressed will continuously emit a $repeated + signal until the button is released. The time it takes until it starts + emitting the signal is given by @.initial_timeout.set, and the + time between each new emission by @.gap_timeout.set. + ]] + values { + on: bool; [[A bool to turn on/off the event]] + } + } + @property supported { + [[Whether the button supports autorepeat.]] + get { + } + values { + ret: bool; [[$true if autorepeat is supported, $false otherwise]] + } + } + } +} diff --git a/src/lib/elementary/elc_combobox.c b/src/lib/elementary/elc_combobox.c index 01dc21a05a..0ef2b5e279 100644 --- a/src/lib/elementary/elc_combobox.c +++ b/src/lib/elementary/elc_combobox.c @@ -323,8 +323,8 @@ _elm_combobox_efl_gfx_visible_set(Eo *obj, Elm_Combobox_Data *sd, Eina_Bool vis) } EOLIAN static Eina_Bool -_elm_combobox_elm_button_admits_autorepeat_get(Eo *obj EINA_UNUSED, - Elm_Combobox_Data *sd EINA_UNUSED) +_elm_combobox_efl_ui_autorepeat_supported_get(Eo *obj EINA_UNUSED, + Elm_Combobox_Data *sd EINA_UNUSED) { return EINA_FALSE; } diff --git a/src/lib/elementary/elc_fileselector_button.c b/src/lib/elementary/elc_fileselector_button.c index 2b37fe8c4d..2e57f2e4d0 100644 --- a/src/lib/elementary/elc_fileselector_button.c +++ b/src/lib/elementary/elc_fileselector_button.c @@ -251,7 +251,7 @@ _elm_fileselector_button_efl_canvas_group_group_del(Eo *obj, Elm_Fileselector_Bu } EOLIAN static Eina_Bool -_elm_fileselector_button_elm_button_admits_autorepeat_get(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd EINA_UNUSED) +_elm_fileselector_button_efl_ui_autorepeat_supported_get(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd EINA_UNUSED) { return EINA_FALSE; } diff --git a/src/lib/elementary/elc_hoversel.c b/src/lib/elementary/elc_hoversel.c index e8b673eabe..87f7859ea1 100644 --- a/src/lib/elementary/elc_hoversel.c +++ b/src/lib/elementary/elc_hoversel.c @@ -675,7 +675,7 @@ _elm_hoversel_elm_widget_widget_parent_set(Eo *obj, Elm_Hoversel_Data *_pd EINA_ } EOLIAN static Eina_Bool -_elm_hoversel_elm_button_admits_autorepeat_get(Eo *obj EINA_UNUSED, Elm_Hoversel_Data *sd EINA_UNUSED) +_elm_hoversel_efl_ui_autorepeat_supported_get(Eo *obj EINA_UNUSED, Elm_Hoversel_Data *sd EINA_UNUSED) { return EINA_FALSE; } diff --git a/src/lib/elementary/elm_button.c b/src/lib/elementary/elm_button.c index 5dba423ad9..a56a0b7db4 100644 --- a/src/lib/elementary/elm_button.c +++ b/src/lib/elementary/elm_button.c @@ -343,7 +343,7 @@ _elm_button_efl_object_constructor(Eo *obj, Elm_Button_Data *_pd EINA_UNUSED) } EOLIAN static void -_elm_button_autorepeat_set(Eo *obj EINA_UNUSED, Elm_Button_Data *sd, Eina_Bool on) +_elm_button_efl_ui_autorepeat_enabled_set(Eo *obj EINA_UNUSED, Elm_Button_Data *sd, Eina_Bool on) { ELM_SAFE_FREE(sd->timer, ecore_timer_del); sd->autorepeat = on; @@ -351,30 +351,30 @@ _elm_button_autorepeat_set(Eo *obj EINA_UNUSED, Elm_Button_Data *sd, Eina_Bool o } #define _AR_CAPABLE(obj) \ - (_internal_elm_button_admits_autorepeat_get(obj)) + (_internal_elm_button_autorepeat_supported_get(obj)) static Eina_Bool -_internal_elm_button_admits_autorepeat_get(const Evas_Object *obj) +_internal_elm_button_autorepeat_supported_get(const Evas_Object *obj) { Eina_Bool ret = EINA_FALSE; - ret = elm_obj_button_admits_autorepeat_get((Eo *) obj); + ret = efl_ui_autorepeat_supported_get(obj); return ret; } EOLIAN static Eina_Bool -_elm_button_admits_autorepeat_get(Eo *obj EINA_UNUSED, Elm_Button_Data *_pd EINA_UNUSED) +_elm_button_efl_ui_autorepeat_supported_get(Eo *obj EINA_UNUSED, Elm_Button_Data *_pd EINA_UNUSED) { return EINA_TRUE; } EOLIAN static Eina_Bool -_elm_button_autorepeat_get(Eo *obj, Elm_Button_Data *sd) +_elm_button_efl_ui_autorepeat_enabled_get(Eo *obj, Elm_Button_Data *sd) { return (_AR_CAPABLE(obj) & sd->autorepeat); } EOLIAN static void -_elm_button_autorepeat_initial_timeout_set(Eo *obj, Elm_Button_Data *sd, double t) +_elm_button_efl_ui_autorepeat_initial_timeout_set(Eo *obj, Elm_Button_Data *sd, double t) { if (!_AR_CAPABLE(obj)) { @@ -388,7 +388,7 @@ _elm_button_autorepeat_initial_timeout_set(Eo *obj, Elm_Button_Data *sd, double } EOLIAN static double -_elm_button_autorepeat_initial_timeout_get(Eo *obj, Elm_Button_Data *sd) +_elm_button_efl_ui_autorepeat_initial_timeout_get(Eo *obj, Elm_Button_Data *sd) { if (!_AR_CAPABLE(obj)) return 0.0; @@ -397,7 +397,7 @@ _elm_button_autorepeat_initial_timeout_get(Eo *obj, Elm_Button_Data *sd) } EOLIAN static void -_elm_button_autorepeat_gap_timeout_set(Eo *obj, Elm_Button_Data *sd, double t) +_elm_button_efl_ui_autorepeat_gap_timeout_set(Eo *obj, Elm_Button_Data *sd, double t) { if (!_AR_CAPABLE(obj)) { @@ -412,7 +412,7 @@ _elm_button_autorepeat_gap_timeout_set(Eo *obj, Elm_Button_Data *sd, double t) } EOLIAN static double -_elm_button_autorepeat_gap_timeout_get(Eo *obj EINA_UNUSED, Elm_Button_Data *sd) +_elm_button_efl_ui_autorepeat_gap_timeout_get(Eo *obj EINA_UNUSED, Elm_Button_Data *sd) { return sd->ar_gap_timeout; } @@ -455,4 +455,40 @@ ELM_PART_OVERRIDE_CONTENT_SET(elm_button, ELM_BUTTON, ELM_LAYOUT, Elm_Button_Dat /* Efl.Part end */ +EAPI void +elm_button_autorepeat_initial_timeout_set(Evas_Object *obj, double t) +{ + efl_ui_autorepeat_initial_timeout_set(obj, t); +} + +EAPI double +elm_button_autorepeat_initial_timeout_get(const Evas_Object *obj) +{ + return efl_ui_autorepeat_initial_timeout_get(obj); +} + +EAPI void +elm_button_autorepeat_gap_timeout_set(Evas_Object *obj, double t) +{ + efl_ui_autorepeat_gap_timeout_set(obj, t); +} + +EAPI double +elm_button_autorepeat_gap_timeout_get(const Evas_Object *obj) +{ + return efl_ui_autorepeat_gap_timeout_get(obj); +} + +EAPI void +elm_button_autorepeat_set(Evas_Object *obj, Eina_Bool on) +{ + efl_ui_autorepeat_enabled_set(obj, on); +} + +EAPI Eina_Bool +elm_button_autorepeat_get(const Evas_Object *obj) +{ + return efl_ui_autorepeat_enabled_get(obj); +} + #include "elm_button.eo.c" diff --git a/src/lib/elementary/elm_button.eo b/src/lib/elementary/elm_button.eo index 7ace6b96d8..bc2887886c 100644 --- a/src/lib/elementary/elm_button.eo +++ b/src/lib/elementary/elm_button.eo @@ -1,4 +1,4 @@ -class Elm.Button (Elm.Layout, Efl.Ui.Clickable, Efl.Text, +class Elm.Button (Elm.Layout, Efl.Ui.Clickable, Efl.Ui.Autorepeat, Efl.Text, Elm.Interface.Atspi_Widget_Action) { [[Push-button widget @@ -9,73 +9,15 @@ class Elm.Button (Elm.Layout, Efl.Ui.Clickable, Efl.Text, legacy_prefix: elm_button; eo_prefix: elm_obj_button; methods { - @property autorepeat_initial_timeout { - [[The initial timeout before the autorepeat event is generated - - Sets the timeout, in seconds, since the button is pressed until the - first $repeated signal is emitted. If $t is 0.0 or less, there - won't be any delay and the event will be fired the moment the button is - pressed. - - See also @.autorepeat.set, @.autorepeat_gap_timeout.set. - ]] - set { - } - get { - } - values { - t: double; [[Timeout in seconds]] - } - } - @property autorepeat_gap_timeout { - [[The interval between each generated autorepeat event - - After the first $repeated event is fired, all subsequent ones will - follow after a delay of $t seconds for each. - - See also @.autorepeat_initial_timeout.set. - ]] - set { - } - get { - } - values { - t: double; [[Interval in seconds]] - } - } - @property autorepeat { - [[Turn on/off the autorepeat event generated when the button is kept pressed - - When off, no autorepeat is performed and buttons emit a normal $clicked - signal when they are clicked. - - When on, keeping a button pressed will continuously emit a $repeated - signal until the button is released. The time it takes until it starts - emitting the signal is given by @.autorepeat_initial_timeout.set, and the - time between each new emission by @.autorepeat_gap_timeout.set. - ]] - set { - } - get { - } - values { - on: bool; [[A bool to turn on/off the event]] - } - } - @property admits_autorepeat { - [[Whether the button supports autorepeat.]] - get { - legacy: null; - } - values { - ret: bool; [[$true if autorepeat is supported, $false otherwise]] - } - } } implements { class.constructor; Efl.Object.constructor; Efl.Canvas.Group.group_add; + Efl.Ui.Autorepeat.initial_timeout { set; get; } + Efl.Ui.Autorepeat.gap_timeout { set; get; } + Efl.Ui.Autorepeat.enabled { set; get; } + Efl.Ui.Autorepeat.supported { get;} Elm.Widget.activate; Elm.Widget.focus_next_manager_is; Elm.Widget.focus_direction_manager_is; diff --git a/src/lib/elementary/elm_button_legacy.h b/src/lib/elementary/elm_button_legacy.h index 7901823c5d..ee7fe79eaf 100644 --- a/src/lib/elementary/elm_button_legacy.h +++ b/src/lib/elementary/elm_button_legacy.h @@ -8,4 +8,104 @@ */ EAPI Evas_Object *elm_button_add(Evas_Object *parent); +/** + * @brief The initial timeout before the autorepeat event is generated + * + * Sets the timeout, in seconds, since the button is pressed until the first + * @c repeated signal is emitted. If @c t is 0.0 or less, there won't be any + * delay and the event will be fired the moment the button is pressed. + * + * See also @ref elm_button_autorepeat_set, + * @ref elm_button_autorepeat_gap_timeout_set. + * + * @param[in] t Timeout in seconds + * + * @ingroup Elm_Button + */ + +EAPI void elm_button_autorepeat_initial_timeout_set(Evas_Object *obj, double t); + +/** + * @brief The initial timeout before the autorepeat event is generated + * + * Sets the timeout, in seconds, since the button is pressed until the first + * @c repeated signal is emitted. If @c t is 0.0 or less, there won't be any + * delay and the event will be fired the moment the button is pressed. + * + * See also @ref elm_button_autorepeat_set, + * @ref elm_button_autorepeat_gap_timeout_set. + * + * @return Timeout in seconds + * + * @ingroup Elm_Button + */ + +EAPI double elm_button_autorepeat_initial_timeout_get(const Evas_Object *obj); + +/** + * @brief The interval between each generated autorepeat event + * + * After the first @c repeated event is fired, all subsequent ones will follow + * after a delay of @c t seconds for each. + * + * See also @ref elm_button_autorepeat_initial_timeout_set. + * + * @param[in] t Interval in seconds + * + * @ingroup Elm_Button + */ +EAPI void elm_button_autorepeat_gap_timeout_set(Evas_Object *obj, double t); + +/** + * @brief The interval between each generated autorepeat event + * + * After the first @c repeated event is fired, all subsequent ones will follow + * after a delay of @c t seconds for each. + * + * See also @ref elm_button_autorepeat_initial_timeout_set. + * + * @return Interval in seconds + * + * @ingroup Elm_Button + */ +EAPI double elm_button_autorepeat_gap_timeout_get(const Evas_Object *obj); + +/** + * @brief Turn on/off the autorepeat event generated when the button is kept + * pressed + * + * When off, no autorepeat is performed and buttons emit a normal @c clicked + * signal when they are clicked. + * + * When on, keeping a button pressed will continuously emit a @c repeated + * signal until the button is released. The time it takes until it starts + * emitting the signal is given by @ref elm_button_autorepeat_initial_timeout_set, + * and the time between each new emission by + * @ref elm_button_autorepeat_gap_timeout_set. + * + * @param[in] on A bool to turn on/off the event + * + * @ingroup Elm_Button + */ +EAPI void elm_button_autorepeat_set(Evas_Object *obj, Eina_Bool on); + +/** + * @brief Turn on/off the autorepeat event generated when the button is kept + * pressed + * + * When off, no autorepeat is performed and buttons emit a normal @c clicked + * signal when they are clicked. + * + * When on, keeping a button pressed will continuously emit a @c repeated + * signal until the button is released. The time it takes until it starts + * emitting the signal is given by @ref elm_button_autorepeat_initial_timeout_set, + * and the time between each new emission by + * @ref elm_button_autorepeat_gap_timeout_set. + * + * @return A bool to turn on/off the event + * + * @ingroup Elm_Button + */ +EAPI Eina_Bool elm_button_autorepeat_get(const Evas_Object *obj); + #include "elm_button.eo.legacy.h" diff --git a/src/lib/elementary/elm_combobox.eo b/src/lib/elementary/elm_combobox.eo index 591126e967..d801ce8962 100644 --- a/src/lib/elementary/elm_combobox.eo +++ b/src/lib/elementary/elm_combobox.eo @@ -45,7 +45,7 @@ class Elm.Combobox (Elm.Button, Efl.Ui.Selectable, Elm.Widget.theme_apply; Elm.Widget.translate; Elm.Widget.widget_event; - Elm.Button.admits_autorepeat { get; } + Efl.Ui.Autorepeat.supported { get; } Elm.Genlist.filter { set; } Elm.Interface.Atspi_Widget_Action.elm_actions { get; } } diff --git a/src/lib/elementary/elm_fileselector_button.eo b/src/lib/elementary/elm_fileselector_button.eo index fa24766641..31840fffb4 100644 --- a/src/lib/elementary/elm_fileselector_button.eo +++ b/src/lib/elementary/elm_fileselector_button.eo @@ -7,7 +7,7 @@ class Elm.Fileselector_Button (Elm.Button, Elm.Interface.Fileselector) Efl.Canvas.Group.group_add; Efl.Canvas.Group.group_del; Elm.Widget.theme_apply; - Elm.Button.admits_autorepeat { get; } + Efl.Ui.Autorepeat.supported { get; } Elm.Interface.Fileselector.selected_models { get; } Elm.Interface.Fileselector.expandable { get; set; } Elm.Interface.Fileselector.thumbnail_size { get; set; } diff --git a/src/lib/elementary/elm_hoversel.eo b/src/lib/elementary/elm_hoversel.eo index b82484dfc4..30816d5326 100644 --- a/src/lib/elementary/elm_hoversel.eo +++ b/src/lib/elementary/elm_hoversel.eo @@ -101,7 +101,7 @@ class Elm.Hoversel (Elm.Button, Efl.Ui.Selectable, Elm.Widget.theme_apply; Elm.Widget.translate; Elm.Widget.widget_event; - Elm.Button.admits_autorepeat { get; } + Efl.Ui.Autorepeat.supported { get; } Elm.Interface.Atspi_Widget_Action.elm_actions { get; } } events { |