Evas_Object *o2 = elm_icon_add(win);
elm_icon_standard_set(o2, "home");
-elm_check_icon_set(o, o2);
+elm_object_content_set(o, o2);
evas_object_show(o2);
#include "widget_preview_tmpl_foot.c"
Evas_Object *o2 = elm_icon_add(win);
elm_icon_standard_set(o2, "home");
-elm_check_icon_set(o, o2);
+elm_object_content_set(o, o2);
evas_object_show(o2);
#include "widget_preview_tmpl_foot.c"
evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(ck, EVAS_HINT_FILL, 0.5);
elm_object_text_set(ck, "Icon sized to check");
- elm_check_icon_set(ck, ic);
+ elm_object_content_set(ck, ic);
elm_check_state_set(ck, 1);
elm_box_pack_end(bx, ck);
evas_object_show(ck);
elm_icon_scale_set(ic, 0, 0);
ck = elm_check_add(win);
elm_object_text_set(ck, "Icon no scale");
- elm_check_icon_set(ck, ic);
+ elm_object_content_set(ck, ic);
elm_box_pack_end(bx, ck);
evas_object_show(ck);
evas_object_show(ic);
evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(ck, EVAS_HINT_FILL, 0.5);
elm_object_text_set(ck, "Disabled check");
- elm_check_icon_set(ck, ic);
+ elm_object_content_set(ck, ic);
elm_check_state_set(ck, 1);
elm_box_pack_end(bx, ck);
elm_object_disabled_set(ck, 1);
elm_icon_file_set(ic, buf, NULL);
elm_icon_scale_set(ic, 0, 0);
ck = elm_check_add(win);
- elm_check_icon_set(ck, ic);
+ elm_object_content_set(ck, ic);
elm_box_pack_end(bx, ck);
evas_object_show(ck);
evas_object_show(ic);
evas_object_size_hint_weight_set(tg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(tg, EVAS_HINT_FILL, 0.5);
elm_object_text_set(tg, "Icon sized to toggle");
- elm_check_icon_set(tg, ic);
+ elm_object_content_set(tg, ic);
elm_check_state_set(tg, 1);
elm_object_text_part_set(tg, "on", "Yes");
elm_object_text_part_set(tg, "off", "No");
tg = elm_check_add(win);
elm_object_style_set(tg, "toggle");
elm_object_text_set(tg, "Icon no scale");
- elm_check_icon_set(tg, ic);
+ elm_object_content_set(tg, ic);
elm_box_pack_end(bx, tg);
evas_object_show(tg);
evas_object_show(ic);
tg = elm_check_add(win);
elm_object_style_set(tg, "toggle");
elm_object_text_set(tg, "Icon no scale");
- elm_check_icon_set(tg, ic);
+ elm_object_content_set(tg, ic);
elm_object_disabled_set(tg, 1);
elm_box_pack_end(bx, tg);
evas_object_show(tg);
tg = elm_check_add(win);
elm_object_style_set(tg, "toggle");
- elm_check_icon_set(tg, ic);
+ elm_object_content_set(tg, ic);
elm_box_pack_end(bx, tg);
evas_object_show(tg);
evas_object_show(ic);
if (p->label)
elm_object_text_set(obj, p->label);
if (p->icon)
- elm_check_icon_set(obj, p->icon);
+ elm_object_content_set(obj, p->icon);
if (p->state_exists)
elm_check_state_set(obj, p->state);
}
{
Evas_Object *icon = external_common_param_icon_get(obj, param);
if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE;
- elm_check_icon_set(obj, icon);
+ elm_object_content_set(obj, icon);
return EINA_TRUE;
}
}
if (p->label)
elm_object_text_set(obj, p->label);
if (p->icon)
- elm_check_icon_set(obj, p->icon);
+ elm_object_content_set(obj, p->icon);
if (p->on)
elm_object_text_part_set(obj, "on", p->on);
{
Evas_Object *icon = external_common_param_icon_get(obj, param);
if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE;
- elm_check_icon_set(obj, icon);
+ elm_object_content_set(obj, icon);
return EINA_TRUE;
}
}
cb2 = elm_check_add(win);
elm_object_text_set(cb2, "another checkbox");
elm_check_state_set(cb2, EINA_TRUE);
- elm_check_icon_set(cb2, icon);
+ elm_object_content_set(cb2, icon);
evas_object_move(cb2, 10, 50);
evas_object_resize(cb2, 200, 30);
evas_object_show(cb2);
*
* Default text parts of the button widget that you can use for are:
*
- * @li "elm.text" - Title label of the button
+ * @li "elm.text" - Label of the button
*
* Follow through a complete example @ref button_example_01 "here".
* @{
* If you want to keep that old content object, use the
* elm_toggle_icon_unset() function.
*
- * @deprecated use elm_check_icon_set() instead.
+ * @deprecated use elm_object_content_set() instead.
*/
EINA_DEPRECATED EAPI void elm_toggle_icon_set(Evas_Object *obj, Evas_Object *icon) EINA_ARG_NONNULL(1);
/**
*
* @see elm_toggle_icon_set()
*
- * @deprecated use elm_check_icon_get() instead.
+ * @deprecated use elm_object_content_get() instead.
*/
EINA_DEPRECATED EAPI Evas_Object *elm_toggle_icon_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
*
* @see elm_toggle_icon_set()
*
- * @deprecated use elm_check_icon_unset() instead.
+ * @deprecated use elm_object_content_unset() instead.
*/
EINA_DEPRECATED EAPI Evas_Object *elm_toggle_icon_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* "changed" - This is called whenever the user changes the state of one of
* the check object(event_info is NULL).
*
- * @ref tutorial_check should give you a firm grasp of how to use this widget.
+ * Default contents parts of the check widget that you can use for are:
+ *
+ * @li "elm.swallow.content" - A icon of the check
+ *
+ * Default text parts of the check widget that you can use for are:
+ *
+ * @li "elm.text" - Label of the check
+ *
+ * @ref tutorial_check should give you a firm grasp of how to use this widget
+ * .
* @{
*/
/**
*
* Once the icon object is set, a previously set one will be deleted.
* If you want to keep that old content object, use the
- * elm_check_icon_unset() function.
+ * elm_object_content_unset() function.
*/
- EAPI void elm_check_icon_set(Evas_Object *obj, Evas_Object *icon) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI void elm_check_icon_set(Evas_Object *obj, Evas_Object *icon) EINA_ARG_NONNULL(1);
/**
* @brief Get the icon object of the check object
*
* @param obj The check object
* @return The icon object
*/
- EAPI Evas_Object *elm_check_icon_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI Evas_Object *elm_check_icon_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* @brief Unset the icon used for the check object
*
*
* Unparent and return the icon object which was set for this widget.
*/
- EAPI Evas_Object *elm_check_icon_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI Evas_Object *elm_check_icon_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* @brief Set the on/off state of the check object
*
static void _signal_check_toggle(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _on_focus_hook(void *data, Evas_Object *obj);
static void _activate_hook(Evas_Object *obj);
+static void _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content);
+static Evas_Object *_content_get_hook(const Evas_Object *obj, const char *part);
+static Evas_Object *_content_unset_hook(Evas_Object *obj, const char *part);
+
static void _activate(Evas_Object *obj);
static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src,
Evas_Callback_Type type, void *event_info);
}
static void
+_content_set_hook(Evas_Object *obj, const char *part __UNUSED__, Evas_Object *content)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ if (wd->icon == content) return;
+ if (wd->icon) evas_object_del(wd->icon);
+ wd->icon = content;
+ if (content)
+ {
+ elm_widget_sub_object_add(obj, content);
+ evas_object_event_callback_add(content,
+ EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+ _changed_size_hints, obj);
+ edje_object_part_swallow(wd->chk, "elm.swallow.content", content);
+ edje_object_signal_emit(wd->chk, "elm,state,icon,visible", "elm");
+ edje_object_message_signal_process(wd->chk);
+ }
+ _sizing_eval(obj);
+}
+
+static Evas_Object *
+_content_get_hook(const Evas_Object *obj, const char *part __UNUSED__)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+ return wd->icon;
+}
+
+static Evas_Object *
+_content_unset_hook(Evas_Object *obj, const char *part __UNUSED__)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+ if (!wd->icon) return NULL;
+ Evas_Object *icon = wd->icon;
+ elm_widget_sub_object_del(obj, wd->icon);
+ edje_object_part_unswallow(wd->chk, wd->icon);
+ wd->icon = NULL;
+ return icon;
+}
+
+static void
_activate(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
elm_widget_event_hook_set(obj, _event_hook);
elm_widget_text_set_hook_set(obj, _elm_check_label_set);
elm_widget_text_get_hook_set(obj, _elm_check_label_get);
+ elm_widget_content_set_hook_set(obj, _content_set_hook);
+ elm_widget_content_get_hook_set(obj, _content_get_hook);
+ elm_widget_content_unset_hook_set(obj, _content_unset_hook);
wd->chk = edje_object_add(e);
_elm_theme_object_set(obj, wd->chk, "check", "base", "default");
EAPI void
elm_check_icon_set(Evas_Object *obj, Evas_Object *icon)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (wd->icon == icon) return;
- if (wd->icon) evas_object_del(wd->icon);
- wd->icon = icon;
- if (icon)
- {
- elm_widget_sub_object_add(obj, icon);
- evas_object_event_callback_add(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints, obj);
- edje_object_part_swallow(wd->chk, "elm.swallow.content", icon);
- edje_object_signal_emit(wd->chk, "elm,state,icon,visible", "elm");
- edje_object_message_signal_process(wd->chk);
- }
- _sizing_eval(obj);
+ _content_set_hook(obj, NULL, icon);
}
EAPI Evas_Object *
elm_check_icon_get(const Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return wd->icon;
+ return _content_get_hook(obj, NULL);
}
EAPI Evas_Object *
elm_check_icon_unset(Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- if (!wd->icon) return NULL;
- Evas_Object *icon = wd->icon;
- elm_widget_sub_object_del(obj, wd->icon);
- edje_object_part_unswallow(wd->chk, wd->icon);
- wd->icon = NULL;
- return icon;
+ return _content_unset_hook(obj, NULL);
}
EAPI void
EAPI void
elm_toggle_icon_set(Evas_Object *obj, Evas_Object *icon)
{
- elm_check_icon_set(obj, icon);
+ elm_object_content_set(obj, icon);
}
EAPI Evas_Object *
elm_toggle_icon_get(const Evas_Object *obj)
{
- return elm_check_icon_get(obj);
+ return elm_object_content_get(obj);
}
EAPI Evas_Object *
elm_toggle_icon_unset(Evas_Object *obj)
{
- return elm_check_icon_unset(obj);
+ return elm_object_content_unset(obj);
}
EAPI void