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
}
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;
}
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;
}
_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);
}
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
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;
/* 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,
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; }
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;
}
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;
}
}
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;
}
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;
/* 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,
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; }
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;
}
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);
implements {
class.constructor;
Efl.Object.constructor;
- Elm.Widget.disable;
+ Elm.Widget.on_disabled_update;
}
}
}
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);
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;
}
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);
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;
}
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);
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 {
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);
}
}
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
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
}
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;
}
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.]]
}
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 {
@.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.]]