summaryrefslogtreecommitdiff
path: root/legacy/elementary/src/lib/elm_conform.c
diff options
context:
space:
mode:
Diffstat (limited to 'legacy/elementary/src/lib/elm_conform.c')
-rw-r--r--legacy/elementary/src/lib/elm_conform.c96
1 files changed, 61 insertions, 35 deletions
diff --git a/legacy/elementary/src/lib/elm_conform.c b/legacy/elementary/src/lib/elm_conform.c
index b6321756ea..620b79ed4f 100644
--- a/legacy/elementary/src/lib/elm_conform.c
+++ b/legacy/elementary/src/lib/elm_conform.c
@@ -47,6 +47,12 @@ static void _del_pre_hook(Evas_Object *obj);
47static void _del_hook(Evas_Object *obj); 47static void _del_hook(Evas_Object *obj);
48static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); 48static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
49static void _theme_hook(Evas_Object *obj); 49static void _theme_hook(Evas_Object *obj);
50static void _content_set_hook(Evas_Object *obj,
51 const char *part,
52 Evas_Object *content);
53static Evas_Object *_content_get_hook(const Evas_Object *obj,
54 const char *part);
55static Evas_Object *_content_unset_hook(Evas_Object *obj, const char *part);
50static void _swallow_conformant_parts(Evas_Object *obj); 56static void _swallow_conformant_parts(Evas_Object *obj);
51static void _conformant_part_size_set(Evas_Object *obj, 57static void _conformant_part_size_set(Evas_Object *obj,
52 Evas_Object *sobj, 58 Evas_Object *sobj,
@@ -56,11 +62,15 @@ static void _conformant_part_size_set(Evas_Object *obj,
56 Evas_Coord sh); 62 Evas_Coord sh);
57static void _conformant_part_sizing_eval(Evas_Object *obj, 63static void _conformant_part_sizing_eval(Evas_Object *obj,
58 Conformant_Part_Type part_type); 64 Conformant_Part_Type part_type);
59static void 65static void _conformant_move_resize_event_cb(void *data,
60_conformant_move_resize_event_cb(void *data, Evas *e, Evas_Object *obj, 66 Evas *e,
61 void *event_info); 67 Evas_Object *obj,
68 void *event_info);
62static void _sizing_eval(Evas_Object *obj); 69static void _sizing_eval(Evas_Object *obj);
63static Eina_Bool _prop_change(void *data, int type, void *event); 70static Eina_Bool _prop_change(void *data, int type, void *event);
71static void _changed_size_hints(void *data, Evas *e,
72 Evas_Object *obj,
73 void *event_info);
64 74
65/* local functions */ 75/* local functions */
66static void 76static void
@@ -111,6 +121,51 @@ _theme_hook(Evas_Object *obj)
111} 121}
112 122
113static void 123static void
124_content_set_hook(Evas_Object *obj, const char *part __UNUSED__, Evas_Object *content)
125{
126 ELM_CHECK_WIDTYPE(obj, widtype);
127 Widget_Data *wd = elm_widget_data_get(obj);
128
129 if (!wd) return;
130 if (wd->content == content) return;
131 if (wd->content) evas_object_del(wd->content);
132 wd->content = content;
133 if (content)
134 {
135 elm_widget_sub_object_add(obj, content);
136 evas_object_event_callback_add(content,
137 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
138 _changed_size_hints, obj);
139 edje_object_part_swallow(wd->base, "elm.swallow.content", content);
140 }
141 _sizing_eval(obj);
142}
143
144static Evas_Object *
145_content_get_hook(const Evas_Object *obj, const char *part __UNUSED__)
146{
147 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
148 Widget_Data *wd = elm_widget_data_get(obj);
149 if (!wd) return NULL;
150 return wd->content;
151}
152
153static Evas_Object *
154_content_unset_hook(Evas_Object *obj, const char *part __UNUSED__)
155{
156 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
157 Widget_Data *wd = elm_widget_data_get(obj);
158 Evas_Object *content;
159
160 if ((!wd) || (!wd->content)) return NULL;
161 content = wd->content;
162 elm_widget_sub_object_del(obj, wd->content);
163 edje_object_part_unswallow(wd->base, wd->content);
164 wd->content = NULL;
165 return content;
166}
167
168static void
114_sizing_eval(Evas_Object *obj) 169_sizing_eval(Evas_Object *obj)
115{ 170{
116 Widget_Data *wd = elm_widget_data_get(obj); 171 Widget_Data *wd = elm_widget_data_get(obj);
@@ -543,48 +598,19 @@ elm_conformant_add(Evas_Object *parent)
543EAPI void 598EAPI void
544elm_conformant_content_set(Evas_Object *obj, Evas_Object *content) 599elm_conformant_content_set(Evas_Object *obj, Evas_Object *content)
545{ 600{
546 ELM_CHECK_WIDTYPE(obj, widtype); 601 _content_set_hook(obj, NULL, content);
547 Widget_Data *wd = elm_widget_data_get(obj);
548
549 if (!wd) return;
550 if (wd->content == content) return;
551 if (wd->content) evas_object_del(wd->content);
552 wd->content = content;
553 if (content)
554 {
555 elm_widget_sub_object_add(obj, content);
556 evas_object_event_callback_add(content,
557 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
558 _changed_size_hints, obj);
559 edje_object_part_swallow(wd->base, "elm.swallow.content", content);
560 }
561 _sizing_eval(obj);
562} 602}
563 603
564EAPI Evas_Object * 604EAPI Evas_Object *
565elm_conformant_content_get(const Evas_Object *obj) 605elm_conformant_content_get(const Evas_Object *obj)
566{ 606{
567 ELM_CHECK_WIDTYPE(obj, widtype) NULL; 607 return _content_get_hook(obj, NULL);
568 Widget_Data *wd = elm_widget_data_get(obj);
569
570 if (!wd) return NULL;
571 return wd->content;
572} 608}
573 609
574EAPI Evas_Object * 610EAPI Evas_Object *
575elm_conformant_content_unset(Evas_Object *obj) 611elm_conformant_content_unset(Evas_Object *obj)
576{ 612{
577 ELM_CHECK_WIDTYPE(obj, widtype) NULL; 613 return _content_unset_hook(obj, NULL);
578 Widget_Data *wd = elm_widget_data_get(obj);
579 Evas_Object *content;
580
581 if (!wd) return NULL;
582 if (!wd->content) return NULL;
583 content = wd->content;
584 elm_widget_sub_object_del(obj, wd->content);
585 edje_object_part_unswallow(wd->base, wd->content);
586 wd->content = NULL;
587 return content;
588} 614}
589 615
590EAPI Evas_Object * 616EAPI Evas_Object *