efl_ui_autorepeat: get rid of supported property

the property should not exist. if something is not supported then do not
inherit from this interface. If something wants to use the button
theme, then this can be easily used via API.

In legacy we already have the situation that things inherit from the
button class. To solve this, the enabled call is disabled on those
widgets, and disable every time it is called.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Differential Revision: https://phab.enlightenment.org/D8805
This commit is contained in:
Marcel Hollerbach 2019-05-02 19:48:29 +02:00
parent abedd9cc09
commit 1baf3ba772
8 changed files with 29 additions and 60 deletions

View File

@ -43,13 +43,5 @@ interface @beta Efl.Ui.Autorepeat {
on: bool; [[A bool to turn on/off the event]]
}
}
@property autorepeat_supported {
[[Whether the button supports autorepeat.]]
get {
}
values {
ret: bool; [[$true if autorepeat is supported, $false otherwise]]
}
}
}
}

View File

@ -279,61 +279,29 @@ _efl_ui_button_efl_ui_autorepeat_autorepeat_enabled_set(Eo *obj EINA_UNUSED, Efl
sd->repeating = EINA_FALSE;
}
#define _AR_CAPABLE(obj) \
(_internal_efl_ui_button_autorepeat_supported_get(obj))
static Eina_Bool
_internal_efl_ui_button_autorepeat_supported_get(const Evas_Object *obj)
{
Eina_Bool ret = EINA_FALSE;
ret = efl_ui_autorepeat_supported_get(obj);
return ret;
}
EOLIAN static Eina_Bool
_efl_ui_button_efl_ui_autorepeat_autorepeat_supported_get(const Eo *obj EINA_UNUSED, Efl_Ui_Button_Data *_pd EINA_UNUSED)
_efl_ui_button_efl_ui_autorepeat_autorepeat_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Button_Data *sd)
{
return EINA_TRUE;
}
EOLIAN static Eina_Bool
_efl_ui_button_efl_ui_autorepeat_autorepeat_enabled_get(const Eo *obj, Efl_Ui_Button_Data *sd)
{
return (_AR_CAPABLE(obj) & sd->autorepeat);
return (sd->autorepeat);
}
EOLIAN static void
_efl_ui_button_efl_ui_autorepeat_autorepeat_initial_timeout_set(Eo *obj, Efl_Ui_Button_Data *sd, double t)
_efl_ui_button_efl_ui_autorepeat_autorepeat_initial_timeout_set(Eo *obj EINA_UNUSED, Efl_Ui_Button_Data *sd, double t)
{
if (!_AR_CAPABLE(obj))
{
ERR("this widget does not support auto repetition of clicks.");
return;
}
if (EINA_DBL_EQ(sd->ar_initial_timeout, t)) return;
ELM_SAFE_FREE(sd->timer, ecore_timer_del);
sd->ar_initial_timeout = t;
}
EOLIAN static double
_efl_ui_button_efl_ui_autorepeat_autorepeat_initial_timeout_get(const Eo *obj, Efl_Ui_Button_Data *sd)
_efl_ui_button_efl_ui_autorepeat_autorepeat_initial_timeout_get(const Eo *obj EINA_UNUSED, Efl_Ui_Button_Data *sd)
{
if (!_AR_CAPABLE(obj))
return 0.0;
else
return sd->ar_initial_timeout;
return sd->ar_initial_timeout;
}
EOLIAN static void
_efl_ui_button_efl_ui_autorepeat_autorepeat_gap_timeout_set(Eo *obj, Efl_Ui_Button_Data *sd, double t)
_efl_ui_button_efl_ui_autorepeat_autorepeat_gap_timeout_set(Eo *obj EINA_UNUSED, Efl_Ui_Button_Data *sd, double t)
{
if (!_AR_CAPABLE(obj))
{
ERR("this widget does not support auto repetition of clicks.");
return;
}
if (EINA_DBL_EQ(sd->ar_gap_timeout, t)) return;
sd->ar_gap_timeout = t;

View File

@ -13,7 +13,6 @@ class @beta Efl.Ui.Button extends Efl.Ui.Layout_Base implements Efl.Ui.Clickable
Efl.Ui.Autorepeat.autorepeat_initial_timeout { set; get; }
Efl.Ui.Autorepeat.autorepeat_gap_timeout { set; get; }
Efl.Ui.Autorepeat.autorepeat_enabled { set; get; }
Efl.Ui.Autorepeat.autorepeat_supported { get;}
Efl.Ui.Widget.on_access_activate;
Efl.Ui.Widget.widget_input_event_handler;
Efl.Access.Widget.Action.elm_actions { get; }

View File

@ -364,11 +364,14 @@ _elm_combobox_efl_gfx_entity_visible_set(Eo *obj, Elm_Combobox_Data *sd, Eina_Bo
}
}
EOLIAN static Eina_Bool
_elm_combobox_efl_ui_autorepeat_autorepeat_supported_get(const Eo *obj EINA_UNUSED,
Elm_Combobox_Data *sd EINA_UNUSED)
EOLIAN static void
_elm_combobox_efl_ui_autorepeat_autorepeat_enabled_set(const Eo *obj EINA_UNUSED,
Elm_Combobox_Data *sd EINA_UNUSED,
Eina_Bool enabled)
{
return EINA_FALSE;
if (enabled)
ERR("You cannot enable autorepeat on this object");
efl_ui_autorepeat_enabled_set(efl_super(obj, MY_CLASS), EINA_FALSE);
}
EAPI Evas_Object *
@ -389,6 +392,7 @@ _elm_combobox_efl_object_constructor(Eo *obj, Elm_Combobox_Data *sd)
sd->first_filter = EINA_TRUE;
efl_ui_autorepeat_enabled_set(obj, EINA_FALSE);
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
efl_access_object_role_set(obj, EFL_ACCESS_ROLE_GLASS_PANE);
@ -609,7 +613,7 @@ _elm_combobox_class_initializer(Efl_Class *klass)
EFL_OBJECT_OP_FUNC(efl_ui_widget_theme_apply, _elm_combobox_efl_ui_widget_theme_apply),
EFL_OBJECT_OP_FUNC(efl_ui_l10n_translation_update, _elm_combobox_efl_ui_l10n_translation_update),
EFL_OBJECT_OP_FUNC(efl_ui_widget_input_event_handler, _elm_combobox_efl_ui_widget_widget_input_event_handler),
EFL_OBJECT_OP_FUNC(efl_ui_autorepeat_supported_get, _elm_combobox_efl_ui_autorepeat_autorepeat_supported_get),
EFL_OBJECT_OP_FUNC(efl_ui_autorepeat_enabled_set, _elm_combobox_efl_ui_autorepeat_autorepeat_enabled_set),
EFL_OBJECT_OP_FUNC(elm_obj_genlist_filter_set, _elm_combobox_elm_genlist_filter_set),
EFL_OBJECT_OP_FUNC(efl_access_widget_action_elm_actions_get, _elm_combobox_efl_access_widget_action_elm_actions_get),
EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_combobox)

