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)
committerMike McCormack <mj.mccormack@samsung.com>
Wed, 9 Nov 2011 00:37:53 +0000 (09:37 +0900)
git-svn-id: https://svn.enlightenment.org/svn/e/trunk/elementary@64925 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

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/lib/Elementary.h.in
src/lib/elm_bubble.c

index 58459fa..5ea7d82 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 a4e8111..e9f057d 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 916fb48..e001949 100644 (file)
@@ -102,19 +102,19 @@ 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_layout_content_set(ly, "element1", bt);
+   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_layout_content_set(ly, "element2", bt);
+   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_layout_content_set(ly, "element3", bt);
+   elm_object_content_part_set(ly, "element3", bt);
    evas_object_show(bt);
 
    evas_object_show(fl);
index e3b9ac5..0ef8725 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 d13099e..ed24354 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_bubble_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 a7f1189..2c19486 100644 (file)
@@ -12189,6 +12189,9 @@ extern "C" {
     *
     * @{
     */
+
+#define ELM_BUBBLE_CONTENT_ICON "elm.swallow.icon"
+
    /**
     * Add a new bubble to the parent
     *
@@ -12281,8 +12284,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
     *
@@ -12290,8 +12296,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
     *
@@ -12299,8 +12308,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 84530db..44fb8b1 100644 (file)
@@ -85,6 +85,118 @@ _theme_hook(Evas_Object *obj)
    _sizing_eval(obj);
 }
 
+static void
+_content_set(Evas_Object *obj, Evas_Object *content)
+{
+   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;
+   if (content)
+     {
+        elm_widget_sub_object_add(obj, content);
+        evas_object_event_callback_add(content,
+                                       EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+                                       _changed_size_hints, obj);
+        edje_object_part_swallow(wd->bbl, "elm.swallow.content", content);
+     }
+   _sizing_eval(obj);
+}
+
+static Evas_Object *
+_content_unset(Evas_Object *obj)
+{
+   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,
+                                       _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)
 {
@@ -335,46 +447,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);
-   edje_object_part_unswallow(wd->bbl, icon);
-   wd->icon = NULL;
-   return icon;
+   return _content_unset_hook(obj, "elm.swallow.icon");
 }
 
 EAPI void