*
* @ingroup Layout
*/
- EAPI Evas_Object *elm_layout_content_unset(Evas_Object *obj, const char *swallow) EINA_ARG_NONNULL(1);
+ EAPI Evas_Object *elm_layout_content_unset(Evas_Object *obj, const char *swallow) EINA_ARG_NONNULL(1);
/**
* Set the text of the given part
*
* you want to keep that old content object, use the
* elm_ctxpopup_content_unset() function.
*
+ * @deprecated use elm_object_content_set()
+ *
* @warning Ctxpopup can't hold both a item list and a content at the same
* time. When a content is set, any previous items will be removed.
*/
- EAPI void elm_ctxpopup_content_set(Evas_Object *obj, Evas_Object *content) EINA_ARG_NONNULL(1, 2);
+ EINA_DEPRECATED EAPI void elm_ctxpopup_content_set(Evas_Object *obj, Evas_Object *content) EINA_ARG_NONNULL(1, 2);
/**
* @brief Unset the ctxpopup content
*
*
* Unparent and return the content object which was set for this widget.
*
+ * @deprecated use elm_object_content_unset()
+ *
* @see elm_ctxpopup_content_set()
*/
- EAPI Evas_Object *elm_ctxpopup_content_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI Evas_Object *elm_ctxpopup_content_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* @brief Set the direction priority of a ctxpopup.
*
static void _del_pre_hook(Evas_Object *obj);
static void _del_hook(Evas_Object *obj);
static void _theme_hook(Evas_Object *obj);
+static void _content_set_hook(Evas_Object *obj,
+ const char *item __UNUSED__,
+ Evas_Object *content);
+static Evas_Object * _content_unset_hook(Evas_Object *obj,
+ const char *item __UNUSED__);
+static Evas_Object * _content_get_hook(const Evas_Object *obj,
+ const char *item __UNUSED__);
static void _bg_clicked_cb(void *data, Evas_Object *obj __UNUSED__,
const char *emission __UNUSED__,
const char *source __UNUSED__);
}
static void
+_content_set_hook(Evas_Object *obj, const char *item __UNUSED__,
+ Evas_Object *content)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+
+ Widget_Data *wd;
+
+ wd = elm_widget_data_get(obj);
+ if ((!wd) || (!content)) return;
+
+ if (wd->items) elm_ctxpopup_clear(obj);
+ if (wd->content) evas_object_del(wd->content);
+
+ evas_object_event_callback_add(content, EVAS_CALLBACK_DEL, _content_del,
+ obj);
+
+ elm_widget_sub_object_add(obj, content);
+ edje_object_part_swallow(wd->base, "elm.swallow.content", content);
+ edje_object_message_signal_process(wd->base);
+
+ wd->content = content;
+
+ if (wd->visible)
+ _sizing_eval(obj);
+}
+
+static Evas_Object *
+_content_unset_hook(Evas_Object *obj, const char *item __UNUSED__)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+
+ Widget_Data *wd;
+ Evas_Object *content;
+
+ wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+
+ content = wd->content;
+ if (!content) return NULL;
+
+ edje_object_part_unswallow(wd->base, content);
+ elm_widget_sub_object_del(obj, content);
+ evas_object_event_callback_del(content, EVAS_CALLBACK_DEL, _content_del);
+ edje_object_signal_emit(wd->base, "elm,state,content,disable", "elm");
+
+ wd->content = NULL;
+
+ return content;
+
+}
+
+static Evas_Object *
+_content_get_hook(const Evas_Object *obj, const char *item __UNUSED__)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+ return wd->content;
+}
+
+static void
_bg_clicked_cb(void *data, Evas_Object *obj __UNUSED__,
const char *emission __UNUSED__, const char *source __UNUSED__)
{
_content_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
void *event_info __UNUSED__)
{
- elm_ctxpopup_content_unset(data);
+ elm_object_content_unset(data);
}
static void
elm_widget_del_pre_hook_set(obj, _del_pre_hook);
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_theme_hook_set(obj, _theme_hook);
+ elm_widget_content_set_hook_set(obj, _content_set_hook);
+ elm_widget_content_unset_hook_set(obj, _content_unset_hook);
+ elm_widget_content_get_hook_set(obj, _content_get_hook);
wd->parent = parent;
//The first item is appended.
if (wd->content)
- evas_object_del(elm_ctxpopup_content_unset(obj));
+ evas_object_del(elm_object_content_unset(obj));
if (!wd->items)
_list_new(obj);
EAPI void
elm_ctxpopup_content_set(Evas_Object *obj, Evas_Object *content)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
-
- Widget_Data *wd;
-
- wd = elm_widget_data_get(obj);
- if ((!wd) || (!content))
- return;
-
- if (wd->items)
- elm_ctxpopup_clear(obj);
-
- if (wd->content)
- evas_object_del(wd->content);
-
- evas_object_event_callback_add(content, EVAS_CALLBACK_DEL, _content_del,
- obj);
-
- elm_widget_sub_object_add(obj, content);
- edje_object_part_swallow(wd->base, "elm.swallow.content", content);
- edje_object_message_signal_process(wd->base);
-
- wd->content = content;
-
- if (wd->visible)
- _sizing_eval(obj);
+ elm_object_content_set(obj, content);
}
EAPI Evas_Object *
elm_ctxpopup_content_unset(Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
-
- Widget_Data *wd;
- Evas_Object *content;
-
- wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
-
- content = wd->content;
- if (!content) return NULL;
-
- edje_object_part_unswallow(wd->base, content);
- elm_widget_sub_object_del(obj, content);
- evas_object_event_callback_del(content, EVAS_CALLBACK_DEL, _content_del);
- edje_object_signal_emit(wd->base, "elm,state,content,disable", "elm");
-
- wd->content = NULL;
-
- return content;
+ return elm_object_content_unset(obj);
}
EAPI void