View File

@ -254,10 +254,12 @@ _elm_fileselector_button_efl_canvas_group_group_del(Eo *obj, Elm_Fileselector_Bu
efl_canvas_group_del(efl_super(obj, MY_CLASS));
}
EOLIAN static Eina_Bool
_elm_fileselector_button_efl_ui_autorepeat_autorepeat_supported_get(const Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd EINA_UNUSED)
EOLIAN static void
_elm_fileselector_button_efl_ui_autorepeat_autorepeat_enabled_set(const Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd EINA_UNUSED, Eina_Bool enabled)
{
return EINA_FALSE;
if (enabled)
ERR("You cannot enable autorepeat on this object");
efl_ui_autorepeat_enabled_set(efl_super(obj, MY_CLASS), EINA_FALSE);
}
EAPI Evas_Object *
@ -273,6 +275,7 @@ _elm_fileselector_button_efl_object_constructor(Eo *obj, Elm_Fileselector_Button
obj = efl_constructor(efl_super(obj, MY_CLASS));
sd->obj = obj;
efl_ui_autorepeat_enabled_set(obj, EINA_FALSE);
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
efl_access_object_role_set(obj, EFL_ACCESS_ROLE_PUSH_BUTTON);

View File

@ -681,10 +681,12 @@ _elm_hoversel_efl_gfx_entity_visible_set(Eo *obj, Elm_Hoversel_Data *sd, Eina_Bo
efl_gfx_entity_visible_set(sd->hover, vis);
}
EOLIAN static Eina_Bool
_elm_hoversel_efl_ui_autorepeat_autorepeat_supported_get(const Eo *obj EINA_UNUSED, Elm_Hoversel_Data *sd EINA_UNUSED)
EOLIAN static void
_elm_hoversel_efl_ui_autorepeat_autorepeat_enabled_set(const Eo *obj EINA_UNUSED, Elm_Hoversel_Data *sd EINA_UNUSED, Eina_Bool enabled)
{
return EINA_FALSE;
if (enabled)
ERR("You cannot enable autorepeat on this object");
efl_ui_autorepeat_enabled_set(efl_super(obj, MY_CLASS), EINA_FALSE);
}
EAPI Evas_Object *
@ -698,6 +700,7 @@ EOLIAN static Eo *
_elm_hoversel_efl_object_constructor(Eo *obj, Elm_Hoversel_Data *_pd EINA_UNUSED)
{
obj = efl_constructor(efl_super(obj, MY_CLASS));
efl_ui_autorepeat_enabled_set(obj, EINA_FALSE);
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
efl_access_object_role_set(obj, EFL_ACCESS_ROLE_PUSH_BUTTON);

View File

@ -102,7 +102,7 @@ _elm_fileselector_button_class_initializer(Efl_Class *klass)
EFL_OPS_DEFINE(ops,
EFL_OBJECT_OP_FUNC(efl_constructor, _elm_fileselector_button_efl_object_constructor),
EFL_OBJECT_OP_FUNC(efl_ui_widget_theme_apply, _elm_fileselector_button_efl_ui_widget_theme_apply),
EFL_OBJECT_OP_FUNC(efl_ui_autorepeat_supported_get, _elm_fileselector_button_efl_ui_autorepeat_autorepeat_supported_get),
EFL_OBJECT_OP_FUNC(efl_ui_autorepeat_enabled_set, _elm_fileselector_button_efl_ui_autorepeat_autorepeat_enabled_set),
EFL_OBJECT_OP_FUNC(elm_interface_fileselector_selected_models_get, _elm_fileselector_button_elm_interface_fileselector_selected_models_get),
EFL_OBJECT_OP_FUNC(elm_interface_fileselector_expandable_set, _elm_fileselector_button_elm_interface_fileselector_expandable_set),
EFL_OBJECT_OP_FUNC(elm_interface_fileselector_expandable_get, _elm_fileselector_button_elm_interface_fileselector_expandable_get),

View File

@ -160,7 +160,7 @@ _elm_hoversel_class_initializer(Efl_Class *klass)
EFL_OBJECT_OP_FUNC(efl_ui_widget_theme_apply, _elm_hoversel_efl_ui_widget_theme_apply),
EFL_OBJECT_OP_FUNC(efl_ui_l10n_translation_update, _elm_hoversel_efl_ui_l10n_translation_update),
EFL_OBJECT_OP_FUNC(efl_ui_widget_input_event_handler, _elm_hoversel_efl_ui_widget_widget_input_event_handler),
EFL_OBJECT_OP_FUNC(efl_ui_autorepeat_supported_get, _elm_hoversel_efl_ui_autorepeat_autorepeat_supported_get),
EFL_OBJECT_OP_FUNC(efl_ui_autorepeat_enabled_set, _elm_hoversel_efl_ui_autorepeat_autorepeat_enabled_set),
EFL_OBJECT_OP_FUNC(efl_access_widget_action_elm_actions_get, _elm_hoversel_efl_access_widget_action_elm_actions_get),
EFL_OBJECT_OP_FUNC(efl_access_object_access_children_get, _elm_hoversel_efl_access_object_access_children_get),
ELM_HOVERSEL_EXTRA_OPS