forked from enlightenment/efl
efl_ui_item: rework parent relation
this commit ensures that there is a public way of setting the container to a item. This was also like this before, just with the difference that it was set and unset in all privacy, however, we want to have this class also ready for bindings, so we should stop making things privat like this. Note: the removed fields from grid and list have not been used. ref T7905 Reviewed-by: SangHyeon Jade Lee <sh10233.lee@samsung.com> Differential Revision: https://phab.enlightenment.org/D9262
This commit is contained in:
parent
5a698b6a3d
commit
d30fc5f5d3
|
@ -750,8 +750,7 @@ _grid_item_process(Eo *obj, Efl_Ui_Grid_Data *pd, EINA_UNUSED Efl_Ui_Grid_Item *
|
|||
EFL_UI_GRID_ITEM_DATA_GET_OR_RETURN(it, gd, EINA_FALSE);
|
||||
EFL_UI_ITEM_DATA_GET_OR_RETURN(it, id, EINA_FALSE);
|
||||
id->select_mode = &(pd->select_mode);
|
||||
id->parent = obj;
|
||||
gd->parent = obj;
|
||||
efl_ui_item_container_set(it, obj);
|
||||
efl_canvas_group_member_add(pd->pan, it);
|
||||
efl_ui_mirrored_set(it, efl_ui_mirrored_get(obj));
|
||||
|
||||
|
@ -772,8 +771,7 @@ _grid_item_unpack_internal(Eo *obj, Efl_Ui_Grid_Data *pd, Efl_Ui_Grid_Item *it)
|
|||
EFL_UI_GRID_ITEM_DATA_GET_OR_RETURN(it, gd);
|
||||
EFL_UI_ITEM_DATA_GET_OR_RETURN(it, id);
|
||||
id->select_mode = NULL;
|
||||
id->parent = NULL;
|
||||
gd->parent = NULL;
|
||||
efl_ui_item_container_set(it, NULL);
|
||||
|
||||
pd->items = eina_list_remove(pd->items, it);
|
||||
if (efl_ui_item_selected_get(it))
|
||||
|
|
|
@ -7,7 +7,6 @@ typedef struct _Efl_Ui_Grid_Item_Data
|
|||
{
|
||||
// Eo Objects
|
||||
Eo *obj; /* Self-Object */
|
||||
Eo *parent; /* Parent Widget */
|
||||
Eina_Rect geo;
|
||||
int index;
|
||||
struct {
|
||||
|
|
|
@ -380,6 +380,19 @@ _efl_ui_item_selected_get(const Eo *obj EINA_UNUSED, Efl_Ui_Item_Data *pd)
|
|||
return pd->selected;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_item_container_set(Eo *obj EINA_UNUSED, Efl_Ui_Item_Data *pd, Efl_Ui_Widget *container)
|
||||
{
|
||||
pd->parent = container;
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Ui_Widget*
|
||||
_efl_ui_item_container_get(const Eo *obj EINA_UNUSED, Efl_Ui_Item_Data *pd)
|
||||
{
|
||||
return pd->parent;
|
||||
}
|
||||
|
||||
|
||||
/* Internal EO APIs and hidden overrides */
|
||||
|
||||
#define EFL_UI_ITEM_EXTRA_OPS \
|
||||
|
|
|
@ -18,6 +18,15 @@ abstract @beta Efl.Ui.Item extends Efl.Ui.Layout_Base implements Efl.Ui.Selectab
|
|||
select: bool;
|
||||
}
|
||||
}
|
||||
@property container {
|
||||
[[The container this object is part of.
|
||||
|
||||
You should never use this property yourself, the container will set it. Unsetting this while the item is packed into a container does not have an impact on its state in the container.
|
||||
]]
|
||||
values {
|
||||
container : Efl.Ui.Widget; [[The container this item is in.]]
|
||||
}
|
||||
}
|
||||
}
|
||||
implements {
|
||||
//Efl.Object
|
||||
|
|
|
@ -675,8 +675,7 @@ _list_item_process(Eo *obj, Efl_Ui_List_Data *pd, EINA_UNUSED Efl_Ui_List_Item *
|
|||
EFL_UI_LIST_ITEM_DATA_GET_OR_RETURN(it, ld, EINA_FALSE);
|
||||
EFL_UI_ITEM_DATA_GET_OR_RETURN(it, id, EINA_FALSE);
|
||||
id->select_mode = &(pd->select_mode);
|
||||
id->parent = obj;
|
||||
ld->parent = obj;
|
||||
efl_ui_item_container_set(it, obj);
|
||||
efl_ui_mirrored_set(it, efl_ui_mirrored_get(obj));
|
||||
|
||||
efl_event_callback_add(it, EFL_UI_EVENT_PRESSED, _list_item_pressed, obj);
|
||||
|
@ -695,8 +694,7 @@ _list_item_clear(Eo *obj, Efl_Ui_List_Data *pd EINA_UNUSED, EINA_UNUSED Efl_Ui_L
|
|||
EFL_UI_LIST_ITEM_DATA_GET_OR_RETURN(it, ld);
|
||||
EFL_UI_ITEM_DATA_GET_OR_RETURN(it, id);
|
||||
id->select_mode = NULL;
|
||||
id->parent = NULL;
|
||||
ld->parent = NULL;
|
||||
efl_ui_item_container_set(it, NULL);
|
||||
|
||||
efl_event_callback_del(it, EFL_UI_EVENT_PRESSED, _list_item_pressed, obj);
|
||||
efl_event_callback_del(it, EFL_UI_EVENT_UNPRESSED, _list_item_unpressed, obj);
|
||||
|
|
|
@ -7,7 +7,6 @@ typedef struct _Efl_Ui_List_Item_Data
|
|||
{
|
||||
// Eo Objects
|
||||
Eo *obj; /* Self-Object */
|
||||
Eo *parent; /* Parent Widget */
|
||||
Eina_Bool needs_size_calc : 1; /* Flag for Size calculation */
|
||||
} Efl_Ui_List_Item_Data;
|
||||
|
||||
|
|
Loading…
Reference in New Issue