--- /dev/null
+#include "widget_preview_tmpl_head.c"
+
+Evas_Object *o = elm_check_add(win);
+evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+elm_win_resize_object_add(win, o);
+evas_object_show(o);
+
+elm_object_text_set(o, "Check");
+
+Evas_Object *o2 = elm_icon_add(win);
+elm_icon_standard_set(o2, "home");
+elm_object_content_set(o, o2);
+evas_object_show(o2);
+
+#include "widget_preview_tmpl_foot.c"
--- /dev/null
+#include "widget_preview_tmpl_head.c"
+
+Evas_Object *o = elm_check_add(win);
+evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+elm_win_resize_object_add(win, o);
+evas_object_show(o);
+
+Evas_Object *o2 = elm_icon_add(win);
+elm_icon_standard_set(o2, "home");
+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_toggle_icon_set(tg, ic);
- elm_toggle_state_set(tg, 1);
- elm_toggle_states_labels_set(tg, "Yes", "No");
+ 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");
elm_box_pack_end(bx, tg);
evas_object_show(tg);
evas_object_show(ic);
tg = elm_toggle_add(win);
elm_object_text_set(tg, "Icon no scale");
- elm_toggle_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_toggle_add(win);
elm_object_text_set(tg, "Icon no scale");
- elm_toggle_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);
elm_icon_file_set(ic, buf, NULL);
elm_icon_scale_set(ic, 0, 0);
- tg = elm_toggle_add(win);
- elm_toggle_icon_set(tg, ic);
+ tg = elm_check_add(win);
+ elm_object_style_set(tg, "toggle");
+ 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_toggle_icon_set(obj, p->icon);
+ elm_object_content_set(obj, p->icon);
if ((p->on) && (p->off))
elm_toggle_states_labels_set(obj, p->on, p->off);
{
Evas_Object *icon = external_common_param_icon_get(obj, param);
if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE;
- elm_toggle_icon_set(obj, icon);
+ elm_object_content_set(obj, icon);
return EINA_TRUE;
}
}
*
* 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_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->tgl, "elm.swallow.content", icon);
- edje_object_signal_emit(wd->tgl, "elm,state,icon,visible", "elm");
- edje_object_message_signal_process(wd->tgl);
- }
- _sizing_eval(obj);
+ elm_object_content_set(obj, icon);
}
EAPI Evas_Object *
elm_toggle_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 elm_object_content_get(obj);
}
EAPI Evas_Object *
elm_toggle_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->tgl, wd->icon);
- wd->icon = NULL;
- return icon;
+ return elm_object_content_unset(obj);
}
EAPI void