efl_ui_widget: redo disable handling

before the disable property was a bit weird. Setting something to
disabled=true will disable all children of the widget that is changed.
However, only the update function of the children will get the false flag,
not the flag itself. Which means, to query the real disabled state, we
need to walk up the parent relations.

With this patch, every change to disabled will go through the disabled
property, which mean, a implementor can just overwrite the disabled
property, and adjust its internal state there. Just be carefull, a set
to disabled=true still might result in disabled=false. This makes the
function on_disable_update unneccesary. Which also cleans up the
Efl.Ui.Widget class.

ref T7553

Depends on D8016

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Differential Revision: https://phab.enlightenment.org/D8017
This commit is contained in:
Mike Blumenkrantz 2019-02-27 14:00:14 -05:00 committed by Marcel Hollerbach
parent 98b4a7bfa7
commit 0b152734ba
22 changed files with 160 additions and 170 deletions

View File

@ -395,12 +395,29 @@ _efl_ui_layout_highlight_in_theme(Evas_Object *obj)
elm_widget_access_highlight_in_theme_set(obj, EINA_FALSE);
}
static void
_flush_mirrored_state(Eo *obj)
{
char prefix[4], state[10], signal[100];
if (efl_ui_widget_disabled_get(obj))
snprintf(state, sizeof(state), "disabled");
else
snprintf(state, sizeof(state), "enabled");
if (!elm_widget_is_legacy(obj))
snprintf(prefix, sizeof(prefix), "efl");
else
snprintf(prefix, sizeof(prefix), "elm");
snprintf(signal, sizeof(signal), "%s,state,%s", prefix, state);
efl_layout_signal_emit(obj, signal, prefix);
}
static Eina_Bool
_visuals_refresh(Evas_Object *obj,
Efl_Ui_Layout_Data *sd)
{
Eina_Bool ret = EINA_FALSE;
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
_parts_signals_emit(sd);
@ -414,41 +431,18 @@ _visuals_refresh(Evas_Object *obj,
efl_gfx_entity_scale_get(obj) * elm_config_scale_get());
_efl_ui_layout_highlight_in_theme(obj);
ret = efl_ui_widget_on_disabled_update(obj, elm_widget_disabled_get(obj));
_flush_mirrored_state(obj);
elm_layout_sizing_eval(obj);
return ret;
return EINA_TRUE;
}
EOLIAN static Eina_Bool
_efl_ui_layout_base_efl_ui_widget_on_disabled_update(Eo *obj, Efl_Ui_Layout_Data *_pd EINA_UNUSED, Eina_Bool disabled)
EOLIAN static void
_efl_ui_layout_base_efl_ui_widget_disabled_set(Eo *obj, Efl_Ui_Layout_Data *_pd EINA_UNUSED, Eina_Bool disabled)
{
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
// Not calling efl_super here: Elm.Widget simply returns false.
if (elm_widget_is_legacy(obj))
{
if (disabled)
edje_object_signal_emit
(wd->resize_obj, "elm,state,disabled", "elm");
else
edje_object_signal_emit
(wd->resize_obj, "elm,state,enabled", "elm");
}
else
{
if (disabled)
edje_object_signal_emit
(wd->resize_obj, "efl,state,disabled", "efl");
else
edje_object_signal_emit
(wd->resize_obj, "efl,state,enabled", "efl");
}
return EINA_TRUE;
efl_ui_widget_disabled_set(efl_super(obj, MY_CLASS), disabled);
_flush_mirrored_state(obj);
}
static Efl_Ui_Theme_Apply_Result

View File

@ -82,7 +82,7 @@ abstract @beta Efl.Ui.Layout_Base extends Efl.Ui.Widget implements Efl.Container
Efl.Layout.Group.part_exist { get; }
Efl.Ui.Widget.widget_sub_object_add;
Efl.Ui.Widget.theme_apply;
Efl.Ui.Widget.on_disabled_update;
Efl.Ui.Widget.disabled {set;}
Efl.Ui.Widget.widget_sub_object_del;
Efl.Ui.Focus.Object.on_focus_update;
Efl.Container.content_count;

