forked from enlightenment/efl
Edje: Reparent when swallowing/unswallowing.
On swallow make the edje object the parent, on unswallow the canvas.
This commit is contained in:
parent
878a3d952c
commit
4d0494574b
|
@ -315,6 +315,7 @@ _edje_real_part_free(Edje *ed, Edje_Real_Part *rp)
|
|||
if ((rp->type == EDJE_RP_TYPE_SWALLOW) && (rp->typedata.swallow)
|
||||
&& (rp->typedata.swallow->swallowed_object))
|
||||
{
|
||||
eo_parent_set(rp->typedata.swallow->swallowed_object, evas_common_evas_get(ed->obj));
|
||||
evas_object_smart_member_del(rp->typedata.swallow->swallowed_object);
|
||||
evas_object_event_callback_del(rp->typedata.swallow->swallowed_object,
|
||||
EVAS_CALLBACK_FREE, _edje_object_part_swallow_free_cb);
|
||||
|
@ -3147,7 +3148,11 @@ _edje_edit_real_part_add(Evas_Object *obj, const char *name, Edje_Part_Type type
|
|||
evas_object_show(rp->object);
|
||||
evas_object_smart_member_add(rp->object, ed->obj);
|
||||
evas_object_layer_set(rp->object, evas_object_layer_get(ed->obj));
|
||||
if (ep->type != EDJE_PART_TYPE_SWALLOW && ep->type != EDJE_PART_TYPE_GROUP)
|
||||
if (ep->type == EDJE_PART_TYPE_SWALLOW)
|
||||
{
|
||||
eo_parent_set(rp->object, ed->obj);
|
||||
}
|
||||
else if (ep->type != EDJE_PART_TYPE_GROUP)
|
||||
{
|
||||
if (ep->mouse_events)
|
||||
{
|
||||
|
|
|
@ -4966,6 +4966,7 @@ _edje_child_add(Edje *ed, Edje_Real_Part *rp, Evas_Object *child)
|
|||
evas_object_event_callback_add(child, EVAS_CALLBACK_DEL, _edje_child_del_cb, rp);
|
||||
evas_object_data_set(child, ".edje", ed);
|
||||
if (!ed) return;
|
||||
eo_parent_set(child, ed->obj);
|
||||
ed->dirty = EINA_TRUE;
|
||||
ed->recalc_call = EINA_TRUE;
|
||||
#ifdef EDJE_CALC_CACHE
|
||||
|
@ -4974,12 +4975,22 @@ _edje_child_add(Edje *ed, Edje_Real_Part *rp, Evas_Object *child)
|
|||
_edje_recalc(ed);
|
||||
}
|
||||
|
||||
static void
|
||||
_eo_unparent_helper(Eo *child, Eo *parent)
|
||||
{
|
||||
if (eo_parent_get(child) == parent)
|
||||
{
|
||||
eo_parent_set(child, evas_common_evas_get(parent));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_edje_child_remove(Edje *ed, Edje_Real_Part *rp, Evas_Object *child)
|
||||
{
|
||||
evas_object_event_callback_del_full(child, EVAS_CALLBACK_DEL, _edje_child_del_cb, rp);
|
||||
evas_object_data_del(child, ".edje");
|
||||
if (!ed) return;
|
||||
_eo_unparent_helper(child, ed->obj);
|
||||
ed->dirty = EINA_TRUE;
|
||||
ed->recalc_call = EINA_TRUE;
|
||||
#ifdef EDJE_CALC_CACHE
|
||||
|
@ -6322,6 +6333,7 @@ _edje_real_part_swallow(Edje *ed,
|
|||
#endif
|
||||
if (!obj_swallow) return;
|
||||
rp->typedata.swallow->swallowed_object = obj_swallow;
|
||||
eo_parent_set(obj_swallow, ed->obj);
|
||||
evas_object_smart_member_add(rp->typedata.swallow->swallowed_object, ed->obj);
|
||||
if (rp->part->clip_to_id >= 0)
|
||||
{
|
||||
|
@ -6380,6 +6392,7 @@ _edje_real_part_swallow_clear(Edje *ed, Edje_Real_Part *rp)
|
|||
if ((rp->type != EDJE_RP_TYPE_SWALLOW) ||
|
||||
(!rp->typedata.swallow)) return;
|
||||
if (!rp->typedata.swallow->swallowed_object) return;
|
||||
_eo_unparent_helper(rp->typedata.swallow->swallowed_object, ed->obj);
|
||||
evas_object_smart_member_del(rp->typedata.swallow->swallowed_object);
|
||||
evas_object_event_callback_del_full(rp->typedata.swallow->swallowed_object,
|
||||
EVAS_CALLBACK_DEL,
|
||||
|
|
Loading…
Reference in New Issue