summaryrefslogtreecommitdiff
path: root/legacy/elementary
diff options
context:
space:
mode:
authorDaniel Juyung Seo <seojuyung2@gmail.com>2012-03-29 11:09:40 +0000
committerDaniel Juyung Seo <seojuyung2@gmail.com>2012-03-29 11:09:40 +0000
commit4801d7f5c179a252773e983127a474afed311911 (patch)
treebd509d80bb3690a22d37fa3cb074e024d40f17d9 /legacy/elementary
parent6733c92556a10aec76a4cfe20b846c4f68d39df4 (diff)
elm elm_object: Fixed part content set hooks.
1. delete old content object 2. check whether new content object is same as old content object 3. added some doxygen description. SVN revision: 69743
Diffstat (limited to 'legacy/elementary')
-rw-r--r--legacy/elementary/src/lib/elc_ctxpopup.c4
-rw-r--r--legacy/elementary/src/lib/elc_hoversel.c1
-rw-r--r--legacy/elementary/src/lib/elc_player.c5
-rw-r--r--legacy/elementary/src/lib/elc_popup.c7
-rw-r--r--legacy/elementary/src/lib/elm_bg.c13
-rw-r--r--legacy/elementary/src/lib/elm_entry.c12
-rw-r--r--legacy/elementary/src/lib/elm_object.h4
7 files changed, 22 insertions, 24 deletions
diff --git a/legacy/elementary/src/lib/elc_ctxpopup.c b/legacy/elementary/src/lib/elc_ctxpopup.c
index 61b57c3b3a..31f57a8331 100644
--- a/legacy/elementary/src/lib/elc_ctxpopup.c
+++ b/legacy/elementary/src/lib/elc_ctxpopup.c
@@ -774,13 +774,11 @@ _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
774{ 774{
775 ELM_CHECK_WIDTYPE(obj, widtype); 775 ELM_CHECK_WIDTYPE(obj, widtype);
776 Evas_Coord min_w = -1, min_h = -1; 776 Evas_Coord min_w = -1, min_h = -1;
777
778 Widget_Data *wd; 777 Widget_Data *wd;
779
780 if ((part) && (strcmp(part, "default"))) return; 778 if ((part) && (strcmp(part, "default"))) return;
781
782 wd = elm_widget_data_get(obj); 779 wd = elm_widget_data_get(obj);
783 if ((!wd) || (!content)) return; 780 if ((!wd) || (!content)) return;
781 if (content == wd->content) return;
784 782
785 //TODO: wd->list 783 //TODO: wd->list
786 if (wd->content) evas_object_del(wd->content); 784 if (wd->content) evas_object_del(wd->content);
diff --git a/legacy/elementary/src/lib/elc_hoversel.c b/legacy/elementary/src/lib/elc_hoversel.c
index 63012dfa0d..fb07d78e1d 100644
--- a/legacy/elementary/src/lib/elc_hoversel.c
+++ b/legacy/elementary/src/lib/elc_hoversel.c
@@ -280,6 +280,7 @@ _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
280 ELM_CHECK_WIDTYPE(obj, widtype); 280 ELM_CHECK_WIDTYPE(obj, widtype);
281 Widget_Data *wd = elm_widget_data_get(obj); 281 Widget_Data *wd = elm_widget_data_get(obj);
282 if (!wd) return; 282 if (!wd) return;
283
283 elm_object_part_content_set(wd->btn, part, content); 284 elm_object_part_content_set(wd->btn, part, content);
284} 285}
285 286
diff --git a/legacy/elementary/src/lib/elc_player.c b/legacy/elementary/src/lib/elc_player.c
index a6ef91ca9f..aef28ce83c 100644
--- a/legacy/elementary/src/lib/elc_player.c
+++ b/legacy/elementary/src/lib/elc_player.c
@@ -464,12 +464,14 @@ _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
464 if (part && strcmp(part, "video")) return; 464 if (part && strcmp(part, "video")) return;
465 ELM_CHECK_WIDTYPE(obj, widtype); 465 ELM_CHECK_WIDTYPE(obj, widtype);
466 Widget_Data *wd = elm_widget_data_get(obj); 466 Widget_Data *wd = elm_widget_data_get(obj);
467 467 if (!wd) return;
468 double pos, length; 468 double pos, length;
469 Eina_Bool seekable; 469 Eina_Bool seekable;
470 470
471 if (!_elm_video_check(content)) return; 471 if (!_elm_video_check(content)) return;
472 if (wd->video == content) return;
472 473
474 if (wd->video) evas_object_del(wd->video);
473 _cleanup_callback(wd); 475 _cleanup_callback(wd);
474 476
475 wd->video = content; 477 wd->video = content;
@@ -542,6 +544,7 @@ elm_player_add(Evas_Object *parent)
542 elm_widget_can_focus_set(obj, EINA_TRUE); 544 elm_widget_can_focus_set(obj, EINA_TRUE);
543 elm_widget_event_hook_set(obj, _event_hook); 545 elm_widget_event_hook_set(obj, _event_hook);
544 elm_widget_content_set_hook_set(obj, _content_set_hook); 546 elm_widget_content_set_hook_set(obj, _content_set_hook);
547 /* TODO: add content_unset and content_get hook */
545 548
546 wd->layout = edje_object_add(e); 549 wd->layout = edje_object_add(e);
547 _elm_theme_object_set(obj, wd->layout, "player", "base", "default"); 550 _elm_theme_object_set(obj, wd->layout, "player", "base", "default");
diff --git a/legacy/elementary/src/lib/elc_popup.c b/legacy/elementary/src/lib/elc_popup.c
index d1e21cccd7..43d51d2a79 100644
--- a/legacy/elementary/src/lib/elc_popup.c
+++ b/legacy/elementary/src/lib/elc_popup.c
@@ -699,11 +699,8 @@ _title_icon_set(Evas_Object *obj, Evas_Object *icon)
699 if (!wd) return; 699 if (!wd) return;
700 if (wd->title_icon == icon) return; 700 if (wd->title_icon == icon) return;
701 title_visibility_old = (wd->title_text) || (wd->title_icon); 701 title_visibility_old = (wd->title_text) || (wd->title_icon);
702 if (wd->title_icon) 702 if (wd->title_icon) evas_object_del(wd->title_icon);
703 { 703
704 evas_object_del(wd->title_icon);
705 wd->title_icon = NULL;
706 }
707 wd->title_icon = icon; 704 wd->title_icon = icon;
708 title_visibility_current = (wd->title_text) || (wd->title_icon); 705 title_visibility_current = (wd->title_text) || (wd->title_icon);
709 elm_object_part_content_set(wd->base, "elm.swallow.title.icon", 706 elm_object_part_content_set(wd->base, "elm.swallow.title.icon",
diff --git a/legacy/elementary/src/lib/elm_bg.c b/legacy/elementary/src/lib/elm_bg.c
index 79400c2280..df29d5b247 100644
--- a/legacy/elementary/src/lib/elm_bg.c
+++ b/legacy/elementary/src/lib/elm_bg.c
@@ -122,19 +122,16 @@ _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
122{ 122{
123 ELM_CHECK_WIDTYPE(obj, widtype); 123 ELM_CHECK_WIDTYPE(obj, widtype);
124 Widget_Data *wd; 124 Widget_Data *wd;
125
126 if (part && strcmp(part, "overlay")) return; 125 if (part && strcmp(part, "overlay")) return;
127
128 wd = elm_widget_data_get(obj); 126 wd = elm_widget_data_get(obj);
129 if (!wd) return; 127 if (!wd) return;
130 if (wd->overlay) 128
131 { 129 if (content == wd->overlay) return;
132 evas_object_del(wd->overlay); 130 if (wd->overlay) evas_object_del(wd->overlay);
133 wd->overlay = NULL; 131
134 } 132 wd->overlay = content;
135 if (content) 133 if (content)
136 { 134 {
137 wd->overlay = content;
138 edje_object_part_swallow(wd->base, "elm.swallow.content", content); 135 edje_object_part_swallow(wd->base, "elm.swallow.content", content);
139 elm_widget_sub_object_add(obj, content); 136 elm_widget_sub_object_add(obj, content);
140 } 137 }
diff --git a/legacy/elementary/src/lib/elm_entry.c b/legacy/elementary/src/lib/elm_entry.c
index ebbef488df..8df66bafc7 100644
--- a/legacy/elementary/src/lib/elm_entry.c
+++ b/legacy/elementary/src/lib/elm_entry.c
@@ -855,6 +855,7 @@ _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
855{ 855{
856 Widget_Data *wd = elm_widget_data_get(obj); 856 Widget_Data *wd = elm_widget_data_get(obj);
857 Evas_Object *edje; 857 Evas_Object *edje;
858 Evas_Object *prev_content;
858 if ((!wd) || (!content)) return; 859 if ((!wd) || (!content)) return;
859 860
860 if (wd->scroll) 861 if (wd->scroll)
@@ -862,23 +863,20 @@ _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
862 else 863 else
863 edje = wd->ent; 864 edje = wd->ent;
864 865
865 /* Delete the currently swallowed object */
866 Evas_Object *cswallow;
867
868 if (!part || !strcmp(part, "icon")) 866 if (!part || !strcmp(part, "icon"))
869 { 867 {
870 cswallow = edje_object_part_swallow_get(edje, "elm.swallow.icon"); 868 prev_content = edje_object_part_swallow_get(edje, "elm.swallow.icon");
871 edje_object_signal_emit(edje, "elm,action,show,icon", "elm"); 869 edje_object_signal_emit(edje, "elm,action,show,icon", "elm");
872 } 870 }
873 else if (!strcmp(part, "end")) 871 else if (!strcmp(part, "end"))
874 { 872 {
875 cswallow = edje_object_part_swallow_get(edje, "elm.swallow.end"); 873 prev_content = edje_object_part_swallow_get(edje, "elm.swallow.end");
876 edje_object_signal_emit(edje, "elm,action,show,end", "elm"); 874 edje_object_signal_emit(edje, "elm,action,show,end", "elm");
877 } 875 }
878 else 876 else
879 cswallow = edje_object_part_swallow_get(edje, part); 877 prev_content = edje_object_part_swallow_get(edje, part);
880 878
881 if (cswallow) evas_object_del(cswallow); 879 if (prev_content) evas_object_del(prev_content);
882 880
883 evas_event_freeze(evas_object_evas_get(obj)); 881 evas_event_freeze(evas_object_evas_get(obj));
884 elm_widget_sub_object_add(obj, content); 882 elm_widget_sub_object_add(obj, content);
diff --git a/legacy/elementary/src/lib/elm_object.h b/legacy/elementary/src/lib/elm_object.h
index 033c243722..68a863ddce 100644
--- a/legacy/elementary/src/lib/elm_object.h
+++ b/legacy/elementary/src/lib/elm_object.h
@@ -35,6 +35,10 @@ EAPI const char *elm_object_part_text_get(const Evas_Object *ob
35 * @param part The content part name to set (NULL for the default content) 35 * @param part The content part name to set (NULL for the default content)
36 * @param content The new content of the object 36 * @param content The new content of the object
37 * 37 *
38 * This sets a new object to a widget as a content object. If any object was
39 * already set as a content object in the same part, previous object will be
40 * deleted automatically.
41 *
38 * @note Elementary objects may have many contents 42 * @note Elementary objects may have many contents
39 * 43 *
40 * @ingroup General 44 * @ingroup General