View File

@ -1156,11 +1156,10 @@ _scroll_cb(Evas_Object *obj, void *data EINA_UNUSED)
(obj, EFL_UI_EVENT_SCROLL, (void *) &event);
}
EOLIAN static Eina_Bool
_efl_ui_panel_efl_ui_widget_on_disabled_update(Eo *obj, Efl_Ui_Panel_Data *sd, Eina_Bool disabled)
EOLIAN static void
_efl_ui_panel_efl_ui_widget_disabled_set(Eo *obj, Efl_Ui_Panel_Data *sd, Eina_Bool disabled)
{
if (!efl_ui_widget_on_disabled_update(efl_super(obj, MY_CLASS), disabled))
return EINA_FALSE;
efl_ui_widget_disabled_set(efl_super(obj, MY_CLASS), disabled);
if (sd->scrollable)
{
@ -1191,8 +1190,6 @@ _efl_ui_panel_efl_ui_widget_on_disabled_update(Eo *obj, Efl_Ui_Panel_Data *sd, E
sd->callback_added = EINA_TRUE;
}
}
return EINA_TRUE;
}
EOLIAN static double

View File

@ -80,7 +80,7 @@ class @beta Efl.Ui.Panel extends Efl.Ui.Layout implements Efl.Ui.Focus.Layer, El
Efl.Gfx.Entity.size { set; }
Efl.Canvas.Group.group_member_add;
Efl.Ui.Widget.theme_apply;
Efl.Ui.Widget.on_disabled_update;
Efl.Ui.Widget.disabled {set;}
Efl.Ui.Widget.on_access_update;
Efl.Ui.Widget.widget_event;
Efl.Ui.Widget.interest_region { get; }

View File

