From 555cf6e2e6d07eef9983fe35940d31bd04d9cca5 Mon Sep 17 00:00:00 2001 From: Daniel Juyung Seo Date: Wed, 28 Jul 2010 17:54:14 +0900 Subject: [PATCH] [layout] Added elm_layout_content_unset(). --- src/lib/Elementary.h.in | 1 + src/lib/elm_layout.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index 103bafb..a818d7a 100644 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -667,6 +667,7 @@ extern "C" { EAPI Eina_Bool elm_layout_file_set(Evas_Object *obj, const char *file, const char *group); EAPI Eina_Bool elm_layout_theme_set(Evas_Object *obj, const char *clas, const char *group, const char *style); EAPI void elm_layout_content_set(Evas_Object *obj, const char *swallow, Evas_Object *content); + EAPI Evas_Object *elm_layout_content_unset(Evas_Object *obj, const char *swallow); EAPI Evas_Object *elm_layout_edje_get(const Evas_Object *obj); EAPI void elm_layout_sizing_eval(Evas_Object *obj); /* smart callbacks called: diff --git a/src/lib/elm_layout.c b/src/lib/elm_layout.c index 3ba67d7..6d6f09e 100644 --- a/src/lib/elm_layout.c +++ b/src/lib/elm_layout.c @@ -257,6 +257,40 @@ elm_layout_content_set(Evas_Object *obj, const char *swallow, Evas_Object *conte } /** + * Unset the layout content + * + * Unparent and return the content object which was set for this widget + * + * @param obj The layout object + * @param swallow The swallow group name in the edje file + * @return The content that was being used + * + * @ingroup Layout + */ +EAPI Evas_Object * +elm_layout_content_unset(Evas_Object *obj, const char *swallow) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + Subinfo *si; + const Eina_List *l; + if (!wd) return NULL; + EINA_LIST_FOREACH(wd->subs, l, si) + { + if (!strcmp(swallow, si->swallow)) + { + Evas_Object *content; + if (!si->obj) return NULL; + content = si->obj; /* si will die in _sub_del due elm_widget_sub_object_del() */ + elm_widget_sub_object_del(obj, content); + edje_object_part_unswallow(wd->lay, content); + return content; + } + } + return NULL; +} + +/** * Get the edje layout * * @param obj The layout object -- 2.7.4