elementary/bubble - applied missed content_set/get/unset APIs
authorhermet <hermet@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 8 Nov 2011 01:05:01 +0000 (01:05 +0000)
committerhermet <hermet@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 8 Nov 2011 01:05:01 +0000 (01:05 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@64925 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

doc/widgets/widget_preview_bubble2.c
doc/widgets/widget_preview_bubble3.c
src/bin/test_anchorblock.c
src/bin/test_bubble.c
src/bin/test_flip.c
src/bin/test_win_inline.c
src/edje_externals/elm_bubble.c
src/examples/bubble_example_01.c
src/lib/Elementary.h.in
src/lib/elm_bubble.c

index 03748d9..c2bf0ea 100644 (file)
@@ -9,7 +9,7 @@ elm_object_text_set(o, "Bubble");
 
 Evas_Object *o2 = elm_icon_add(win);
 elm_icon_standard_set(o2, "home");
-elm_bubble_icon_set(o, o2);
+elm_object_content_part_set(o, ELM_BUBBLE_CONTENT_ICON, o2);
 evas_object_show(o2);
 
 #include "widget_preview_tmpl_foot.c"
index 9b390f3..bcd9a0c 100644 (file)
@@ -7,7 +7,7 @@ evas_object_show(o);
 
 Evas_Object *o2 = elm_icon_add(win);
 elm_icon_standard_set(o2, "home");
-elm_bubble_icon_set(o, o2);
+elm_object_content_part_set(o, ELM_BUBBLE_CONTENT_ICON, o2);
 evas_object_show(o2);
 
 #include "widget_preview_tmpl_foot.c"
index 5212184..10c2447 100644 (file)
@@ -149,7 +149,7 @@ test_anchorblock(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event
    bb = elm_bubble_add(win);
    elm_object_text_set(bb, "Message 3");
    elm_object_text_part_set(bb, "info", "10:32 4/11/2008");
-   elm_bubble_icon_set(bb, ic);
+   elm_object_content_part_set(bb, ELM_BUBBLE_CONTENT_ICON, ic);
    evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL);
    evas_object_show(ic);
    evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
@@ -176,7 +176,7 @@ test_anchorblock(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event
    bb = elm_bubble_add(win);
    elm_object_text_set(bb, "Message 2");
    elm_object_text_part_set(bb, "info", "7:16 27/10/2008");
-   elm_bubble_icon_set(bb, ic);
+   elm_object_content_part_set(bb, ELM_BUBBLE_CONTENT_ICON, ic);
    evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL);
    evas_object_show(ic);
    evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
@@ -213,7 +213,7 @@ test_anchorblock(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event
    bb = elm_bubble_add(win);
    elm_object_text_set(bb, "Message 1");
    elm_object_text_part_set(bb, "info", "20:47 18/6/2008");
-   elm_bubble_icon_set(bb, ic);
+   elm_object_content_part_set(bb, ELM_BUBBLE_CONTENT_ICON, ic);
    evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL);
    evas_object_show(ic);
    evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
index 052bbc1..faea34e 100644 (file)
@@ -39,7 +39,7 @@ test_bubble(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
    bb = elm_bubble_add(win);
    elm_object_text_set(bb, "Message 1");
    elm_object_text_part_set(bb, "info", "Corner: bottom_right");
-   elm_bubble_icon_set(bb, ic);
+   elm_object_content_part_set(bb, ELM_BUBBLE_CONTENT_ICON, ic);
    elm_bubble_corner_set(bb, "bottom_right");
    evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL);
    evas_object_show(ic);
index 4b8a0a2..cebdf44 100644 (file)
@@ -102,20 +102,17 @@ test_flip(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info _
    elm_flip_content_back_set(fl, ly);
    evas_object_show(ly);
 
-   bt = elm_button_add(win);
+   bt = elm_button_add(ly);
    elm_object_text_set(bt, "Button 1");
    elm_object_content_part_set(ly, "element1", bt);
-   evas_object_show(bt);
 
-   bt = elm_button_add(win);
+   bt = elm_button_add(ly);
    elm_object_text_set(bt, "Button 2");
    elm_object_content_part_set(ly, "element2", bt);
-   evas_object_show(bt);
 
-   bt = elm_button_add(win);
+   bt = elm_button_add(ly);
    elm_object_text_set(bt, "Button 3");
    elm_object_content_part_set(ly, "element3", bt);
-   evas_object_show(bt);
 
    evas_object_show(fl);
 
index f65c9f0..348c361 100644 (file)
@@ -55,7 +55,7 @@ fill(Evas_Object *win, Eina_Bool do_bg)
    bb = elm_bubble_add(win);
    elm_object_text_set(bb, "Message 3");
    elm_object_text_part_set(bb, "info", "10:32 4/11/2008");
-   elm_bubble_icon_set(bb, ic);
+   elm_object_content_part_set(bb, ELM_BUBBLE_CONTENT_ICON, ic);
    evas_object_show(ic);
    evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
    evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
@@ -79,7 +79,7 @@ fill(Evas_Object *win, Eina_Bool do_bg)
    bb = elm_bubble_add(win);
    elm_object_text_set(bb, "Message 2");
    elm_object_text_part_set(bb, "info", "7:16 27/10/2008");
-   elm_bubble_icon_set(bb, ic);
+   elm_object_content_part_set(bb, ELM_BUBBLE_CONTENT_ICON, ic);
    evas_object_show(ic);
    evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
    evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
@@ -114,7 +114,7 @@ fill(Evas_Object *win, Eina_Bool do_bg)
    bb = elm_bubble_add(win);
    elm_object_text_set(bb, "Message 1");
    elm_object_text_part_set(bb, "info", "20:47 18/6/2008");
-   elm_bubble_icon_set(bb, ic);
+   elm_object_content_part_set(bb, ELM_BUBBLE_CONTENT_ICON, ic);
    evas_object_show(ic);
    evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
    evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
index beb0e89..0be2683 100644 (file)
@@ -19,7 +19,8 @@ external_bubble_state_set(void *data __UNUSED__, Evas_Object *obj, const void *f
    else return;
 
    if (p->label) elm_object_text_set(obj, p->label);
-   if (p->icon) elm_bubble_icon_set(obj, p->icon);
+   if (p->icon)
+     elm_object_content_part_set(obj, ELM_BUBBLE_CONTENT_ICON, p->icon);
    if (p->info) elm_object_text_part_set(obj, "info", p->info);
    if (p->content) elm_object_content_set(obj, p->content);
 }
@@ -41,8 +42,9 @@ external_bubble_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_Ex
          {
             Evas_Object *icon = external_common_param_icon_get(obj, param);
             if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE;
-            elm_bubble_icon_set(obj, icon);
-            return EINA_TRUE;
+            elm_object_content_part_set(obj, ELM_BUBBLE_CONTENT_ICON,
+                                         icon);
+             return EINA_TRUE;
          }
      }
    else if (!strcmp(param->name, "info"))
index 7f38e41..9303d78 100644 (file)
@@ -40,7 +40,7 @@ elm_main(int argc, char **argv)
    evas_object_show(icon);
 
    bubble = elm_bubble_add(win);
-   elm_bubble_icon_set(bubble, icon);
+   elm_object_content_part_set(bubble, ELM_BUBBLE_CONTENT_ICON, icon);
    elm_bubble_info_set(bubble, "INFO");
    elm_object_text_set(bubble, "LABEL");
    elm_bubble_content_set(bubble, label);
index d96f2eb..eac8f9b 100644 (file)
@@ -12464,6 +12464,9 @@ extern "C" {
     *
     * @{
     */
+
+#define ELM_BUBBLE_CONTENT_ICON "elm.swallow.icon"
+
    /**
     * Add a new bubble to the parent
     *
@@ -12565,8 +12568,11 @@ extern "C" {
     *
     * @param obj The bubble object
     * @param icon The given icon for the bubble
+    *
+    * @deprecated use elm_object_content_part_set() instead
+    *
     */
-   EAPI void         elm_bubble_icon_set(Evas_Object *obj, Evas_Object *icon) EINA_ARG_NONNULL(1);
+   EINA_DEPRECATED EAPI void         elm_bubble_icon_set(Evas_Object *obj, Evas_Object *icon) EINA_ARG_NONNULL(1);
    /**
     * Get the icon of the bubble
     *
@@ -12574,8 +12580,11 @@ extern "C" {
     * @return The icon for the bubble
     *
     * This function gets the icon shown on the top left of bubble.
+    *
+    * @deprecated use elm_object_content_part_get() instead
+    *
     */
-   EAPI Evas_Object *elm_bubble_icon_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
+   EINA_DEPRECATED EAPI Evas_Object *elm_bubble_icon_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
    /**
     * Unset the icon of the bubble
     *
@@ -12583,8 +12592,11 @@ extern "C" {
     *
     * @param obj The bubble object
     * @return The icon that was being used
+    *
+    * @deprecated use elm_object_content_part_unset() instead
+    *
     */
-   EAPI Evas_Object *elm_bubble_icon_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
+   EINA_DEPRECATED EAPI Evas_Object *elm_bubble_icon_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
    /**
     * Set the corner of the bubble
     *
index 9e46c97..4858d68 100644 (file)
@@ -78,11 +78,11 @@ _theme_hook(Evas_Object *obj)
 }
 
 static void
-_content_set_hook(Evas_Object *obj, const char *part __UNUSED__, Evas_Object *content)
+_content_set(Evas_Object *obj, Evas_Object *content)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype);
    Widget_Data *wd = elm_widget_data_get(obj);
    if (!wd) return;
+
    if (wd->content == content) return;
    if (wd->content) evas_object_del(wd->content);
    wd->content = content;
@@ -98,31 +98,97 @@ _content_set_hook(Evas_Object *obj, const char *part __UNUSED__, Evas_Object *co
 }
 
 static Evas_Object *
-_content_get_hook(const Evas_Object *obj, const char *part __UNUSED__)
+_content_unset(Evas_Object *obj)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype) NULL;
-   Widget_Data *wd = elm_widget_data_get(obj);
-   if (!wd) return NULL;
-   return wd->content;
-}
-
-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);
    Evas_Object *content;
    if (!wd) return NULL;
    if (!wd->content) return NULL;
    content = wd->content;
    elm_widget_sub_object_del(obj, content);
-   evas_object_event_callback_del_full(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+   evas_object_event_callback_del_full(content,
+                                       EVAS_CALLBACK_CHANGED_SIZE_HINTS,
                                        _changed_size_hints, obj);
    edje_object_part_unswallow(wd->bbl, content);
    wd->content = NULL;
    return content;
 }
 
+static void
+_icon_set(Evas_Object *obj, Evas_Object* icon)
+{
+   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);
+        edje_object_part_swallow(wd->bbl, "elm.swallow.icon", icon);
+        evas_object_event_callback_add(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+                                       _changed_size_hints, obj);
+        edje_object_signal_emit(wd->bbl, "elm,state,icon,visible", "elm");
+        edje_object_message_signal_process(wd->bbl);
+     }
+   _sizing_eval(obj);
+}
+
+static Evas_Object *
+_icon_unset(Evas_Object *obj)
+{
+   Widget_Data *wd = elm_widget_data_get(obj);
+   Evas_Object *icon;
+   if (!wd) return NULL;
+   if (!wd->icon) return NULL;
+   icon = wd->icon;
+   elm_widget_sub_object_del(obj, icon);
+   evas_object_event_callback_del_full(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+                                       _changed_size_hints, obj);
+   edje_object_part_unswallow(wd->bbl, icon);
+   wd->icon = NULL;
+   return icon;
+}
+
+static void
+_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+
+   if ((!part) || !strcmp(part, "elm.swallow.content"))
+     _content_set(obj, content);
+   else if(!strcmp(part, "elm.swallow.icon"))
+     _icon_set(obj, content);
+}
+
+static Evas_Object *
+_content_get_hook(const Evas_Object *obj, const char *part)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return NULL;
+   if ((!part) || !strcmp(part, "elm.swallow.content"))
+     return wd->content;
+   else if(!strcmp(part, "elm.swallow.icon"))
+     return wd->icon;
+   return NULL;
+}
+
+static Evas_Object *
+_content_unset_hook(Evas_Object *obj, const char *part)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return NULL;
+   if ((!part) || !strcmp(part, "elm.swallow.content"))
+     return _content_unset(obj);
+   else if(!strcmp(part, "elm.swallow.icon"))
+     return _icon_unset(obj);
+   return NULL;
+}
+
 static Eina_Bool
 _elm_bubble_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
 {
@@ -316,48 +382,19 @@ elm_bubble_content_unset(Evas_Object *obj)
 EAPI void
 elm_bubble_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);
-        edje_object_part_swallow(wd->bbl, "elm.swallow.icon", icon);
-        evas_object_event_callback_add(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
-                                       _changed_size_hints, obj);
-        edje_object_signal_emit(wd->bbl, "elm,state,icon,visible", "elm");
-        edje_object_message_signal_process(wd->bbl);
-     }
-   _sizing_eval(obj);
+   _content_set_hook(obj, "elm.swallow.icon", icon);
 }
 
 EAPI Evas_Object *
 elm_bubble_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, "elm.swallow.icon");
 }
 
 EAPI Evas_Object *
 elm_bubble_icon_unset(Evas_Object *obj)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype) NULL;
-   Widget_Data *wd = elm_widget_data_get(obj);
-   Evas_Object *icon;
-   if (!wd) return NULL;
-   if (!wd->icon) return NULL;
-   icon = wd->icon;
-   elm_widget_sub_object_del(obj, icon);
-   evas_object_event_callback_del_full(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
-                                       _changed_size_hints, obj);
-   edje_object_part_unswallow(wd->bbl, icon);
-   wd->icon = NULL;
-   return icon;
+   return _content_unset_hook(obj, "elm.swallow.icon");
 }
 
 EAPI void