@ -698,10 +698,12 @@ _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_efl_ui_widget_on_disabled_update(Eo *obj, Efl_Ui_Text_Data *sd, Eina_Bool disabled)
EOLIAN static void
_efl_ui_text_efl_ui_widget_disabled_set(Eo *obj, Efl_Ui_Text_Data *sd, Eina_Bool disabled)
{
const char *emission ;
const char *emission;
efl_ui_widget_disabled_set(efl_super(obj, MY_CLASS), disabled);
elm_drop_target_del(obj, sd->drop_format,
_dnd_enter_cb, NULL,
@ -709,16 +711,16 @@ _efl_ui_text_efl_ui_widget_on_disabled_update(Eo *obj, Efl_Ui_Text_Data *sd, Ein
_dnd_pos_cb, NULL,
_dnd_drop_cb, NULL);
emission = disabled ? "efl,state,disabled" : "efl,state,enabled";
emission = efl_ui_widget_disabled_get(obj) ? "efl,state,disabled" : "efl,state,enabled";
edje_object_signal_emit(sd->entry_edje, emission, "efl");
if (sd->scroll)
{
edje_object_signal_emit(sd->scr_edje, emission, "efl");
//elm_interface_scrollable_freeze_set(obj, disabled);
elm_interface_scrollable_freeze_set(obj, efl_ui_widget_disabled_get(obj));
}
sd->disabled = disabled;
sd->disabled = efl_ui_widget_disabled_get(obj);
if (!disabled)
if (!efl_ui_widget_disabled_get(obj))
{
sd->drop_format = _get_drop_format(obj);
elm_drop_target_add(obj, sd->drop_format,
@ -727,8 +729,6 @@ _efl_ui_text_efl_ui_widget_on_disabled_update(Eo *obj, Efl_Ui_Text_Data *sd, Ein
_dnd_pos_cb, NULL,
_dnd_drop_cb, NULL);
}
return EINA_TRUE;
}
/* we can't issue the layout's theming code here, cause it assumes an
@ -2071,7 +2071,7 @@ _format_color_parse(const char *str, int slen,
/**
* @internal
* Updates the text properties of the object from the theme.
*
*
* This update functions skips any property that was already set,
* to allow users to override the theme during the construction of the widget.
*/
@ -3642,7 +3642,7 @@ _anchor_format_parse(const char *item)
static Anchor *
_anchor_get(Eo *obj, Efl_Ui_Text_Data *sd, Efl_Text_Annotate_Annotation *an)
{
Anchor *anc;
Anchor *anc;
Eina_List *i;
const char *str;

View File

@ -334,7 +334,7 @@ class @beta Efl.Ui.Text extends Efl.Ui.Layout_Base implements Efl.Ui.Clickable,
Efl.Ui.Widget.theme_apply;
Efl.Ui.Focus.Object.on_focus_update;
Efl.Ui.Widget.interest_region { get; }
Efl.Ui.Widget.on_disabled_update;
Efl.Ui.Widget.disabled {set;}
//Efl.Ui.Widget.widget_sub_object_del;
//Elm.Interface_Scrollable.policy { set; }
//Elm.Interface_Scrollable.bounce_allow { set; }

View File

@ -183,8 +183,6 @@ _elm_scrollable_is(const Evas_Object *obj)
efl_isa(obj, EFL_UI_SCROLLABLE_INTERACTIVE_INTERFACE);
}
static void
elm_widget_disabled_internal(Eo *obj, Eina_Bool disabled);
static void
_on_sub_obj_del(void *data, const Efl_Event *event);
static void _propagate_event(void *data, const Efl_Event *eo_event);
@ -1338,8 +1336,6 @@ EOLIAN static Efl_Ui_Theme_Apply_Result
_efl_ui_widget_theme_apply(Eo *obj, Elm_Widget_Smart_Data *_pd EINA_UNUSED)
{
_elm_widget_mirrored_reload(obj);
if (elm_widget_disabled_get(obj))
elm_widget_disabled_internal(obj, elm_widget_disabled_get(obj));
return EFL_UI_THEME_APPLY_RESULT_SUCCESS;
}
@ -1497,14 +1493,7 @@ _efl_ui_widget_widget_sub_object_add(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Ob
sdc->parent_obj = obj;
_full_eval(sobj, sdc);
if (!sdc->on_create)
{
if (!sdc->disabled && (elm_widget_disabled_get(obj)))
{
efl_ui_widget_on_disabled_update(sobj, EINA_TRUE);
}
}
efl_ui_widget_disabled_set(sobj, efl_ui_widget_disabled_get(obj));
_elm_widget_top_win_focused_set(sobj, sd->top_win_focused);
@ -2474,54 +2463,31 @@ _elm_widget_top_win_focused_get(const Evas_Object *obj)
return sd->top_win_focused;
}
static void
_elm_widget_disabled_eval(const Evas_Object *obj, Eina_Bool disabled)
{
const Eina_List *l;
Evas_Object *child;
ELM_WIDGET_DATA_GET(obj, sd);
EINA_LIST_FOREACH(sd->subobjs, l, child)
{
if (elm_widget_is(child))
{
efl_ui_widget_on_disabled_update(child, disabled);
_elm_widget_disabled_eval(child, disabled);
}
}
}
static void
elm_widget_disabled_internal(Eo *obj, Eina_Bool disabled)
{
if (!disabled && elm_widget_disabled_get(elm_widget_parent_get(obj)))
return;
efl_ui_widget_on_disabled_update(obj, disabled);
_elm_widget_disabled_eval(obj, disabled);
}
EOLIAN static void
_efl_ui_widget_disabled_set(Eo *obj, Elm_Widget_Smart_Data *sd, Eina_Bool disabled)
_efl_ui_widget_disabled_set(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *pd, Eina_Bool disabled)
{
if (sd->disabled == disabled) return;
sd->disabled = !!disabled;
Efl_Ui_Widget *subs;
Eina_List *n;
elm_widget_disabled_internal(obj, disabled);
if (disabled)
pd->disabled ++;
else
pd->disabled = MAX(pd->disabled - 1 ,0);
EINA_LIST_FOREACH(pd->subobjs, n, subs)
{
if (efl_isa(subs, EFL_UI_WIDGET_CLASS))
efl_ui_widget_disabled_set(subs, efl_ui_widget_disabled_get(obj));
}
if (efl_finalized_get(obj))
_elm_widget_full_eval_children(obj, sd);
_elm_widget_full_eval_children(obj, pd);
}
EOLIAN static Eina_Bool
_efl_ui_widget_disabled_get(const Eo *obj, Elm_Widget_Smart_Data *sd)
_efl_ui_widget_disabled_get(const Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *pd)
{
Eo *parent;
if (sd->disabled) return EINA_TRUE;
if ((parent = elm_widget_parent_get(obj)) != NULL)
return elm_widget_disabled_get(parent);
return EINA_FALSE;
return pd->disabled > 0;
}
EOLIAN static void
@ -5329,12 +5295,6 @@ _efl_ui_widget_efl_ui_focus_object_on_focus_update(Eo *obj, Elm_Widget_Smart_Dat
return EINA_TRUE;
}
EOLIAN static Eina_Bool
_efl_ui_widget_on_disabled_update(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *_pd EINA_UNUSED, Eina_Bool disabled EINA_UNUSED)
{
return EINA_FALSE;
}
EOLIAN static Eina_Bool
_efl_ui_widget_widget_event(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *_pd EINA_UNUSED, const Efl_Event *eo_event EINA_UNUSED, Evas_Object *source EINA_UNUSED)
{

View File

@ -106,6 +106,8 @@ abstract @beta Efl.Ui.Widget extends Efl.Canvas.Group implements Efl.Access.Obje
@property disabled {
[[Whether the widget is enabled (accepts and reacts to user inputs).
The property works counted, this means, whenever n-caller set the value to $true, n-caller have to set it to $false in order to get it out of the disabled state again.
Each widget may handle the disabled state differently, but overall
disabled widgets shall not respond to any input events. This is
$false by default, meaning the widget is enabled.
@ -312,17 +314,6 @@ abstract @beta Efl.Ui.Widget extends Efl.Canvas.Group implements Efl.Access.Obje
return: bool; [[Indicates if the operation succeeded.]]
legacy: elm_widget_sub_object_del;
}
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 @protected {
[[Virtual function called when the widget needs to re-apply its theme.

View File

@ -6973,7 +6973,7 @@ static Efl_Ui_Theme_Apply_Result
_elm_win_theme_internal(Eo *obj, Efl_Ui_Win_Data *sd)
{
Efl_Ui_Theme_Apply_Result int_ret = EFL_UI_THEME_APPLY_RESULT_FAIL;
Eina_Bool ret = EINA_FALSE, prev_alpha;
Eina_Bool prev_alpha;
const char *s;
int_ret = elm_widget_theme_object_set(obj, sd->legacy.edje, "win", "base",
@ -6985,9 +6985,6 @@ _elm_win_theme_internal(Eo *obj, Efl_Ui_Win_Data *sd)
efl_gfx_entity_scale_get(obj) * elm_config_scale_get());
efl_event_callback_legacy_call(obj, EFL_UI_WIN_EVENT_THEME_CHANGED, NULL);
ret = efl_ui_widget_on_disabled_update(obj, elm_widget_disabled_get(obj));
if (!ret) int_ret = EFL_UI_THEME_APPLY_RESULT_FAIL;
prev_alpha = sd->theme_alpha;
s = edje_object_data_get(sd->legacy.edje, "alpha");

View File

@ -805,11 +805,25 @@ _get_drop_format(Evas_Object *obj)
return ELM_SEL_FORMAT_MARKUP;
}
/* we can't reuse layout's here, because it's on entry_edje only */
EOLIAN static Eina_Bool
_elm_entry_efl_ui_widget_on_disabled_update(Eo *obj, Elm_Entry_Data *sd, Eina_Bool disabled)
static void
_flush_disabled_state(Eo *obj, Elm_Entry_Data *sd)
{
const char *emission;
emission = efl_ui_widget_disabled_get(obj) ? "elm,state,disabled" : "elm,state,enabled";
edje_object_signal_emit(sd->entry_edje, emission, "elm");
if (sd->scroll)
{
edje_object_signal_emit(sd->scr_edje, emission, "elm");
elm_interface_scrollable_freeze_set(obj, efl_ui_widget_disabled_get(obj));
}
}
/* we can't reuse layout's here, because it's on entry_edje only */
EOLIAN static void
_elm_entry_efl_ui_widget_disabled_set(Eo *obj, Elm_Entry_Data *sd, Eina_Bool disabled)
{
efl_ui_widget_disabled_set(efl_super(obj, MY_CLASS), disabled);
elm_drop_target_del(obj, sd->drop_format,
_dnd_enter_cb, NULL,
@ -817,16 +831,10 @@ _elm_entry_efl_ui_widget_on_disabled_update(Eo *obj, Elm_Entry_Data *sd, Eina_Bo
_dnd_pos_cb, NULL,
_dnd_drop_cb, NULL);
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->scr_edje, emission, "elm");
elm_interface_scrollable_freeze_set(obj, disabled);
}
sd->disabled = disabled;
_flush_disabled_state(obj, sd);
sd->disabled = efl_ui_widget_disabled_get(obj);
if (!disabled)
if (!efl_ui_widget_disabled_get(obj))
{
sd->drop_format = _get_drop_format(obj);
elm_drop_target_add(obj, sd->drop_format,
@ -835,8 +843,6 @@ _elm_entry_efl_ui_widget_on_disabled_update(Eo *obj, Elm_Entry_Data *sd, Eina_Bo
_dnd_pos_cb, NULL,
_dnd_drop_cb, NULL);
}
return EINA_TRUE;
}
/* It gets the background object from from_edje object and
@ -1022,6 +1028,8 @@ _elm_entry_efl_ui_widget_theme_apply(Eo *obj, Elm_Entry_Data *sd)
evas_object_unref(obj);
_flush_disabled_state(obj, sd);
return theme_apply;
}

View File

@ -868,7 +868,7 @@ class Elm.Entry extends Efl.Ui.Layout_Base implements Elm.Interface_Scrollable,
Efl.Ui.Widget_Focus_Manager.focus_manager_create;
Efl.Ui.Focus.Object.on_focus_update;
Efl.Ui.Widget.interest_region { get; }
Efl.Ui.Widget.on_disabled_update;
Efl.Ui.Widget.disabled {set;}
Efl.Ui.Widget.widget_sub_object_del;
Elm.Interface_Scrollable.policy { set; }
Elm.Interface_Scrollable.bounce_allow { set; }

View File

@ -3733,15 +3733,15 @@ _rotate_test(Evas_Object *obj,
}
}
EOLIAN static Eina_Bool
_elm_gesture_layer_efl_ui_widget_on_disabled_update(Eo *obj, Elm_Gesture_Layer_Data *_pd EINA_UNUSED, Eina_Bool disabled)
EOLIAN static void
_elm_gesture_layer_efl_ui_widget_disabled_set(Eo *obj, Elm_Gesture_Layer_Data *_pd EINA_UNUSED, Eina_Bool disabled)
{
if (disabled)
efl_ui_widget_disabled_set(efl_super(obj, MY_CLASS), disabled);
if (efl_ui_widget_disabled_get(obj))
_callbacks_unregister(obj);
else
_callbacks_register(obj);
return EINA_TRUE;
}
EOLIAN static void

View File

@ -162,6 +162,6 @@ class Elm.Gesture_Layer extends Efl.Ui.Widget implements Efl.Ui.Legacy
implements {
class.constructor;
Efl.Object.constructor;
Efl.Ui.Widget.on_disabled_update;
Efl.Ui.Widget.disabled {set;}
}
}

View File

@ -1077,13 +1077,12 @@ _show_region_hook(void *data EINA_UNUSED, Evas_Object *obj, Eina_Rect r)
elm_interface_scrollable_content_region_set(obj, r.x, r.y, r.w, r.h);
}
EOLIAN static Eina_Bool
_elm_list_efl_ui_widget_on_disabled_update(Eo *obj, Elm_List_Data *sd, Eina_Bool disabled)
EOLIAN static void
_elm_list_efl_ui_widget_disabled_set(Eo *obj, Elm_List_Data *sd, Eina_Bool disabled)
{
if (!efl_ui_widget_on_disabled_update(efl_super(obj, MY_CLASS), disabled))
return EINA_FALSE;
efl_ui_widget_disabled_set(efl_super(obj, MY_CLASS), disabled);
if (disabled)
if (efl_ui_widget_disabled_get(obj))
{
elm_widget_scroll_freeze_push(obj);
elm_widget_scroll_hold_push(obj);
@ -1096,8 +1095,6 @@ _elm_list_efl_ui_widget_on_disabled_update(Eo *obj, Elm_List_Data *sd, Eina_Bool
elm_widget_scroll_freeze_pop(obj);
elm_widget_scroll_hold_pop(obj);
}
return EINA_TRUE;
}
static void

View File

@ -400,7 +400,7 @@ class Elm.List extends Efl.Ui.Layout implements Elm.Interface_Scrollable,
Efl.Ui.Widget.theme_apply;
Efl.Ui.Widget.on_access_update;
Efl.Ui.Widget.focus_highlight_geometry { get; }
Efl.Ui.Widget.on_disabled_update;
Efl.Ui.Widget.disabled {set;}
Efl.Ui.Focus.Object.on_focus_update;
Efl.Ui.L10n.translation_update;
Efl.Ui.Widget.widget_sub_object_del;

View File

@ -1590,6 +1590,20 @@ elm_object_disabled_set(Evas_Object *obj,
Eina_Bool disabled)
{
EINA_SAFETY_ON_NULL_RETURN(obj);
ELM_WIDGET_DATA_GET_OR_RETURN(obj, pd);
ELM_WIDGET_DATA_GET_OR_RETURN(efl_ui_widget_parent_get(obj), ppd);
if (disabled)
{
//we aim here for the disabled count of parent + 1
if (pd->disabled == ppd->disabled + 1) return;
pd->disabled = ppd->disabled;
}
else
{
//we aim for the same disabled count as the parent here
if (pd->disabled == ppd->disabled) return;
pd->disabled = ppd->disabled + 1;
}
elm_widget_disabled_set(obj, disabled);
}

View File

@ -1242,15 +1242,14 @@ _scroll_cb(Evas_Object *obj, void *data EINA_UNUSED)
(obj, EFL_UI_EVENT_SCROLL, (void *) &event);
}
EOLIAN static Eina_Bool
_elm_panel_efl_ui_widget_on_disabled_update(Eo *obj, Elm_Panel_Data *sd, Eina_Bool disabled)
EOLIAN static void
_elm_panel_efl_ui_widget_disabled_set(Eo *obj, Elm_Panel_Data *sd, Eina_Bool disabled)
{
if (!efl_ui_widget_on_disabled_update(efl_super(obj, MY_CLASS), disabled))
return EINA_FALSE;
efl_ui_widget_disabled_set(efl_super(obj, MY_CLASS), disabled);
if (sd->scrollable)
{
if (disabled && sd->callback_added)
if (efl_ui_widget_disabled_get(obj) && sd->callback_added)
{
evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_DOWN,
_on_mouse_down);
@ -1263,7 +1262,7 @@ _elm_panel_efl_ui_widget_on_disabled_update(Eo *obj, Elm_Panel_Data *sd, Eina_Bo
sd->callback_added = EINA_FALSE;
}
else if (!disabled && !sd->callback_added)
else if (!efl_ui_widget_disabled_get(obj) && !sd->callback_added)
{
evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_DOWN,
_on_mouse_down, sd);
@ -1277,8 +1276,6 @@ _elm_panel_efl_ui_widget_on_disabled_update(Eo *obj, Elm_Panel_Data *sd, Eina_Bo
sd->callback_added = EINA_TRUE;
}
}
return EINA_TRUE;
}
EOLIAN static double

View File

@ -80,7 +80,7 @@ class Elm.Panel extends Efl.Ui.Layout implements Efl.Ui.Focus.Layer, Elm.Interfa
Efl.Gfx.Entity.size { set; }
Efl.Canvas.Group.group_member_add;
Efl.Ui.Widget.theme_apply;
Efl.Ui.Widget.on_disabled_update;
Efl.Ui.Widget.disabled {set;}
Efl.Ui.Widget.on_access_update;
Efl.Ui.Widget.widget_event;
Efl.Ui.Widget.interest_region { get; }

View File

@ -244,15 +244,12 @@ _elm_segment_control_efl_ui_widget_theme_apply(Eo *obj, Elm_Segment_Control_Data
return int_ret;
}
EOLIAN static Eina_Bool
_elm_segment_control_efl_ui_widget_on_disabled_update(Eo *obj, Elm_Segment_Control_Data *sd, Eina_Bool disabled)
EOLIAN static void
_elm_segment_control_efl_ui_widget_disabled_set(Eo *obj, Elm_Segment_Control_Data *sd, Eina_Bool disabled)
{
if (!efl_ui_widget_on_disabled_update(efl_super(obj, MY_CLASS), disabled))
return EINA_FALSE;
efl_ui_widget_disabled_set(efl_super(obj, MY_CLASS), disabled);
_update_list(sd);
return EINA_TRUE;
}
// TODO: elm_widget_focus_list_next_get supports only Elm_widget list,

View File

@ -138,7 +138,7 @@ class Elm.Segment_Control extends Efl.Ui.Layout implements Efl.Ui.Focus.Composit
Efl.Object.constructor;
Efl.Ui.Widget.theme_apply;
Efl.Ui.Widget.on_access_update;
Efl.Ui.Widget.on_disabled_update;
Efl.Ui.Widget.disabled {set;}
Efl.Ui.L10n.translation_update;
}
events {

View File

@ -353,6 +353,7 @@ typedef struct _Elm_Widget_Smart_Data
int child_drag_x_locked;
int child_drag_y_locked;
int disabled;
Eina_Inlist *translate_strings;
Eina_List *focus_chain;
@ -394,7 +395,6 @@ typedef struct _Elm_Widget_Smart_Data
Eina_Bool highlight_ignore : 1;
Eina_Bool highlight_in_theme : 1;
Eina_Bool access_highlight_in_theme : 1;
Eina_Bool disabled : 1;
Eina_Bool is_mirrored : 1;
Eina_Bool mirrored_auto_mode : 1; /* This is TRUE by default */
Eina_Bool still_in : 1;

View File

@ -41,8 +41,46 @@ EFL_START_TEST(elm_atspi_role_get)
}
EFL_END_TEST
EFL_START_TEST(elm_box_disabled_test)
{
Evas_Object *win, *box, *o;
Efl_Access_Role role;
win = win_add(NULL, "box", ELM_WIN_BASIC);
box = elm_box_add(win);
elm_win_resize_object_add(box, win);
role = efl_access_object_role_get(box);
for (int i = 0; i < 3; ++i)
{
o = elm_button_add(box);
elm_box_pack_end(box, o);
}
elm_object_disabled_set(box, EINA_TRUE);
elm_object_disabled_set(box, EINA_TRUE);
ck_assert_int_eq(elm_object_disabled_get(box), EINA_TRUE);
ck_assert_int_eq(elm_object_disabled_get(o), EINA_TRUE);
elm_object_disabled_set(box, EINA_FALSE);
ck_assert_int_eq(elm_object_disabled_get(box), EINA_FALSE);
ck_assert_int_eq(elm_object_disabled_get(o), EINA_FALSE);
elm_object_disabled_set(box, EINA_TRUE);
elm_object_disabled_set(o, EINA_TRUE);
ck_assert_int_eq(elm_object_disabled_get(box), EINA_TRUE);
ck_assert_int_eq(elm_object_disabled_get(o), EINA_TRUE);
elm_object_disabled_set(box, EINA_FALSE);
ck_assert_int_eq(elm_object_disabled_get(box), EINA_FALSE);
ck_assert_int_eq(elm_object_disabled_get(o), EINA_TRUE);
ck_assert(role == EFL_ACCESS_ROLE_FILLER);
}
EFL_END_TEST
void elm_test_box(TCase *tc)
{
tcase_add_test(tc, elm_box_legacy_type_check);
tcase_add_test(tc, elm_atspi_role_get);
tcase_add_test(tc, elm_box_disabled_test);
}