From 6aa309ffb80a30ce7049d744f2d5abcc2a70b42c Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Thu, 24 Aug 2017 14:06:32 +0900 Subject: [PATCH] widget: Rename hook "disable" (EO) Renamed to on_disabled_update. Also passed in the new state of disabled. It's more convenient this way, than having the subclasses call disabled_get. Also simplify some code... Ref T5363 --- src/lib/elementary/efl_ui_clock.c | 9 ++--- src/lib/elementary/efl_ui_clock.eo | 2 +- src/lib/elementary/efl_ui_layout.c | 8 ++-- src/lib/elementary/efl_ui_layout.eo | 2 +- src/lib/elementary/efl_ui_text.c | 29 ++++++-------- src/lib/elementary/efl_ui_text.eo | 2 +- src/lib/elementary/efl_ui_win.c | 2 +- src/lib/elementary/elc_ctxpopup.c | 12 ++---- src/lib/elementary/elc_fileselector_entry.c | 15 +++---- src/lib/elementary/elm_ctxpopup.eo | 2 +- src/lib/elementary/elm_entry.c | 29 ++++++-------- src/lib/elementary/elm_entry.eo | 2 +- src/lib/elementary/elm_fileselector_entry.eo | 2 +- src/lib/elementary/elm_gesture_layer.c | 4 +- src/lib/elementary/elm_gesture_layer.eo | 2 +- src/lib/elementary/elm_list.c | 9 ++--- src/lib/elementary/elm_list.eo | 2 +- src/lib/elementary/elm_panel.c | 9 ++--- src/lib/elementary/elm_panel.eo | 2 +- src/lib/elementary/elm_segment_control.c | 7 ++-- src/lib/elementary/elm_segment_control.eo | 2 +- src/lib/elementary/elm_widget.c | 58 +++++++--------------------- src/lib/elementary/elm_widget.eo | 31 +++++++++++++-- 23 files changed, 108 insertions(+), 134 deletions(-) diff --git a/src/lib/elementary/efl_ui_clock.c b/src/lib/elementary/efl_ui_clock.c index 8cd7f00..7f3993a 100644 --- a/src/lib/elementary/efl_ui_clock.c +++ b/src/lib/elementary/efl_ui_clock.c @@ -530,19 +530,18 @@ _efl_ui_clock_elm_widget_on_focus(Eo *obj, Efl_Ui_Clock_Data *sd, Elm_Object_Ite } EOLIAN static Eina_Bool -_efl_ui_clock_elm_widget_disable(Eo *obj, Efl_Ui_Clock_Data *sd) +_efl_ui_clock_elm_widget_on_disabled_update(Eo *obj, Efl_Ui_Clock_Data *sd, Eina_Bool disabled) { Clock_Field *field; unsigned int idx = 0; - Eina_Bool int_ret = EINA_FALSE; - int_ret = elm_obj_widget_disable(efl_super(obj, MY_CLASS)); - if (!int_ret) return EINA_FALSE; + if (!elm_obj_widget_on_disabled_update(efl_super(obj, MY_CLASS), disabled)) + return EINA_FALSE; for (idx = 0; idx < EFL_UI_CLOCK_TYPE_COUNT; idx++) { field = sd->field_list + idx; - elm_object_disabled_set(field->item_obj, elm_object_disabled_get(obj)); + elm_object_disabled_set(field->item_obj, disabled); } return EINA_TRUE; } diff --git a/src/lib/elementary/efl_ui_clock.eo b/src/lib/elementary/efl_ui_clock.eo index dbc735b..8564ceb 100644 --- a/src/lib/elementary/efl_ui_clock.eo +++ b/src/lib/elementary/efl_ui_clock.eo @@ -247,7 +247,7 @@ class Efl.Ui.Clock (Efl.Ui.Layout) Elm.Widget.theme_apply; Elm.Widget.focus_next_manager_is; Elm.Widget.focus_next; - Elm.Widget.disable; + Elm.Widget.on_disabled_update; Elm.Widget.on_focus; Elm.Widget.translate; } diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c index 45996df..753c3e4 100644 --- a/src/lib/elementary/efl_ui_layout.c +++ b/src/lib/elementary/efl_ui_layout.c @@ -327,7 +327,7 @@ _visuals_refresh(Evas_Object *obj, _efl_ui_layout_highlight_in_theme(obj); - ret = elm_obj_widget_disable(obj); + ret = elm_obj_widget_on_disabled_update(obj, elm_widget_disabled_get(obj)); elm_layout_sizing_eval(obj); @@ -335,11 +335,13 @@ _visuals_refresh(Evas_Object *obj, } EOLIAN static Eina_Bool -_efl_ui_layout_elm_widget_disable(Eo *obj, Efl_Ui_Layout_Data *_pd EINA_UNUSED) +_efl_ui_layout_elm_widget_on_disabled_update(Eo *obj, Efl_Ui_Layout_Data *_pd EINA_UNUSED, Eina_Bool disabled) { ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); - if (elm_object_disabled_get(obj)) + // Not calling efl_super here: Elm.Widget simply returns false. + + if (disabled) edje_object_signal_emit (wd->resize_obj, "elm,state,disabled", "elm"); else diff --git a/src/lib/elementary/efl_ui_layout.eo b/src/lib/elementary/efl_ui_layout.eo index 828929c..e7f3501 100644 --- a/src/lib/elementary/efl_ui_layout.eo +++ b/src/lib/elementary/efl_ui_layout.eo @@ -64,7 +64,7 @@ class Efl.Ui.Layout (Elm.Widget, Efl.Part, Efl.Container, Efl.File, Elm.Widget.focus_direction_manager_is; Elm.Widget.focus_next_manager_is; Elm.Widget.focus_next; - Elm.Widget.disable; + Elm.Widget.on_disabled_update; Elm.Widget.widget_sub_object_del; Elm.Widget.on_focus; Efl.Container.content_count; diff --git a/src/lib/elementary/efl_ui_text.c b/src/lib/elementary/efl_ui_text.c index 2d0bbaa..c03f54d 100644 --- a/src/lib/elementary/efl_ui_text.c +++ b/src/lib/elementary/efl_ui_text.c @@ -843,32 +843,27 @@ _get_drop_format(Evas_Object *obj) /* we can't reuse layout's here, because it's on entry_edje only */ EOLIAN static Eina_Bool -_efl_ui_text_elm_widget_disable(Eo *obj, Efl_Ui_Text_Data *sd) +_efl_ui_text_elm_widget_on_disabled_update(Eo *obj, Efl_Ui_Text_Data *sd, Eina_Bool disabled) { + const char *emission ; + elm_drop_target_del(obj, sd->drop_format, _dnd_enter_cb, NULL, _dnd_leave_cb, NULL, _dnd_pos_cb, NULL, _dnd_drop_cb, NULL); - if (elm_object_disabled_get(obj)) + + emission = disabled ? "elm,state,disabled" : "elm,state,enabled"; + edje_object_signal_emit(sd->entry_edje, emission, "elm"); + if (sd->scroll) { - edje_object_signal_emit(sd->entry_edje, "elm,state,disabled", "elm"); - if (sd->scroll) - { - edje_object_signal_emit(sd->scr_edje, "elm,state,disabled", "elm"); - elm_interface_scrollable_freeze_set(obj, EINA_TRUE); - } - sd->disabled = EINA_TRUE; + edje_object_signal_emit(sd->scr_edje, emission, "elm"); + elm_interface_scrollable_freeze_set(obj, disabled); } - else + sd->disabled = disabled; + + if (!disabled) { - edje_object_signal_emit(sd->entry_edje, "elm,state,enabled", "elm"); - if (sd->scroll) - { - edje_object_signal_emit(sd->scr_edje, "elm,state,enabled", "elm"); - elm_interface_scrollable_freeze_set(obj, EINA_FALSE); - } - sd->disabled = EINA_FALSE; sd->drop_format = _get_drop_format(obj); elm_drop_target_add(obj, sd->drop_format, _dnd_enter_cb, NULL, diff --git a/src/lib/elementary/efl_ui_text.eo b/src/lib/elementary/efl_ui_text.eo index 0c3d5ad..66993e4 100644 --- a/src/lib/elementary/efl_ui_text.eo +++ b/src/lib/elementary/efl_ui_text.eo @@ -412,7 +412,7 @@ class Efl.Ui.Text (Efl.Ui.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable, Elm.Widget.theme_apply; Elm.Widget.on_focus; Elm.Widget.on_focus_region; - Elm.Widget.disable; + Elm.Widget.on_disabled_update; Elm.Widget.widget_sub_object_del; Elm.Widget.focus_next_manager_is; Elm.Interface_Scrollable.policy { set; } diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index 67c5a2d..dafdb09 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -6313,7 +6313,7 @@ _elm_win_theme_internal(Eo *obj, Efl_Ui_Win_Data *sd) efl_ui_scale_get(obj) * elm_config_scale_get()); efl_event_callback_legacy_call(obj, EFL_UI_WIN_EVENT_THEME_CHANGED, NULL); - ret = elm_obj_widget_disable(obj); + ret = elm_obj_widget_on_disabled_update(obj, elm_widget_disabled_get(obj)); if (!ret) int_ret = EFL_UI_THEME_APPLY_FAILED; diff --git a/src/lib/elementary/elc_ctxpopup.c b/src/lib/elementary/elc_ctxpopup.c index eb2e14f..d80bb3e 100644 --- a/src/lib/elementary/elc_ctxpopup.c +++ b/src/lib/elementary/elc_ctxpopup.c @@ -1091,16 +1091,12 @@ _elm_ctxpopup_item_efl_object_destructor(Eo *eo_ctxpopup_it, } EOLIAN static Eina_Bool -_elm_ctxpopup_elm_widget_disable(Eo *obj, Elm_Ctxpopup_Data *sd) +_elm_ctxpopup_elm_widget_on_disabled_update(Eo *obj, Elm_Ctxpopup_Data *sd, Eina_Bool disabled) { - Eina_Bool int_ret = EINA_FALSE; + if (!elm_obj_widget_on_disabled_update(efl_super(obj, MY_CLASS), disabled)) + return EINA_FALSE; - int_ret = elm_obj_widget_disable(efl_super(obj, MY_CLASS)); - if (!int_ret) return EINA_FALSE; - if (sd->list) - elm_object_disabled_set(sd->list, elm_widget_disabled_get(obj)); - else if (sd->content) - elm_object_disabled_set(sd->content, elm_widget_disabled_get(obj)); + elm_object_disabled_set(sd->list ?: sd->content, disabled); return EINA_TRUE; } diff --git a/src/lib/elementary/elc_fileselector_entry.c b/src/lib/elementary/elc_fileselector_entry.c index b75e7af..6603bab 100644 --- a/src/lib/elementary/elc_fileselector_entry.c +++ b/src/lib/elementary/elc_fileselector_entry.c @@ -239,18 +239,13 @@ _elm_fileselector_entry_elm_widget_theme_apply(Eo *obj, Elm_Fileselector_Entry_D } EOLIAN static Eina_Bool -_elm_fileselector_entry_elm_widget_disable(Eo *obj, Elm_Fileselector_Entry_Data *sd) +_elm_fileselector_entry_elm_widget_on_disabled_update(Eo *obj, Elm_Fileselector_Entry_Data *sd, Eina_Bool disabled) { - Eina_Bool val; - - Eina_Bool int_ret = EINA_FALSE; - int_ret = elm_obj_widget_disable(efl_super(obj, MY_CLASS)); - if (!int_ret) return EINA_FALSE; - - val = elm_widget_disabled_get(obj); + if (!elm_obj_widget_on_disabled_update(efl_super(obj, MY_CLASS), disabled)) + return EINA_FALSE; - elm_widget_disabled_set(sd->button, val); - elm_widget_disabled_set(sd->entry, val); + elm_widget_disabled_set(sd->button, disabled); + elm_widget_disabled_set(sd->entry, disabled); return EINA_TRUE; } diff --git a/src/lib/elementary/elm_ctxpopup.eo b/src/lib/elementary/elm_ctxpopup.eo index bbf06b1..0b0ac9b 100644 --- a/src/lib/elementary/elm_ctxpopup.eo +++ b/src/lib/elementary/elm_ctxpopup.eo @@ -206,7 +206,7 @@ class Elm.Ctxpopup (Efl.Ui.Layout, Elm.Interface.Atspi_Widget_Action, Elm.Widget.focus_direction_manager_is; Elm.Widget.focus_next_manager_is; Elm.Widget.focus_next; - Elm.Widget.disable; + Elm.Widget.on_disabled_update; Elm.Widget.widget_sub_object_add; Elm.Widget.translate; Elm.Widget.theme_apply; diff --git a/src/lib/elementary/elm_entry.c b/src/lib/elementary/elm_entry.c index 7862ffb..c1e9abb 100644 --- a/src/lib/elementary/elm_entry.c +++ b/src/lib/elementary/elm_entry.c @@ -791,32 +791,27 @@ _get_drop_format(Evas_Object *obj) /* we can't reuse layout's here, because it's on entry_edje only */ EOLIAN static Eina_Bool -_elm_entry_elm_widget_disable(Eo *obj, Elm_Entry_Data *sd) +_elm_entry_elm_widget_on_disabled_update(Eo *obj, Elm_Entry_Data *sd, Eina_Bool disabled) { + const char *emission; + elm_drop_target_del(obj, sd->drop_format, _dnd_enter_cb, NULL, _dnd_leave_cb, NULL, _dnd_pos_cb, NULL, _dnd_drop_cb, NULL); - if (elm_object_disabled_get(obj)) + + emission = disabled ? "elm,state,disabled" : "elm,state,enabled"; + edje_object_signal_emit(sd->entry_edje, emission, "elm"); + if (sd->scroll) { - edje_object_signal_emit(sd->entry_edje, "elm,state,disabled", "elm"); - if (sd->scroll) - { - edje_object_signal_emit(sd->scr_edje, "elm,state,disabled", "elm"); - elm_interface_scrollable_freeze_set(obj, EINA_TRUE); - } - sd->disabled = EINA_TRUE; + edje_object_signal_emit(sd->scr_edje, emission, "elm"); + elm_interface_scrollable_freeze_set(obj, disabled); } - else + sd->disabled = disabled; + + if (!disabled) { - edje_object_signal_emit(sd->entry_edje, "elm,state,enabled", "elm"); - if (sd->scroll) - { - edje_object_signal_emit(sd->scr_edje, "elm,state,enabled", "elm"); - elm_interface_scrollable_freeze_set(obj, EINA_FALSE); - } - sd->disabled = EINA_FALSE; sd->drop_format = _get_drop_format(obj); elm_drop_target_add(obj, sd->drop_format, _dnd_enter_cb, NULL, diff --git a/src/lib/elementary/elm_entry.eo b/src/lib/elementary/elm_entry.eo index 6fdc418..87a9ebe 100644 --- a/src/lib/elementary/elm_entry.eo +++ b/src/lib/elementary/elm_entry.eo @@ -962,7 +962,7 @@ class Elm.Entry (Efl.Ui.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable, Elm.Widget.theme_apply; Elm.Widget.on_focus; Elm.Widget.on_focus_region; - Elm.Widget.disable; + Elm.Widget.on_disabled_update; Elm.Widget.widget_sub_object_del; Elm.Widget.focus_next_manager_is; Elm.Interface_Scrollable.policy { set; } diff --git a/src/lib/elementary/elm_fileselector_entry.eo b/src/lib/elementary/elm_fileselector_entry.eo index 23a316a..585d519 100644 --- a/src/lib/elementary/elm_fileselector_entry.eo +++ b/src/lib/elementary/elm_fileselector_entry.eo @@ -9,7 +9,7 @@ class Elm.Fileselector_Entry (Efl.Ui.Layout, Elm.Interface.Fileselector, Elm.Widget.theme_apply; Elm.Widget.focus_next_manager_is; Elm.Widget.focus_next; - Elm.Widget.disable; + Elm.Widget.on_disabled_update; Elm.Widget.focus_direction_manager_is; Elm.Interface.Fileselector.selected_model_get; Elm.Interface.Fileselector.selected_model_set; diff --git a/src/lib/elementary/elm_gesture_layer.c b/src/lib/elementary/elm_gesture_layer.c index 7371b60..750e7e7 100644 --- a/src/lib/elementary/elm_gesture_layer.c +++ b/src/lib/elementary/elm_gesture_layer.c @@ -3739,9 +3739,9 @@ _rotate_test(Evas_Object *obj, } EOLIAN static Eina_Bool -_elm_gesture_layer_elm_widget_disable(Eo *obj, Elm_Gesture_Layer_Data *_pd EINA_UNUSED) +_elm_gesture_layer_elm_widget_on_disabled_update(Eo *obj, Elm_Gesture_Layer_Data *_pd EINA_UNUSED, Eina_Bool disabled) { - if (elm_widget_disabled_get(obj)) + if (disabled) _callbacks_unregister(obj); else _callbacks_register(obj); diff --git a/src/lib/elementary/elm_gesture_layer.eo b/src/lib/elementary/elm_gesture_layer.eo index 55d7bcd..3406b88 100644 --- a/src/lib/elementary/elm_gesture_layer.eo +++ b/src/lib/elementary/elm_gesture_layer.eo @@ -162,6 +162,6 @@ class Elm.Gesture_Layer (Elm.Widget) implements { class.constructor; Efl.Object.constructor; - Elm.Widget.disable; + Elm.Widget.on_disabled_update; } } diff --git a/src/lib/elementary/elm_list.c b/src/lib/elementary/elm_list.c index fa56185..0532396 100644 --- a/src/lib/elementary/elm_list.c +++ b/src/lib/elementary/elm_list.c @@ -1033,13 +1033,12 @@ _show_region_hook(void *data EINA_UNUSED, Evas_Object *obj, Eina_Rectangle r) } EOLIAN static Eina_Bool -_elm_list_elm_widget_disable(Eo *obj, Elm_List_Data *sd) +_elm_list_elm_widget_on_disabled_update(Eo *obj, Elm_List_Data *sd, Eina_Bool disabled) { - Eina_Bool int_ret = EINA_FALSE; - int_ret = elm_obj_widget_disable(efl_super(obj, MY_CLASS)); - if (!int_ret) return EINA_FALSE; + if (!elm_obj_widget_on_disabled_update(efl_super(obj, MY_CLASS), disabled)) + return EINA_FALSE; - if (elm_widget_disabled_get(obj)) + if (disabled) { elm_widget_scroll_freeze_push(obj); elm_widget_scroll_hold_push(obj); diff --git a/src/lib/elementary/elm_list.eo b/src/lib/elementary/elm_list.eo index 36edc57..2db4e0b 100644 --- a/src/lib/elementary/elm_list.eo +++ b/src/lib/elementary/elm_list.eo @@ -439,7 +439,7 @@ class Elm.List (Efl.Ui.Layout, Elm.Interface_Scrollable, Elm.Widget.access; Elm.Widget.focus_highlight_geometry_get; Elm.Widget.focus_next; - Elm.Widget.disable; + Elm.Widget.on_disabled_update; Elm.Widget.on_focus; Elm.Widget.translate; Elm.Widget.widget_sub_object_del; diff --git a/src/lib/elementary/elm_panel.c b/src/lib/elementary/elm_panel.c index 7fd4f9a..be7135c 100644 --- a/src/lib/elementary/elm_panel.c +++ b/src/lib/elementary/elm_panel.c @@ -1276,15 +1276,14 @@ _scroll_cb(Evas_Object *obj, void *data EINA_UNUSED) } EOLIAN static Eina_Bool -_elm_panel_elm_widget_disable(Eo *obj, Elm_Panel_Data *sd) +_elm_panel_elm_widget_on_disabled_update(Eo *obj, Elm_Panel_Data *sd, Eina_Bool disabled) { - Eina_Bool int_ret = EINA_FALSE; - int_ret = elm_obj_widget_disable(efl_super(obj, MY_CLASS)); - if (!int_ret) return EINA_FALSE; + if (!elm_obj_widget_on_disabled_update(efl_super(obj, MY_CLASS), disabled)) + return EINA_FALSE; if (sd->scrollable) { - if (elm_widget_disabled_get(obj)) + if (disabled) { evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_DOWN, _on_mouse_down); diff --git a/src/lib/elementary/elm_panel.eo b/src/lib/elementary/elm_panel.eo index 0041d3f..829a1fc 100644 --- a/src/lib/elementary/elm_panel.eo +++ b/src/lib/elementary/elm_panel.eo @@ -82,7 +82,7 @@ class Elm.Panel (Efl.Ui.Layout, Elm.Interface_Scrollable, Elm.Widget.theme_apply; Elm.Widget.focus_next_manager_is; Elm.Widget.focus_next; - Elm.Widget.disable; + Elm.Widget.on_disabled_update; Elm.Widget.access; Elm.Widget.widget_event; Elm.Widget.on_focus_region; diff --git a/src/lib/elementary/elm_segment_control.c b/src/lib/elementary/elm_segment_control.c index 857b84a..01dc0d1 100644 --- a/src/lib/elementary/elm_segment_control.c +++ b/src/lib/elementary/elm_segment_control.c @@ -245,11 +245,10 @@ _elm_segment_control_elm_widget_theme_apply(Eo *obj, Elm_Segment_Control_Data *s } EOLIAN static Eina_Bool -_elm_segment_control_elm_widget_disable(Eo *obj, Elm_Segment_Control_Data *sd) +_elm_segment_control_elm_widget_on_disabled_update(Eo *obj, Elm_Segment_Control_Data *sd, Eina_Bool disabled) { - Eina_Bool int_ret = EINA_FALSE; - int_ret = elm_obj_widget_disable(efl_super(obj, MY_CLASS)); - if (!int_ret) return EINA_FALSE; + if (!elm_obj_widget_on_disabled_update(efl_super(obj, MY_CLASS), disabled)) + return EINA_FALSE; _update_list(sd); diff --git a/src/lib/elementary/elm_segment_control.eo b/src/lib/elementary/elm_segment_control.eo index 5a019ea..ef43cc1 100644 --- a/src/lib/elementary/elm_segment_control.eo +++ b/src/lib/elementary/elm_segment_control.eo @@ -141,7 +141,7 @@ class Elm.Segment_Control (Efl.Ui.Layout) Elm.Widget.focus_next; Elm.Widget.focus_direction_manager_is; Elm.Widget.access; - Elm.Widget.disable; + Elm.Widget.on_disabled_update; Elm.Widget.translate; } events { diff --git a/src/lib/elementary/elm_widget.c b/src/lib/elementary/elm_widget.c index e22a6f3..6639bab 100644 --- a/src/lib/elementary/elm_widget.c +++ b/src/lib/elementary/elm_widget.c @@ -1433,7 +1433,7 @@ _elm_widget_widget_sub_object_add(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Objec if (!sdc->disabled && (elm_widget_disabled_get(obj))) { elm_widget_focus_disabled_handle(sobj); - elm_obj_widget_disable(sobj); + elm_obj_widget_on_disabled_update(sobj, EINA_TRUE); } } @@ -3358,53 +3358,26 @@ _elm_widget_disabled_eval(const Evas_Object *obj, Eina_Bool disabled) Evas_Object *child; ELM_WIDGET_DATA_GET(obj, sd); - if (disabled) + EINA_LIST_FOREACH(sd->subobjs, l, child) { - EINA_LIST_FOREACH(sd->subobjs, l, child) + if (elm_widget_is(child)) { - if (elm_widget_is(child)) - { - elm_widget_focus_disabled_handle(child); - elm_obj_widget_disable(child); - _elm_widget_disabled_eval(child, EINA_TRUE); - } + elm_widget_focus_disabled_handle(child); + elm_obj_widget_on_disabled_update(child, disabled); + _elm_widget_disabled_eval(child, disabled); } } - else - { - EINA_LIST_FOREACH(sd->subobjs, l, child) - if (elm_widget_is(child)) - { - ELM_WIDGET_DATA_GET(child, sdc); - if (!sdc->disabled) - { - elm_widget_focus_disabled_handle(child); - elm_obj_widget_disable(child); - _elm_widget_disabled_eval(child, EINA_FALSE); - } - } - } } static void elm_widget_disabled_internal(Eo *obj, Eina_Bool disabled) { - Eina_Bool parent_state = EINA_FALSE; + if (!disabled && elm_widget_disabled_get(elm_widget_parent_get(obj))) + return; - if (disabled) - { - elm_widget_focus_disabled_handle(obj); - elm_obj_widget_disable(obj); - _elm_widget_disabled_eval(obj, EINA_TRUE); - } - else - { - parent_state = elm_widget_disabled_get(elm_widget_parent_get(obj)); - if (parent_state) return; - elm_widget_focus_disabled_handle(obj); - elm_obj_widget_disable(obj); - _elm_widget_disabled_eval(obj, EINA_FALSE); - } + elm_widget_focus_disabled_handle(obj); + elm_obj_widget_on_disabled_update(obj, disabled); + _elm_widget_disabled_eval(obj, disabled); } EOLIAN static void @@ -3422,11 +3395,8 @@ _elm_widget_disabled_set(Eo *obj, Elm_Widget_Smart_Data *sd, Eina_Bool disabled) EOLIAN static Eina_Bool _elm_widget_disabled_get(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd) { - Eina_Bool disabled = EINA_FALSE; - - if (sd->disabled) disabled = EINA_TRUE; - else disabled = elm_widget_disabled_get(elm_widget_parent_get(obj)); - return disabled; + if (sd->disabled) return EINA_TRUE; + return elm_widget_disabled_get(elm_widget_parent_get(obj)); } EOLIAN static void @@ -6245,7 +6215,7 @@ _elm_widget_on_focus(Eo *obj, Elm_Widget_Smart_Data *sd, Elm_Object_Item *item E } EOLIAN static Eina_Bool -_elm_widget_disable(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *_pd EINA_UNUSED) +_elm_widget_on_disabled_update(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *_pd EINA_UNUSED, Eina_Bool disabled EINA_UNUSED) { return EINA_FALSE; } diff --git a/src/lib/elementary/elm_widget.eo b/src/lib/elementary/elm_widget.eo index 60ed7ec..4992dc3 100644 --- a/src/lib/elementary/elm_widget.eo +++ b/src/lib/elementary/elm_widget.eo @@ -54,6 +54,21 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible, disabled widgets shall not respond to any input events. This is $false by default, meaning the widget is enabled. ]] + set { + [[Enables or disables this widget. + + Disabling a widget will disable all its children recursively, + but only this widget will be marked as disabled internally. + ]] + } + get { + [[Returns whether the widget is disabled. + + This will return $true if any widget in the parent hierarchy + is disabled. Re-enabling that parent may in turn change the + disabled state of this widget. + ]] + } values { disabled: bool(false); [[$true if the widget is disabled.]] } @@ -362,6 +377,9 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible, will emit the signal "elm,state,orient,$R" will be emitted (where $R is the rotation angle in degrees). + Note: This function may be called even if the orientation has not + actually changed, like when a widget needs to be reconfigured. + See also @Efl.Orientation.orientation.set. ]] params { @@ -369,9 +387,16 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible, @.orientation_mode_disabled is $true.]] } } - disable { - [['Virtual' function on the widget being disabled.]] - return: bool; [[$true on success, $false otherwise]] + on_disabled_update @protected { + [[Virtual function called when the widget becomes disabled. + + This may be triggered even if this widget is not disabled, as the + parent widget could be disabled and propagate its state. + ]] + params { + disabled: bool; [[The new value of @.disabled.]] + } + return: bool; [[Indicates if the operation succeeded.]] } theme_apply { [['Virtual' function on the widget being re-themed.]] -- 2.7.4