forked from enlightenment/efl
edje: Add property "part_exist"
This allows to safely verify if a part exists, without triggering any potential call to NULL object, or even requiring the efl_part() handle to be created. This is perfectly equivalent to edje_object_part_exists(), but implemented by both edje object and elm layout.
This commit is contained in:
parent
d133336399
commit
9e2f2970b8
|
@ -1205,14 +1205,5 @@ edje_object_size_max_get(const Edje_Object *obj, int *maxw, int *maxh)
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
edje_object_part_exists(const Eo *obj, const char *part)
|
edje_object_part_exists(const Eo *obj, const char *part)
|
||||||
{
|
{
|
||||||
Edje_Real_Part *rp;
|
return efl_layout_group_part_exist_get(obj, part);
|
||||||
Edje *ed;
|
|
||||||
|
|
||||||
if (!part) return EINA_FALSE;
|
|
||||||
ed = _edje_fetch(obj);
|
|
||||||
if (!ed) return EINA_FALSE;
|
|
||||||
rp = _edje_real_part_recursive_get(&ed, part);
|
|
||||||
if (!rp) return EINA_FALSE;
|
|
||||||
|
|
||||||
return EINA_TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3325,7 +3325,7 @@ _efl_canvas_layout_efl_layout_group_group_size_min_get(Eo *obj EINA_UNUSED, Edje
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN Eina_Size2D
|
EOLIAN Eina_Size2D
|
||||||
_efl_canvas_layout_efl_layout_group_group_size_max_get(Eo *obj EINA_UNUSED, Edje *ed EINA_UNUSED)
|
_efl_canvas_layout_efl_layout_group_group_size_max_get(Eo *obj EINA_UNUSED, Edje *ed)
|
||||||
{
|
{
|
||||||
Eina_Size2D sz;
|
Eina_Size2D sz;
|
||||||
|
|
||||||
|
@ -3343,6 +3343,19 @@ _efl_canvas_layout_efl_layout_group_group_size_max_get(Eo *obj EINA_UNUSED, Edje
|
||||||
return sz;
|
return sz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EOLIAN Eina_Bool
|
||||||
|
_efl_canvas_layout_efl_layout_group_part_exist_get(Eo *obj EINA_UNUSED, Edje *ed, const char *part)
|
||||||
|
{
|
||||||
|
Edje_Real_Part *rp;
|
||||||
|
|
||||||
|
if (!part) return EINA_FALSE;
|
||||||
|
if (ed->delete_me) return EINA_FALSE;
|
||||||
|
rp = _edje_real_part_recursive_get(&ed, part);
|
||||||
|
if (!rp) return EINA_FALSE;
|
||||||
|
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
EOLIAN void
|
EOLIAN void
|
||||||
_efl_canvas_layout_efl_layout_calc_calc_force(Eo *obj EINA_UNUSED, Edje *ed)
|
_efl_canvas_layout_efl_layout_calc_calc_force(Eo *obj EINA_UNUSED, Edje *ed)
|
||||||
{
|
{
|
||||||
|
|
|
@ -116,6 +116,7 @@ class Efl.Canvas.Layout (Efl.Canvas.Group, Efl.File, Efl.Container, Efl.Part,
|
||||||
Efl.Layout.Group.group_size_min { get; }
|
Efl.Layout.Group.group_size_min { get; }
|
||||||
Efl.Layout.Group.group_size_max { get; }
|
Efl.Layout.Group.group_size_max { get; }
|
||||||
Efl.Layout.Group.group_data { get; }
|
Efl.Layout.Group.group_data { get; }
|
||||||
|
Efl.Layout.Group.part_exist { get; }
|
||||||
Efl.Layout.Signal.message_send;
|
Efl.Layout.Signal.message_send;
|
||||||
Efl.Layout.Signal.signal_callback_add;
|
Efl.Layout.Signal.signal_callback_add;
|
||||||
Efl.Layout.Signal.signal_callback_del;
|
Efl.Layout.Signal.signal_callback_del;
|
||||||
|
|
|
@ -98,6 +98,28 @@ interface Efl.Layout.Group
|
||||||
val: string; [[The data's value string.]]
|
val: string; [[The data's value string.]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@property part_exist {
|
||||||
|
[[Whether the given part exists in this group.
|
||||||
|
|
||||||
|
This is mostly equivalent to verifying the part type on the object
|
||||||
|
as would be done in C as follows:
|
||||||
|
(efl_canvas_layout_part_type_get(efl_part(obj, "partname")) !=
|
||||||
|
EFL_CANVAS_LAYOUT_PART_TYPE_NONE)
|
||||||
|
|
||||||
|
The differences are that will silently return $false if the part
|
||||||
|
does not exist, and this will return $true if the part is of type
|
||||||
|
$SPACER in the EDC file ($SPACER parts have type $NONE).
|
||||||
|
|
||||||
|
See also @Efl.Canvas.Layout.Part.part_type.
|
||||||
|
]]
|
||||||
|
get { [[Returns $true if the part exists in the EDC group.]] }
|
||||||
|
keys {
|
||||||
|
part: string @nonull; [[The part name to check.]]
|
||||||
|
}
|
||||||
|
values {
|
||||||
|
exists: bool; [[$true if the part exists, $false otherwise.]]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1575,6 +1575,14 @@ _efl_ui_layout_efl_layout_group_group_size_max_get(Eo *obj, Efl_Ui_Layout_Data *
|
||||||
return efl_layout_group_size_max_get(wd->resize_obj);
|
return efl_layout_group_size_max_get(wd->resize_obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EOLIAN static Eina_Bool
|
||||||
|
_efl_ui_layout_efl_layout_group_part_exist_get(Eo *obj, Efl_Ui_Layout_Data *_pd EINA_UNUSED, const char *part)
|
||||||
|
{
|
||||||
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
||||||
|
|
||||||
|
return efl_layout_group_part_exist_get(wd->resize_obj, part);
|
||||||
|
}
|
||||||
|
|
||||||
/* layout's sizing evaluation is deferred. evaluation requests are
|
/* layout's sizing evaluation is deferred. evaluation requests are
|
||||||
* queued up and only flag the object as 'changed'. when it comes to
|
* queued up and only flag the object as 'changed'. when it comes to
|
||||||
* Evas's rendering phase, it will be addressed, finally (see
|
* Evas's rendering phase, it will be addressed, finally (see
|
||||||
|
|
|
@ -59,6 +59,7 @@ class Efl.Ui.Layout (Efl.Ui.Widget, Efl.Part, Efl.Container, Efl.File,
|
||||||
Efl.Layout.Group.group_data { get; }
|
Efl.Layout.Group.group_data { get; }
|
||||||
Efl.Layout.Group.group_size_min { get; }
|
Efl.Layout.Group.group_size_min { get; }
|
||||||
Efl.Layout.Group.group_size_max { get; }
|
Efl.Layout.Group.group_size_max { get; }
|
||||||
|
Efl.Layout.Group.part_exist { get; }
|
||||||
Efl.Ui.Widget.widget_sub_object_add;
|
Efl.Ui.Widget.widget_sub_object_add;
|
||||||
Efl.Ui.Widget.theme_apply;
|
Efl.Ui.Widget.theme_apply;
|
||||||
Efl.Ui.Widget.on_disabled_update;
|
Efl.Ui.Widget.on_disabled_update;
|
||||||
|
|
Loading…
Reference in New Issue