summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorChunEon Park <hermet@hermet.pe.kr>2011-10-28 08:31:42 +0000
committerChunEon Park <hermet@hermet.pe.kr>2011-10-28 08:31:42 +0000
commit31678440d9772c6dee35f8ba6c0cea2fd47f8b12 (patch)
treee003fc6e3c9e0a9410f4af8b755f7b5094c177b3 /legacy
parent6a2e36c5f052101c6e786401c8c3c9898f8aa9ba (diff)
elementary/bg - content_set/get/unset, fixed indentation
SVN revision: 64484
Diffstat (limited to 'legacy')
-rw-r--r--legacy/elementary/doc/examples.dox6
-rw-r--r--legacy/elementary/src/bin/test_bg.c4
-rw-r--r--legacy/elementary/src/examples/bg_example_03.c4
-rw-r--r--legacy/elementary/src/lib/Elementary.h.in32
-rw-r--r--legacy/elementary/src/lib/elc_naviframe.c94
-rw-r--r--legacy/elementary/src/lib/elm_bg.c87
6 files changed, 126 insertions, 101 deletions
diff --git a/legacy/elementary/doc/examples.dox b/legacy/elementary/doc/examples.dox
index eff169815d..705efd4acf 100644
--- a/legacy/elementary/doc/examples.dox
+++ b/legacy/elementary/doc/examples.dox
@@ -235,7 +235,7 @@
235 * @until } 235 * @until }
236 * 236 *
237 * The next callback will be used when setting the overlay (using 237 * The next callback will be used when setting the overlay (using
238 * elm_bg_overlay_set()): 238 * elm_object_content_set()):
239 * 239 *
240 * @skip _cb_overlay_changed 240 * @skip _cb_overlay_changed
241 * @until } 241 * @until }
@@ -318,14 +318,14 @@
318 * 318 *
319 * @skipline elm_radio_value_set 319 * @skipline elm_radio_value_set
320 * 320 *
321 * Then we add a checkbox for the elm_bg_overlay_set() function: 321 * Then we add a checkbox for the elm_object_content_set() function for the bg:
322 * 322 *
323 * @skip check_add 323 * @skip check_add
324 * @until evas_object_show 324 * @until evas_object_show
325 * 325 *
326 * Now look at the code of the @c _cb_overlay_changed again. If the checkbox 326 * Now look at the code of the @c _cb_overlay_changed again. If the checkbox
327 * state is checked, an overlay will be added to the background. It's done by 327 * state is checked, an overlay will be added to the background. It's done by
328 * creating an Edje object, and setting it with elm_bg_overlay_set() to the 328 * creating an Edje object, and setting it with elm_object_content_set() to the
329 * background object. For information about what are and how to set Edje 329 * background object. For information about what are and how to set Edje
330 * object, look at the Edje documentation. 330 * object, look at the Edje documentation.
331 * 331 *
diff --git a/legacy/elementary/src/bin/test_bg.c b/legacy/elementary/src/bin/test_bg.c
index af9d47c263..cc4dd3da53 100644
--- a/legacy/elementary/src/bin/test_bg.c
+++ b/legacy/elementary/src/bin/test_bg.c
@@ -26,10 +26,10 @@ _cb_overlay_changed(void *data, Evas_Object *obj, void *event __UNUSED__)
26 parent = elm_object_parent_widget_get(o_bg); 26 parent = elm_object_parent_widget_get(o_bg);
27 over = edje_object_add(evas_object_evas_get(parent)); 27 over = edje_object_add(evas_object_evas_get(parent));
28 edje_object_file_set(over, buff, "bg_overlay"); 28 edje_object_file_set(over, buff, "bg_overlay");
29 elm_bg_overlay_set(o_bg, over); 29 elm_object_content_set(o_bg, over);
30 } 30 }
31 else 31 else
32 elm_bg_overlay_set(o_bg, NULL); 32 elm_object_content_set(o_bg, NULL);
33} 33}
34 34
35static void 35static void
diff --git a/legacy/elementary/src/examples/bg_example_03.c b/legacy/elementary/src/examples/bg_example_03.c
index ae42c588ea..b78139bfb5 100644
--- a/legacy/elementary/src/examples/bg_example_03.c
+++ b/legacy/elementary/src/examples/bg_example_03.c
@@ -38,10 +38,10 @@ _cb_overlay_changed(void *data, Evas_Object *obj, void *event __UNUSED__)
38 parent = elm_object_parent_widget_get(o_bg); 38 parent = elm_object_parent_widget_get(o_bg);
39 over = edje_object_add(evas_object_evas_get(parent)); 39 over = edje_object_add(evas_object_evas_get(parent));
40 edje_object_file_set(over, buff, "bg_overlay"); 40 edje_object_file_set(over, buff, "bg_overlay");
41 elm_bg_overlay_set(o_bg, over); 41 elm_object_content_set(o_bg, over);
42 } 42 }
43 else 43 else
44 elm_bg_overlay_set(o_bg, NULL); 44 elm_object_content_set(o_bg, NULL);
45} 45}
46 46
47static void 47static void
diff --git a/legacy/elementary/src/lib/Elementary.h.in b/legacy/elementary/src/lib/Elementary.h.in
index 53a5f3c7e3..dd018b7ec9 100644
--- a/legacy/elementary/src/lib/Elementary.h.in
+++ b/legacy/elementary/src/lib/Elementary.h.in
@@ -4514,6 +4514,10 @@ extern "C" {
4514 * packing into any container object. It works just like an image, but has 4514 * packing into any container object. It works just like an image, but has
4515 * some properties useful to a background, like setting it to tiled, 4515 * some properties useful to a background, like setting it to tiled,
4516 * centered, scaled or stretched. 4516 * centered, scaled or stretched.
4517 *
4518 * Default contents parts of the bg widget that you can use for are:
4519 *
4520 * @li "elm.swallow.content" - overlay of the bg
4517 * 4521 *
4518 * Here is some sample code using it: 4522 * Here is some sample code using it:
4519 * @li @ref bg_01_example_page 4523 * @li @ref bg_01_example_page
@@ -4631,7 +4635,7 @@ extern "C" {
4631 * @ingroup Bg 4635 * @ingroup Bg
4632 */ 4636 */
4633 4637
4634 EAPI void elm_bg_overlay_set(Evas_Object *obj, Evas_Object *overlay) EINA_ARG_NONNULL(1); 4638 EINA_DEPRECATED EAPI void elm_bg_overlay_set(Evas_Object *obj, Evas_Object *overlay) EINA_ARG_NONNULL(1);
4635 4639
4636 /** 4640 /**
4637 * Get the overlay object used for the background object. 4641 * Get the overlay object used for the background object.
@@ -4643,7 +4647,7 @@ extern "C" {
4643 * 4647 *
4644 * @ingroup Bg 4648 * @ingroup Bg
4645 */ 4649 */
4646 EAPI Evas_Object *elm_bg_overlay_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); 4650 EINA_DEPRECATED EAPI Evas_Object *elm_bg_overlay_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
4647 4651
4648 /** 4652 /**
4649 * Get the overlay object used for the background object. 4653 * Get the overlay object used for the background object.
@@ -4655,7 +4659,7 @@ extern "C" {
4655 * 4659 *
4656 * @ingroup Bg 4660 * @ingroup Bg
4657 */ 4661 */
4658 EAPI Evas_Object *elm_bg_overlay_unset(Evas_Object *obj) EINA_ARG_NONNULL(1); 4662 EINA_DEPRECATED EAPI Evas_Object *elm_bg_overlay_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
4659 4663
4660 /** 4664 /**
4661 * Set the size of the pixmap representation of the image. 4665 * Set the size of the pixmap representation of the image.
@@ -6162,13 +6166,13 @@ extern "C" {
6162 * 6166 *
6163 * Default contents parts of the button widget that you can use for are: 6167 * Default contents parts of the button widget that you can use for are:
6164 * 6168 *
6165 * @li "elm.swallow.content" - The icon of the button 6169 * @li "elm.swallow.content" - A icon of the button
6166 * 6170 *
6167 * 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:
6168 * 6172 *
6169 * @li "elm.text" - The title label of the button 6173 * @li "elm.text" - Title label of the button
6170 * 6174 *
6171 * Follow through a complete example @ref button_example_01 "here". 6175 * Follow through a complete example @ref button_example_01 "here".
6172 * @{ 6176 * @{
6173 */ 6177 */
6174 /** 6178 /**
@@ -9735,10 +9739,10 @@ extern "C" {
9735 * Only one object can be added to the @c SWALLOW part (but you still can 9739 * Only one object can be added to the @c SWALLOW part (but you still can
9736 * have many @c SWALLOW parts and one object on each of them). Use the @c 9740 * have many @c SWALLOW parts and one object on each of them). Use the @c
9737 * elm_object_content_set/get/unset functions to set, retrieve and unset 9741 * elm_object_content_set/get/unset functions to set, retrieve and unset
9738 * objects as content of the @c SWALLOW. After being set to this part, the 9742 * objects as content of the @c SWALLOW. After being set to this part, the
9739 * object size, position, visibility, clipping and other description 9743 * object size, position, visibility, clipping and other description
9740 * properties will be totally controled by the description of the given part 9744 * properties will be totally controled by the description of the given part
9741 * (inside the Edje theme file). 9745 * (inside the Edje theme file).
9742 * 9746 *
9743 * One can use @c evas_object_size_hint_* functions on the child to have some 9747 * One can use @c evas_object_size_hint_* functions on the child to have some
9744 * kind of control over its behavior, but the resulting behavior will still 9748 * kind of control over its behavior, but the resulting behavior will still
@@ -28145,13 +28149,13 @@ extern "C" {
28145 * 28149 *
28146 * Default contents parts of the naviframe items that you can use for are: 28150 * Default contents parts of the naviframe items that you can use for are:
28147 * 28151 *
28148 * @li "elm.swallow.content" - The main content of the page 28152 * @li "elm.swallow.content" - A main content of the page
28149 * @li "elm.swallow.prev_btn" - The button to go to the previous page 28153 * @li "elm.swallow.prev_btn" - A button to go to the previous page
28150 * @li "elm.swallow.next_btn" - The button to go to the next page 28154 * @li "elm.swallow.next_btn" - A button to go to the next page
28151 * 28155 *
28152 * Default text parts of the naviframe items that you can use for are: 28156 * Default text parts of the naviframe items that you can use for are:
28153 * 28157 *
28154 * @li "elm.text.title" - The title label in the title area 28158 * @li "elm.text.title" - Title label in the title area
28155 * 28159 *
28156 * @ref tutorial_naviframe gives a good overview of the usage of the API. 28160 * @ref tutorial_naviframe gives a good overview of the usage of the API.
28157 */ 28161 */
diff --git a/legacy/elementary/src/lib/elc_naviframe.c b/legacy/elementary/src/lib/elc_naviframe.c
index cc32046021..daef696bd5 100644
--- a/legacy/elementary/src/lib/elc_naviframe.c
+++ b/legacy/elementary/src/lib/elc_naviframe.c
@@ -10,7 +10,6 @@ struct _Widget_Data
10{ 10{
11 Eina_Inlist *stack; 11 Eina_Inlist *stack;
12 Evas_Object *base; 12 Evas_Object *base;
13 Evas_Object *rect;
14 Eina_Bool preserve: 1; 13 Eina_Bool preserve: 1;
15 Eina_Bool auto_pushed: 1; 14 Eina_Bool auto_pushed: 1;
16 Eina_Bool freeze_events: 1; 15 Eina_Bool freeze_events: 1;
@@ -88,7 +87,6 @@ static void _resize(void *data,
88 Evas *e, 87 Evas *e,
89 Evas_Object *obj, 88 Evas_Object *obj,
90 void *event_info); 89 void *event_info);
91static void _hide(void *data, Evas *e, Evas_Object *obj, void *event_info);
92static void _title_clicked(void *data, Evas_Object *obj, 90static void _title_clicked(void *data, Evas_Object *obj,
93 const char *emission, 91 const char *emission,
94 const char *source); 92 const char *source);
@@ -184,8 +182,6 @@ _theme_hook(Evas_Object *obj)
184 182
185 _elm_widget_mirrored_reload(obj); 183 _elm_widget_mirrored_reload(obj);
186 _mirrored_set(obj, elm_widget_mirrored_get(obj)); 184 _mirrored_set(obj, elm_widget_mirrored_get(obj));
187
188 evas_object_hide(wd->rect);
189} 185}
190 186
191static void _emit_hook(Evas_Object *obj, 187static void _emit_hook(Evas_Object *obj,
@@ -447,13 +443,6 @@ _move(void *data __UNUSED__,
447 Evas_Object *obj, 443 Evas_Object *obj,
448 void *event_info __UNUSED__) 444 void *event_info __UNUSED__)
449{ 445{
450 Evas_Coord x, y;
451 Widget_Data *wd = elm_widget_data_get(obj);
452 if (!wd) return;
453
454 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
455 evas_object_move(wd->rect, x, y);
456
457 _sizing_eval(obj); 446 _sizing_eval(obj);
458} 447}
459 448
@@ -463,29 +452,10 @@ _resize(void *data __UNUSED__,
463 Evas_Object *obj, 452 Evas_Object *obj,
464 void *event_info __UNUSED__) 453 void *event_info __UNUSED__)
465{ 454{
466 Evas_Coord w, h;
467 Widget_Data *wd = elm_widget_data_get(obj);
468 if (!wd) return;
469
470 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
471 evas_object_resize(wd->rect, w, h);
472
473 _sizing_eval(obj); 455 _sizing_eval(obj);
474} 456}
475 457
476static void 458static void
477_hide(void *data __UNUSED__,
478 Evas *e __UNUSED__,
479 Evas_Object *obj,
480 void *event_info __UNUSED__)
481{
482 Widget_Data *wd = elm_widget_data_get(obj);
483 if (!wd) return;
484 if (wd->freeze_events)
485 evas_object_hide(wd->rect);
486}
487
488static void
489_title_clicked(void *data, 459_title_clicked(void *data,
490 Evas_Object *obj __UNUSED__, 460 Evas_Object *obj __UNUSED__,
491 const char *emission __UNUSED__, 461 const char *emission __UNUSED__,
@@ -740,12 +710,19 @@ _pushed_finished(void *data,
740 const char *emission __UNUSED__, 710 const char *emission __UNUSED__,
741 const char *source __UNUSED__) 711 const char *source __UNUSED__)
742{ 712{
713 Widget_Data *wd;
743 Elm_Naviframe_Item *it = data; 714 Elm_Naviframe_Item *it = data;
744 if (!it) return; 715 if (!it) return;
716
717 wd = elm_widget_data_get(WIDGET(it));
718 if (!wd) return;
719
745 evas_object_hide(VIEW(it)); 720 evas_object_hide(VIEW(it));
746 evas_object_smart_callback_call(WIDGET(it), 721 evas_object_smart_callback_call(WIDGET(it),
747 SIG_PUSH_FINISHED, 722 SIG_PUSH_FINISHED,
748 data); 723 data);
724 if (wd->freeze_events)
725 evas_object_freeze_events_set(VIEW(it), EINA_FALSE);
749} 726}
750 727
751static void 728static void
@@ -780,7 +757,7 @@ _show_finished(void *data,
780 SIG_TRANSITION_FINISHED, 757 SIG_TRANSITION_FINISHED,
781 data); 758 data);
782 if (wd->freeze_events) 759 if (wd->freeze_events)
783 evas_object_hide(wd->rect); 760 evas_object_freeze_events_set(VIEW(it), EINA_FALSE);
784} 761}
785 762
786static void 763static void
@@ -883,8 +860,10 @@ _item_style_set(Elm_Naviframe_Item *navi_it, const char *item_style)
883 _item_sizing_eval(navi_it); 860 _item_sizing_eval(navi_it);
884 861
885 wd = elm_widget_data_get(WIDGET(navi_it)); 862 wd = elm_widget_data_get(WIDGET(navi_it));
886 if (wd && wd->freeze_events) 863 if (!wd) return;
887 evas_object_hide(wd->rect); 864
865 if (wd->freeze_events)
866 evas_object_freeze_events_set(VIEW(navi_it), EINA_FALSE);
888} 867}
889 868
890EAPI Evas_Object * 869EAPI Evas_Object *
@@ -910,14 +889,8 @@ elm_naviframe_add(Evas_Object *parent)
910 elm_widget_resize_object_set(obj, wd->base); 889 elm_widget_resize_object_set(obj, wd->base);
911 _elm_theme_object_set(obj, wd->base, "naviframe", "base", "default"); 890 _elm_theme_object_set(obj, wd->base, "naviframe", "base", "default");
912 891
913 //rect
914 wd->rect = evas_object_rectangle_add(e);
915 evas_object_color_set(wd->rect, 0, 0, 0, 0);
916 elm_widget_sub_object_add(obj, wd->rect);
917
918 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _move, obj); 892 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _move, obj);
919 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj); 893 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj);
920 evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _hide, obj);
921 evas_object_smart_callbacks_descriptions_set(obj, _signals); 894 evas_object_smart_callbacks_descriptions_set(obj, _signals);
922 895
923 wd->auto_pushed = EINA_TRUE; 896 wd->auto_pushed = EINA_TRUE;
@@ -1002,7 +975,10 @@ elm_naviframe_item_push(Evas_Object *obj,
1002 if (prev_it) 975 if (prev_it)
1003 { 976 {
1004 if (wd->freeze_events) 977 if (wd->freeze_events)
1005 evas_object_show(wd->rect); 978 {
979 evas_object_freeze_events_set(VIEW(it), EINA_TRUE);
980 evas_object_freeze_events_set(VIEW(prev_it), EINA_TRUE);
981 }
1006 edje_object_signal_emit(VIEW(prev_it), 982 edje_object_signal_emit(VIEW(prev_it),
1007 "elm,state,cur,pushed", 983 "elm,state,cur,pushed",
1008 "elm"); 984 "elm");
@@ -1039,7 +1015,10 @@ elm_naviframe_item_pop(Evas_Object *obj)
1039 if (prev_it) 1015 if (prev_it)
1040 { 1016 {
1041 if (wd->freeze_events) 1017 if (wd->freeze_events)
1042 evas_object_show(wd->rect); 1018 {
1019 evas_object_freeze_events_set(VIEW(it), EINA_TRUE);
1020 evas_object_freeze_events_set(VIEW(prev_it), EINA_TRUE);
1021 }
1043 edje_object_signal_emit(it->base.view, "elm,state,cur,popped", "elm"); 1022 edje_object_signal_emit(it->base.view, "elm,state,cur,popped", "elm");
1044 evas_object_show(VIEW(prev_it)); 1023 evas_object_show(VIEW(prev_it));
1045 evas_object_raise(VIEW(prev_it)); 1024 evas_object_raise(VIEW(prev_it));
@@ -1057,10 +1036,14 @@ EAPI void
1057elm_naviframe_item_pop_to(Elm_Object_Item *it) 1036elm_naviframe_item_pop_to(Elm_Object_Item *it)
1058{ 1037{
1059 ELM_OBJ_ITEM_CHECK_OR_RETURN(it); 1038 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
1060 Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *) it; 1039 Elm_Naviframe_Item *navi_it;
1061 Widget_Data *wd = elm_widget_data_get(WIDGET(navi_it)); 1040 Widget_Data *wd;
1062 Eina_Inlist *l, *prev_l; 1041 Eina_Inlist *l, *prev_l;
1063 1042
1043 navi_it = (Elm_Naviframe_Item *) it;
1044 wd = elm_widget_data_get(WIDGET(navi_it));
1045 if (!wd) return;
1046
1064 if (it == elm_naviframe_top_item_get(WIDGET(navi_it))) return; 1047 if (it == elm_naviframe_top_item_get(WIDGET(navi_it))) return;
1065 1048
1066 l = wd->stack->last->prev; 1049 l = wd->stack->last->prev;
@@ -1081,15 +1064,23 @@ EAPI void
1081elm_naviframe_item_promote(Elm_Object_Item *it) 1064elm_naviframe_item_promote(Elm_Object_Item *it)
1082{ 1065{
1083 ELM_OBJ_ITEM_CHECK_OR_RETURN(it); 1066 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
1084 Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *) it; 1067 Elm_Naviframe_Item *navi_it;
1085 Elm_Naviframe_Item *prev_it = NULL; 1068 Elm_Naviframe_Item *prev_it;
1086 Widget_Data *wd = elm_widget_data_get(navi_it->base.widget); 1069 Widget_Data *wd;
1070
1071 navi_it = (Elm_Naviframe_Item *) it;
1072 wd = elm_widget_data_get(navi_it->base.widget);
1073 if (!wd) return;
1074
1087 if (it == elm_naviframe_top_item_get(navi_it->base.widget)) return; 1075 if (it == elm_naviframe_top_item_get(navi_it->base.widget)) return;
1088 wd->stack = eina_inlist_demote(wd->stack, EINA_INLIST_GET(navi_it)); 1076 wd->stack = eina_inlist_demote(wd->stack, EINA_INLIST_GET(navi_it));
1089 prev_it = EINA_INLIST_CONTAINER_GET(wd->stack->last->prev, 1077 prev_it = EINA_INLIST_CONTAINER_GET(wd->stack->last->prev,
1090 Elm_Naviframe_Item); 1078 Elm_Naviframe_Item);
1091 if (wd->freeze_events) 1079 if (wd->freeze_events)
1092 evas_object_show(wd->rect); 1080 {
1081 evas_object_freeze_events_set(VIEW(it), EINA_TRUE);
1082 evas_object_freeze_events_set(VIEW(prev_it), EINA_TRUE);
1083 }
1093 edje_object_signal_emit(prev_it->base.view, 1084 edje_object_signal_emit(prev_it->base.view,
1094 "elm,state,cur,pushed", 1085 "elm,state,cur,pushed",
1095 "elm"); 1086 "elm");
@@ -1105,8 +1096,13 @@ EAPI void
1105elm_naviframe_item_del(Elm_Object_Item *it) 1096elm_naviframe_item_del(Elm_Object_Item *it)
1106{ 1097{
1107 ELM_OBJ_ITEM_CHECK_OR_RETURN(it); 1098 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
1108 Elm_Naviframe_Item *navi_it =(Elm_Naviframe_Item *) it; 1099 Elm_Naviframe_Item *navi_it;
1109 Widget_Data *wd = elm_widget_data_get(WIDGET(navi_it)); 1100 Widget_Data *wd;
1101
1102 navi_it =(Elm_Naviframe_Item *) it;
1103 wd = elm_widget_data_get(WIDGET(navi_it));
1104 if (!wd) return;
1105
1110 if (it == elm_naviframe_top_item_get(WIDGET(navi_it))) 1106 if (it == elm_naviframe_top_item_get(WIDGET(navi_it)))
1111 { 1107 {
1112 wd->stack = eina_inlist_remove(wd->stack, EINA_INLIST_GET(navi_it)); 1108 wd->stack = eina_inlist_remove(wd->stack, EINA_INLIST_GET(navi_it));
diff --git a/legacy/elementary/src/lib/elm_bg.c b/legacy/elementary/src/lib/elm_bg.c
index 21a4a7bcd6..5261cd0da3 100644
--- a/legacy/elementary/src/lib/elm_bg.c
+++ b/legacy/elementary/src/lib/elm_bg.c
@@ -18,6 +18,9 @@ static const char *widtype = NULL;
18static void _del_hook(Evas_Object *obj); 18static void _del_hook(Evas_Object *obj);
19static void _theme_hook(Evas_Object *obj); 19static void _theme_hook(Evas_Object *obj);
20static void _custom_resize(void *data, Evas *a, Evas_Object *obj, void *event_info); 20static void _custom_resize(void *data, Evas *a, Evas_Object *obj, void *event_info);
21static void _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content);
22static Evas_Object *_content_get_hook(const Evas_Object *obj, const char *part);
23static Evas_Object *_content_unset_hook(Evas_Object *obj, const char *part);
21 24
22static void 25static void
23_del_hook(Evas_Object *obj) 26_del_hook(Evas_Object *obj)
@@ -113,6 +116,52 @@ _custom_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void
113 evas_object_size_hint_max_set(wd->img, mw, mh); 116 evas_object_size_hint_max_set(wd->img, mw, mh);
114} 117}
115 118
119static void
120_content_set_hook(Evas_Object *obj, const char *part __UNUSED__, Evas_Object *content)
121{
122 ELM_CHECK_WIDTYPE(obj, widtype);
123 Widget_Data *wd = elm_widget_data_get(obj);
124 if (!wd) return;
125 if (wd->overlay)
126 {
127 evas_object_del(wd->overlay);
128 wd->overlay = NULL;
129 }
130 if (content)
131 {
132 wd->overlay = content;
133 edje_object_part_swallow(wd->base, "elm.swallow.content", content);
134 elm_widget_sub_object_add(obj, content);
135 }
136
137 _custom_resize(wd, NULL, NULL, NULL);
138}
139
140static Evas_Object *
141_content_get_hook(const Evas_Object *obj, const char *part __UNUSED__)
142{
143 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
144 Widget_Data *wd = elm_widget_data_get(obj);
145 if (!wd) return NULL;
146 return wd->overlay;
147}
148
149static Evas_Object *
150_content_unset_hook(Evas_Object *obj, const char *part __UNUSED__)
151{
152 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
153 Widget_Data *wd = elm_widget_data_get(obj);
154 Evas_Object *overlay;
155 if (!wd) return NULL;
156 if (!wd->overlay) return NULL;
157 overlay = wd->overlay;
158 elm_widget_sub_object_del(obj, wd->overlay);
159 edje_object_part_unswallow(wd->base, wd->overlay);
160 wd->overlay = NULL;
161 _custom_resize(wd, NULL, NULL, NULL);
162 return overlay;
163}
164
116EAPI Evas_Object * 165EAPI Evas_Object *
117elm_bg_add(Evas_Object *parent) 166elm_bg_add(Evas_Object *parent)
118{ 167{
@@ -128,6 +177,10 @@ elm_bg_add(Evas_Object *parent)
128 elm_widget_data_set(obj, wd); 177 elm_widget_data_set(obj, wd);
129 elm_widget_del_hook_set(obj, _del_hook); 178 elm_widget_del_hook_set(obj, _del_hook);
130 elm_widget_theme_hook_set(obj, _theme_hook); 179 elm_widget_theme_hook_set(obj, _theme_hook);
180 elm_widget_content_set_hook_set(obj, _content_set_hook);
181 elm_widget_content_get_hook_set(obj, _content_get_hook);
182 elm_widget_content_unset_hook_set(obj, _content_unset_hook);
183
131 elm_widget_can_focus_set(obj, EINA_FALSE); 184 elm_widget_can_focus_set(obj, EINA_FALSE);
132 185
133 wd->base = edje_object_add(e); 186 wd->base = edje_object_add(e);
@@ -241,47 +294,19 @@ elm_bg_color_get(const Evas_Object *obj, int *r, int *g, int *b)
241EAPI void 294EAPI void
242elm_bg_overlay_set(Evas_Object *obj, Evas_Object *overlay) 295elm_bg_overlay_set(Evas_Object *obj, Evas_Object *overlay)
243{ 296{
244 ELM_CHECK_WIDTYPE(obj, widtype); 297 _content_set_hook(obj, NULL, overlay);
245 Widget_Data *wd = elm_widget_data_get(obj);
246 if (!wd) return;
247 if (wd->overlay)
248 {
249 evas_object_del(wd->overlay);
250 wd->overlay = NULL;
251 }
252 if (overlay)
253 {
254 wd->overlay = overlay;
255 edje_object_part_swallow(wd->base, "elm.swallow.content", wd->overlay);
256 elm_widget_sub_object_add(obj, wd->overlay);
257 }
258
259 _custom_resize(wd, NULL, NULL, NULL);
260} 298}
261 299
262EAPI Evas_Object * 300EAPI Evas_Object *
263elm_bg_overlay_get(const Evas_Object *obj) 301elm_bg_overlay_get(const Evas_Object *obj)
264{ 302{
265 ELM_CHECK_WIDTYPE(obj, widtype) NULL; 303 return _content_get_hook(obj, NULL);
266 Widget_Data *wd = elm_widget_data_get(obj);
267 if (!wd) return NULL;
268 return wd->overlay;
269} 304}
270 305
271EAPI Evas_Object * 306EAPI Evas_Object *
272elm_bg_overlay_unset(Evas_Object *obj) 307elm_bg_overlay_unset(Evas_Object *obj)
273{ 308{
274 ELM_CHECK_WIDTYPE(obj, widtype) NULL; 309 return _content_unset_hook(obj, NULL);
275 Widget_Data *wd = elm_widget_data_get(obj);
276 Evas_Object *overlay;
277 if (!wd) return NULL;
278 if (!wd->overlay) return NULL;
279 overlay = wd->overlay;
280 elm_widget_sub_object_del(obj, wd->overlay);
281 edje_object_part_unswallow(wd->base, wd->overlay);
282 wd->overlay = NULL;
283 _custom_resize(wd, NULL, NULL, NULL);
284 return overlay;
285} 310}
286 311
287EAPI void 312EAPI void