elementary: enforce container type check for efl_ui_item_index_get and improve documentation.

Summary: Depends on D10927

Reviewers: bu5hm4n, segfaultxavi, SanghyeonLee

Reviewed By: SanghyeonLee

Subscribers: zmike, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T8351

Differential Revision: https://phab.enlightenment.org/D10945
This commit is contained in:
Cedric BAIL 2019-12-24 09:20:11 -05:00 committed by Mike Blumenkrantz
parent 1176bbaa9b
commit 7d16c344c1
2 changed files with 7 additions and 1 deletions

View File

@ -147,6 +147,8 @@ _efl_ui_item_efl_object_destructor(Eo *obj, Efl_Ui_Item_Data *pd EINA_UNUSED)
EOLIAN static int
_efl_ui_item_index_get(const Eo *obj, Efl_Ui_Item_Data *pd)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(pd->container, -1);
EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(pd->container, EFL_PACK_LINEAR_INTERFACE), -1);
return efl_pack_index_get(pd->container, obj);
}

View File

@ -27,7 +27,11 @@ abstract Efl.Ui.Item extends Efl.Ui.Layout_Base implements Efl.Ui.Selectable, Ef
@property index {
[[The index of this item inside its container.
The container must be set through the @Efl.Ui.Item.container property.]]
The container must be set through the @Efl.Ui.Item.container property and be exposing an @Efl.Pack_Linear interface.
If the container is not an @Efl.Pack_Linear, -1 will be returned.
Finally, it is a very slow API that must not be used in any performance constrained case.
]]
get {}
values {
index : int; [[The index where to find this item in its @.container.]]