summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorChunEon Park <hermet@hermet.pe.kr>2011-10-28 08:57:33 +0000
committerChunEon Park <hermet@hermet.pe.kr>2011-10-28 08:57:33 +0000
commit5c4fd67f879c80d0f39766ddcaf622b4c4f11710 (patch)
tree89a0d766a7c1281f7a3c189a6dad771716ecd061 /legacy
parent31678440d9772c6dee35f8ba6c0cea2fd47f8b12 (diff)
elementary/check - content_set/get/unset
SVN revision: 64487
Diffstat (limited to 'legacy')
-rw-r--r--legacy/elementary/doc/widgets/widget_preview_check2.c2
-rw-r--r--legacy/elementary/doc/widgets/widget_preview_check3.c2
-rw-r--r--legacy/elementary/src/bin/test_check.c8
-rw-r--r--legacy/elementary/src/bin/test_toggle.c8
-rw-r--r--legacy/elementary/src/edje_externals/elm_check.c4
-rw-r--r--legacy/elementary/src/edje_externals/elm_toggle.c4
-rw-r--r--legacy/elementary/src/examples/check_example_01.c2
-rw-r--r--legacy/elementary/src/lib/Elementary.h.in27
-rw-r--r--legacy/elementary/src/lib/elm_check.c84
-rw-r--r--legacy/elementary/src/lib/elm_toggle.c6
10 files changed, 91 insertions, 56 deletions
diff --git a/legacy/elementary/doc/widgets/widget_preview_check2.c b/legacy/elementary/doc/widgets/widget_preview_check2.c
index 84e4c6660b..d62cc3b66a 100644
--- a/legacy/elementary/doc/widgets/widget_preview_check2.c
+++ b/legacy/elementary/doc/widgets/widget_preview_check2.c
@@ -9,7 +9,7 @@ elm_object_text_set(o, "Check");
9 9
10Evas_Object *o2 = elm_icon_add(win); 10Evas_Object *o2 = elm_icon_add(win);
11elm_icon_standard_set(o2, "home"); 11elm_icon_standard_set(o2, "home");
12elm_check_icon_set(o, o2); 12elm_object_content_set(o, o2);
13evas_object_show(o2); 13evas_object_show(o2);
14 14
15#include "widget_preview_tmpl_foot.c" 15#include "widget_preview_tmpl_foot.c"
diff --git a/legacy/elementary/doc/widgets/widget_preview_check3.c b/legacy/elementary/doc/widgets/widget_preview_check3.c
index b0277703f1..6e4ab64bd8 100644
--- a/legacy/elementary/doc/widgets/widget_preview_check3.c
+++ b/legacy/elementary/doc/widgets/widget_preview_check3.c
@@ -7,7 +7,7 @@ evas_object_show(o);
7 7
8Evas_Object *o2 = elm_icon_add(win); 8Evas_Object *o2 = elm_icon_add(win);
9elm_icon_standard_set(o2, "home"); 9elm_icon_standard_set(o2, "home");
10elm_check_icon_set(o, o2); 10elm_object_content_set(o, o2);
11evas_object_show(o2); 11evas_object_show(o2);
12 12
13#include "widget_preview_tmpl_foot.c" 13#include "widget_preview_tmpl_foot.c"
diff --git a/legacy/elementary/src/bin/test_check.c b/legacy/elementary/src/bin/test_check.c
index be807d2bb4..0de6bdca19 100644
--- a/legacy/elementary/src/bin/test_check.c
+++ b/legacy/elementary/src/bin/test_check.c
@@ -31,7 +31,7 @@ test_check(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
31 evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 31 evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
32 evas_object_size_hint_align_set(ck, EVAS_HINT_FILL, 0.5); 32 evas_object_size_hint_align_set(ck, EVAS_HINT_FILL, 0.5);
33 elm_object_text_set(ck, "Icon sized to check"); 33 elm_object_text_set(ck, "Icon sized to check");
34 elm_check_icon_set(ck, ic); 34 elm_object_content_set(ck, ic);
35 elm_check_state_set(ck, 1); 35 elm_check_state_set(ck, 1);
36 elm_box_pack_end(bx, ck); 36 elm_box_pack_end(bx, ck);
37 evas_object_show(ck); 37 evas_object_show(ck);
@@ -43,7 +43,7 @@ test_check(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
43 elm_icon_scale_set(ic, 0, 0); 43 elm_icon_scale_set(ic, 0, 0);
44 ck = elm_check_add(win); 44 ck = elm_check_add(win);
45 elm_object_text_set(ck, "Icon no scale"); 45 elm_object_text_set(ck, "Icon no scale");
46 elm_check_icon_set(ck, ic); 46 elm_object_content_set(ck, ic);
47 elm_box_pack_end(bx, ck); 47 elm_box_pack_end(bx, ck);
48 evas_object_show(ck); 48 evas_object_show(ck);
49 evas_object_show(ic); 49 evas_object_show(ic);
@@ -61,7 +61,7 @@ test_check(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
61 evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 61 evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
62 evas_object_size_hint_align_set(ck, EVAS_HINT_FILL, 0.5); 62 evas_object_size_hint_align_set(ck, EVAS_HINT_FILL, 0.5);
63 elm_object_text_set(ck, "Disabled check"); 63 elm_object_text_set(ck, "Disabled check");
64 elm_check_icon_set(ck, ic); 64 elm_object_content_set(ck, ic);
65 elm_check_state_set(ck, 1); 65 elm_check_state_set(ck, 1);
66 elm_box_pack_end(bx, ck); 66 elm_box_pack_end(bx, ck);
67 elm_object_disabled_set(ck, 1); 67 elm_object_disabled_set(ck, 1);
@@ -73,7 +73,7 @@ test_check(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
73 elm_icon_file_set(ic, buf, NULL); 73 elm_icon_file_set(ic, buf, NULL);
74 elm_icon_scale_set(ic, 0, 0); 74 elm_icon_scale_set(ic, 0, 0);
75 ck = elm_check_add(win); 75 ck = elm_check_add(win);
76 elm_check_icon_set(ck, ic); 76 elm_object_content_set(ck, ic);
77 elm_box_pack_end(bx, ck); 77 elm_box_pack_end(bx, ck);
78 evas_object_show(ck); 78 evas_object_show(ck);
79 evas_object_show(ic); 79 evas_object_show(ic);
diff --git a/legacy/elementary/src/bin/test_toggle.c b/legacy/elementary/src/bin/test_toggle.c
index 5ca11d93a4..9fb813f0ba 100644
--- a/legacy/elementary/src/bin/test_toggle.c
+++ b/legacy/elementary/src/bin/test_toggle.c
@@ -33,7 +33,7 @@ test_toggle(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
33 evas_object_size_hint_weight_set(tg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 33 evas_object_size_hint_weight_set(tg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
34 evas_object_size_hint_align_set(tg, EVAS_HINT_FILL, 0.5); 34 evas_object_size_hint_align_set(tg, EVAS_HINT_FILL, 0.5);
35 elm_object_text_set(tg, "Icon sized to toggle"); 35 elm_object_text_set(tg, "Icon sized to toggle");
36 elm_check_icon_set(tg, ic); 36 elm_object_content_set(tg, ic);
37 elm_check_state_set(tg, 1); 37 elm_check_state_set(tg, 1);
38 elm_object_text_part_set(tg, "on", "Yes"); 38 elm_object_text_part_set(tg, "on", "Yes");
39 elm_object_text_part_set(tg, "off", "No"); 39 elm_object_text_part_set(tg, "off", "No");
@@ -49,7 +49,7 @@ test_toggle(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
49 tg = elm_check_add(win); 49 tg = elm_check_add(win);
50 elm_object_style_set(tg, "toggle"); 50 elm_object_style_set(tg, "toggle");
51 elm_object_text_set(tg, "Icon no scale"); 51 elm_object_text_set(tg, "Icon no scale");
52 elm_check_icon_set(tg, ic); 52 elm_object_content_set(tg, ic);
53 elm_box_pack_end(bx, tg); 53 elm_box_pack_end(bx, tg);
54 evas_object_show(tg); 54 evas_object_show(tg);
55 evas_object_show(ic); 55 evas_object_show(ic);
@@ -62,7 +62,7 @@ test_toggle(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
62 tg = elm_check_add(win); 62 tg = elm_check_add(win);
63 elm_object_style_set(tg, "toggle"); 63 elm_object_style_set(tg, "toggle");
64 elm_object_text_set(tg, "Icon no scale"); 64 elm_object_text_set(tg, "Icon no scale");
65 elm_check_icon_set(tg, ic); 65 elm_object_content_set(tg, ic);
66 elm_object_disabled_set(tg, 1); 66 elm_object_disabled_set(tg, 1);
67 elm_box_pack_end(bx, tg); 67 elm_box_pack_end(bx, tg);
68 evas_object_show(tg); 68 evas_object_show(tg);
@@ -83,7 +83,7 @@ test_toggle(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
83 83
84 tg = elm_check_add(win); 84 tg = elm_check_add(win);
85 elm_object_style_set(tg, "toggle"); 85 elm_object_style_set(tg, "toggle");
86 elm_check_icon_set(tg, ic); 86 elm_object_content_set(tg, ic);
87 elm_box_pack_end(bx, tg); 87 elm_box_pack_end(bx, tg);
88 evas_object_show(tg); 88 evas_object_show(tg);
89 evas_object_show(ic); 89 evas_object_show(ic);
diff --git a/legacy/elementary/src/edje_externals/elm_check.c b/legacy/elementary/src/edje_externals/elm_check.c
index 985a39c56b..0c3fd0ab47 100644
--- a/legacy/elementary/src/edje_externals/elm_check.c
+++ b/legacy/elementary/src/edje_externals/elm_check.c
@@ -21,7 +21,7 @@ external_check_state_set(void *data __UNUSED__, Evas_Object *obj, const void *fr
21 if (p->label) 21 if (p->label)
22 elm_object_text_set(obj, p->label); 22 elm_object_text_set(obj, p->label);
23 if (p->icon) 23 if (p->icon)
24 elm_check_icon_set(obj, p->icon); 24 elm_object_content_set(obj, p->icon);
25 if (p->state_exists) 25 if (p->state_exists)
26 elm_check_state_set(obj, p->state); 26 elm_check_state_set(obj, p->state);
27} 27}
@@ -43,7 +43,7 @@ external_check_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_Ext
43 { 43 {
44 Evas_Object *icon = external_common_param_icon_get(obj, param); 44 Evas_Object *icon = external_common_param_icon_get(obj, param);
45 if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE; 45 if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE;
46 elm_check_icon_set(obj, icon); 46 elm_object_content_set(obj, icon);
47 return EINA_TRUE; 47 return EINA_TRUE;
48 } 48 }
49 } 49 }
diff --git a/legacy/elementary/src/edje_externals/elm_toggle.c b/legacy/elementary/src/edje_externals/elm_toggle.c
index 86c043775c..7d9e0972fa 100644
--- a/legacy/elementary/src/edje_externals/elm_toggle.c
+++ b/legacy/elementary/src/edje_externals/elm_toggle.c
@@ -24,7 +24,7 @@ external_toggle_state_set(void *data __UNUSED__, Evas_Object *obj, const void *f
24 if (p->label) 24 if (p->label)
25 elm_object_text_set(obj, p->label); 25 elm_object_text_set(obj, p->label);
26 if (p->icon) 26 if (p->icon)
27 elm_check_icon_set(obj, p->icon); 27 elm_object_content_set(obj, p->icon);
28 28
29 if (p->on) 29 if (p->on)
30 elm_object_text_part_set(obj, "on", p->on); 30 elm_object_text_part_set(obj, "on", p->on);
@@ -52,7 +52,7 @@ external_toggle_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_Ex
52 { 52 {
53 Evas_Object *icon = external_common_param_icon_get(obj, param); 53 Evas_Object *icon = external_common_param_icon_get(obj, param);
54 if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE; 54 if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE;
55 elm_check_icon_set(obj, icon); 55 elm_object_content_set(obj, icon);
56 return EINA_TRUE; 56 return EINA_TRUE;
57 } 57 }
58 } 58 }
diff --git a/legacy/elementary/src/examples/check_example_01.c b/legacy/elementary/src/examples/check_example_01.c
index 40c4a2b0d9..2f5e99a37c 100644
--- a/legacy/elementary/src/examples/check_example_01.c
+++ b/legacy/elementary/src/examples/check_example_01.c
@@ -40,7 +40,7 @@ elm_main(int argc, char **argv)
40 cb2 = elm_check_add(win); 40 cb2 = elm_check_add(win);
41 elm_object_text_set(cb2, "another checkbox"); 41 elm_object_text_set(cb2, "another checkbox");
42 elm_check_state_set(cb2, EINA_TRUE); 42 elm_check_state_set(cb2, EINA_TRUE);
43 elm_check_icon_set(cb2, icon); 43 elm_object_content_set(cb2, icon);
44 evas_object_move(cb2, 10, 50); 44 evas_object_move(cb2, 10, 50);
45 evas_object_resize(cb2, 200, 30); 45 evas_object_resize(cb2, 200, 30);
46 evas_object_show(cb2); 46 evas_object_show(cb2);
diff --git a/legacy/elementary/src/lib/Elementary.h.in b/legacy/elementary/src/lib/Elementary.h.in
index dd018b7ec9..8897d55f22 100644
--- a/legacy/elementary/src/lib/Elementary.h.in
+++ b/legacy/elementary/src/lib/Elementary.h.in
@@ -6170,7 +6170,7 @@ extern "C" {
6170 * 6170 *
6171 * Default text parts of the button widget that you can use for are: 6171 * Default text parts of the button widget that you can use for are:
6172 * 6172 *
6173 * @li "elm.text" - Title label of the button 6173 * @li "elm.text" - Label of the button
6174 * 6174 *
6175 * Follow through a complete example @ref button_example_01 "here". 6175 * Follow through a complete example @ref button_example_01 "here".
6176 * @{ 6176 * @{
@@ -7658,7 +7658,7 @@ extern "C" {
7658 * If you want to keep that old content object, use the 7658 * If you want to keep that old content object, use the
7659 * elm_toggle_icon_unset() function. 7659 * elm_toggle_icon_unset() function.
7660 * 7660 *
7661 * @deprecated use elm_check_icon_set() instead. 7661 * @deprecated use elm_object_content_set() instead.
7662 */ 7662 */
7663 EINA_DEPRECATED EAPI void elm_toggle_icon_set(Evas_Object *obj, Evas_Object *icon) EINA_ARG_NONNULL(1); 7663 EINA_DEPRECATED EAPI void elm_toggle_icon_set(Evas_Object *obj, Evas_Object *icon) EINA_ARG_NONNULL(1);
7664 /** 7664 /**
@@ -7671,7 +7671,7 @@ extern "C" {
7671 * 7671 *
7672 * @see elm_toggle_icon_set() 7672 * @see elm_toggle_icon_set()
7673 * 7673 *
7674 * @deprecated use elm_check_icon_get() instead. 7674 * @deprecated use elm_object_content_get() instead.
7675 */ 7675 */
7676 EINA_DEPRECATED EAPI Evas_Object *elm_toggle_icon_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); 7676 EINA_DEPRECATED EAPI Evas_Object *elm_toggle_icon_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
7677 /** 7677 /**
@@ -7684,7 +7684,7 @@ extern "C" {
7684 * 7684 *
7685 * @see elm_toggle_icon_set() 7685 * @see elm_toggle_icon_set()
7686 * 7686 *
7687 * @deprecated use elm_check_icon_unset() instead. 7687 * @deprecated use elm_object_content_unset() instead.
7688 */ 7688 */
7689 EINA_DEPRECATED EAPI Evas_Object *elm_toggle_icon_unset(Evas_Object *obj) EINA_ARG_NONNULL(1); 7689 EINA_DEPRECATED EAPI Evas_Object *elm_toggle_icon_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
7690 /** 7690 /**
@@ -19668,7 +19668,16 @@ extern "C" {
19668 * "changed" - This is called whenever the user changes the state of one of 19668 * "changed" - This is called whenever the user changes the state of one of
19669 * the check object(event_info is NULL). 19669 * the check object(event_info is NULL).
19670 * 19670 *
19671 * @ref tutorial_check should give you a firm grasp of how to use this widget. 19671 * Default contents parts of the check widget that you can use for are:
19672 *
19673 * @li "elm.swallow.content" - A icon of the check
19674 *
19675 * Default text parts of the check widget that you can use for are:
19676 *
19677 * @li "elm.text" - Label of the check
19678 *
19679 * @ref tutorial_check should give you a firm grasp of how to use this widget
19680 * .
19672 * @{ 19681 * @{
19673 */ 19682 */
19674 /** 19683 /**
@@ -19704,16 +19713,16 @@ extern "C" {
19704 * 19713 *
19705 * Once the icon object is set, a previously set one will be deleted. 19714 * Once the icon object is set, a previously set one will be deleted.
19706 * If you want to keep that old content object, use the 19715 * If you want to keep that old content object, use the
19707 * elm_check_icon_unset() function. 19716 * elm_object_content_unset() function.
19708 */ 19717 */
19709 EAPI void elm_check_icon_set(Evas_Object *obj, Evas_Object *icon) EINA_ARG_NONNULL(1); 19718 EINA_DEPRECATED EAPI void elm_check_icon_set(Evas_Object *obj, Evas_Object *icon) EINA_ARG_NONNULL(1);
19710 /** 19719 /**
19711 * @brief Get the icon object of the check object 19720 * @brief Get the icon object of the check object
19712 * 19721 *
19713 * @param obj The check object 19722 * @param obj The check object
19714 * @return The icon object 19723 * @return The icon object
19715 */ 19724 */
19716 EAPI Evas_Object *elm_check_icon_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); 19725 EINA_DEPRECATED EAPI Evas_Object *elm_check_icon_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
19717 /** 19726 /**
19718 * @brief Unset the icon used for the check object 19727 * @brief Unset the icon used for the check object
19719 * 19728 *
@@ -19722,7 +19731,7 @@ extern "C" {
19722 * 19731 *
19723 * Unparent and return the icon object which was set for this widget. 19732 * Unparent and return the icon object which was set for this widget.
19724 */ 19733 */
19725 EAPI Evas_Object *elm_check_icon_unset(Evas_Object *obj) EINA_ARG_NONNULL(1); 19734 EINA_DEPRECATED EAPI Evas_Object *elm_check_icon_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
19726 /** 19735 /**
19727 * @brief Set the on/off state of the check object 19736 * @brief Set the on/off state of the check object
19728 * 19737 *
diff --git a/legacy/elementary/src/lib/elm_check.c b/legacy/elementary/src/lib/elm_check.c
index 7f08900f1f..7038c71f88 100644
--- a/legacy/elementary/src/lib/elm_check.c
+++ b/legacy/elementary/src/lib/elm_check.c
@@ -25,6 +25,10 @@ static void _signal_check_on(void *data, Evas_Object *obj, const char *emission,
25static void _signal_check_toggle(void *data, Evas_Object *obj, const char *emission, const char *source); 25static void _signal_check_toggle(void *data, Evas_Object *obj, const char *emission, const char *source);
26static void _on_focus_hook(void *data, Evas_Object *obj); 26static void _on_focus_hook(void *data, Evas_Object *obj);
27static void _activate_hook(Evas_Object *obj); 27static void _activate_hook(Evas_Object *obj);
28static void _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content);
29static Evas_Object *_content_get_hook(const Evas_Object *obj, const char *part);
30static Evas_Object *_content_unset_hook(Evas_Object *obj, const char *part);
31
28static void _activate(Evas_Object *obj); 32static void _activate(Evas_Object *obj);
29static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src, 33static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src,
30 Evas_Callback_Type type, void *event_info); 34 Evas_Callback_Type type, void *event_info);
@@ -203,6 +207,51 @@ _activate_hook(Evas_Object *obj)
203} 207}
204 208
205static void 209static void
210_content_set_hook(Evas_Object *obj, const char *part __UNUSED__, Evas_Object *content)
211{
212 ELM_CHECK_WIDTYPE(obj, widtype);
213 Widget_Data *wd = elm_widget_data_get(obj);
214 if (!wd) return;
215 if (wd->icon == content) return;
216 if (wd->icon) evas_object_del(wd->icon);
217 wd->icon = content;
218 if (content)
219 {
220 elm_widget_sub_object_add(obj, content);
221 evas_object_event_callback_add(content,
222 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
223 _changed_size_hints, obj);
224 edje_object_part_swallow(wd->chk, "elm.swallow.content", content);
225 edje_object_signal_emit(wd->chk, "elm,state,icon,visible", "elm");
226 edje_object_message_signal_process(wd->chk);
227 }
228 _sizing_eval(obj);
229}
230
231static Evas_Object *
232_content_get_hook(const Evas_Object *obj, const char *part __UNUSED__)
233{
234 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
235 Widget_Data *wd = elm_widget_data_get(obj);
236 if (!wd) return NULL;
237 return wd->icon;
238}
239
240static Evas_Object *
241_content_unset_hook(Evas_Object *obj, const char *part __UNUSED__)
242{
243 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
244 Widget_Data *wd = elm_widget_data_get(obj);
245 if (!wd) return NULL;
246 if (!wd->icon) return NULL;
247 Evas_Object *icon = wd->icon;
248 elm_widget_sub_object_del(obj, wd->icon);
249 edje_object_part_unswallow(wd->chk, wd->icon);
250 wd->icon = NULL;
251 return icon;
252}
253
254static void
206_activate(Evas_Object *obj) 255_activate(Evas_Object *obj)
207{ 256{
208 Widget_Data *wd = elm_widget_data_get(obj); 257 Widget_Data *wd = elm_widget_data_get(obj);
@@ -347,6 +396,9 @@ elm_check_add(Evas_Object *parent)
347 elm_widget_event_hook_set(obj, _event_hook); 396 elm_widget_event_hook_set(obj, _event_hook);
348 elm_widget_text_set_hook_set(obj, _elm_check_label_set); 397 elm_widget_text_set_hook_set(obj, _elm_check_label_set);
349 elm_widget_text_get_hook_set(obj, _elm_check_label_get); 398 elm_widget_text_get_hook_set(obj, _elm_check_label_get);
399 elm_widget_content_set_hook_set(obj, _content_set_hook);
400 elm_widget_content_get_hook_set(obj, _content_get_hook);
401 elm_widget_content_unset_hook_set(obj, _content_unset_hook);
350 402
351 wd->chk = edje_object_add(e); 403 wd->chk = edje_object_add(e);
352 _elm_theme_object_set(obj, wd->chk, "check", "base", "default"); 404 _elm_theme_object_set(obj, wd->chk, "check", "base", "default");
@@ -406,45 +458,19 @@ elm_check_states_labels_get(const Evas_Object *obj, const char **ontext, const c
406EAPI void 458EAPI void
407elm_check_icon_set(Evas_Object *obj, Evas_Object *icon) 459elm_check_icon_set(Evas_Object *obj, Evas_Object *icon)
408{ 460{
409 ELM_CHECK_WIDTYPE(obj, widtype); 461 _content_set_hook(obj, NULL, icon);
410 Widget_Data *wd = elm_widget_data_get(obj);
411 if (!wd) return;
412 if (wd->icon == icon) return;
413 if (wd->icon) evas_object_del(wd->icon);
414 wd->icon = icon;
415 if (icon)
416 {
417 elm_widget_sub_object_add(obj, icon);
418 evas_object_event_callback_add(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
419 _changed_size_hints, obj);
420 edje_object_part_swallow(wd->chk, "elm.swallow.content", icon);
421 edje_object_signal_emit(wd->chk, "elm,state,icon,visible", "elm");
422 edje_object_message_signal_process(wd->chk);
423 }
424 _sizing_eval(obj);
425} 462}
426 463
427EAPI Evas_Object * 464EAPI Evas_Object *
428elm_check_icon_get(const Evas_Object *obj) 465elm_check_icon_get(const Evas_Object *obj)
429{ 466{
430 ELM_CHECK_WIDTYPE(obj, widtype) NULL; 467 return _content_get_hook(obj, NULL);
431 Widget_Data *wd = elm_widget_data_get(obj);
432 if (!wd) return NULL;
433 return wd->icon;
434} 468}
435 469
436EAPI Evas_Object * 470EAPI Evas_Object *
437elm_check_icon_unset(Evas_Object *obj) 471elm_check_icon_unset(Evas_Object *obj)
438{ 472{
439 ELM_CHECK_WIDTYPE(obj, widtype) NULL; 473 return _content_unset_hook(obj, NULL);
440 Widget_Data *wd = elm_widget_data_get(obj);
441 if (!wd) return NULL;
442 if (!wd->icon) return NULL;
443 Evas_Object *icon = wd->icon;
444 elm_widget_sub_object_del(obj, wd->icon);
445 edje_object_part_unswallow(wd->chk, wd->icon);
446 wd->icon = NULL;
447 return icon;
448} 474}
449 475
450EAPI void 476EAPI void
diff --git a/legacy/elementary/src/lib/elm_toggle.c b/legacy/elementary/src/lib/elm_toggle.c
index b4c8edbdaf..e2b195ea4e 100644
--- a/legacy/elementary/src/lib/elm_toggle.c
+++ b/legacy/elementary/src/lib/elm_toggle.c
@@ -28,19 +28,19 @@ elm_toggle_label_get(const Evas_Object *obj)
28EAPI void 28EAPI void
29elm_toggle_icon_set(Evas_Object *obj, Evas_Object *icon) 29elm_toggle_icon_set(Evas_Object *obj, Evas_Object *icon)
30{ 30{
31 elm_check_icon_set(obj, icon); 31 elm_object_content_set(obj, icon);
32} 32}
33 33
34EAPI Evas_Object * 34EAPI Evas_Object *
35elm_toggle_icon_get(const Evas_Object *obj) 35elm_toggle_icon_get(const Evas_Object *obj)
36{ 36{
37 return elm_check_icon_get(obj); 37 return elm_object_content_get(obj);
38} 38}
39 39
40EAPI Evas_Object * 40EAPI Evas_Object *
41elm_toggle_icon_unset(Evas_Object *obj) 41elm_toggle_icon_unset(Evas_Object *obj)
42{ 42{
43 return elm_check_icon_unset(obj); 43 return elm_object_content_unset(obj);
44} 44}
45 45
46EAPI void 46EAPI void