elementary/conformant - content_set/get/unset
authorhermet <hermet@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 28 Oct 2011 09:36:50 +0000 (09:36 +0000)
committerhermet <hermet@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 28 Oct 2011 09:36:50 +0000 (09:36 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@64489 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

doc/examples.dox
doc/widgets/widget_preview_conformant.c
src/bin/test_conform.c
src/examples/conformant_example_02.c
src/lib/Elementary.h.in
src/lib/elm_conform.c

index 705efd4..cf183ab 100644 (file)
  * @until evas_object_show
  *
  * Finally, we'll set the box as conformant's content, just like this:
- * @skipline elm_conformant_content_set
+ * @skipline elm_object_content_set
  *
  * Compare both examples code:
  * @ref conformant_example_01.c "conformant_example_01.c"
index b5b9a05..904047b 100644 (file)
@@ -37,6 +37,6 @@ evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
 evas_object_show(en);
 elm_box_pack_end(bx, en);
 
-elm_conformant_content_set(conform, bx);
+elm_object_content_set(conform, bx);
 
 #include "widget_preview_tmpl_foot.c"
index 689d16c..fc2ef17 100644 (file)
@@ -80,7 +80,7 @@ test_conformant(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event
    evas_object_show(en);
    elm_box_pack_end(bx, en);
 
-   elm_conformant_content_set(conform, bx);
+   elm_object_content_set(conform, bx);
    evas_object_show(bx);
 
    evas_object_resize(win, 240, 240);
@@ -169,7 +169,7 @@ test_conformant2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event
 
    evas_object_smart_callback_add(btn, "clicked", popobj, pg);
 
-   elm_conformant_content_set(conform, bx);
+   elm_object_content_set(conform, bx);
    evas_object_show(bx);
 
    conform = elm_conformant_add(win);
@@ -201,7 +201,7 @@ test_conformant2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event
 
    evas_object_smart_callback_add(btn, "clicked", popobj, pg);
 
-   elm_conformant_content_set(conform, bx);
+   elm_object_content_set(conform, bx);
    evas_object_show(bx);
 
    evas_object_resize(win, 240, 480);
index 3e04e8d..80d401a 100644 (file)
@@ -73,7 +73,7 @@ elm_main(int argc __UNUSED__, char **argv __UNUSED__)
    elm_box_pack_end(bx, btn);
    evas_object_show(btn);
 
-   elm_conformant_content_set(conform, bx);
+   elm_object_content_set(conform, bx);
    evas_object_show(bx);
 
    evas_object_resize(win, 240, 480);
index 8897d55..7e61eb0 100644 (file)
@@ -24349,6 +24349,10 @@ extern "C" {
     * Available styles for it:
     * - @c "default"
     *
+    * Default contents parts of the conformant widget that you can use for are:
+    *
+    * @li "elm.swallow.content" - A content of the conformant
+    *
     * See how to use this widget in this example:
     * @ref conformant_example
     */
@@ -24384,14 +24388,14 @@ extern "C" {
     *
     * Once the content object is set, a previously set one will be deleted.
     * If you want to keep that old content object, use the
-    * elm_conformat_content_unset() function.
+    * elm_object_content_unset() function.
     *
-    * @see elm_conformant_content_unset()
-    * @see elm_conformant_content_get()
+    * @see elm_object_content_unset()
+    * @see elm_object_content_get()
     *
     * @ingroup Conformant
     */
-   EAPI void         elm_conformant_content_set(Evas_Object *obj, Evas_Object *content) EINA_ARG_NONNULL(1);
+   EINA_DEPRECATED EAPI void         elm_conformant_content_set(Evas_Object *obj, Evas_Object *content) EINA_ARG_NONNULL(1);
 
    /**
     * Get the content of the conformant widget.
@@ -24401,14 +24405,14 @@ extern "C" {
     *
     * Return the content object which is set for this widget.
     * It won't be unparent from conformant. For that, use
-    * elm_conformant_content_unset().
+    * elm_object_content_unset().
     *
-    * @see elm_conformant_content_set() for more details.
-    * @see elm_conformant_content_unset()
+    * @see elm_object_content_set().
+    * @see elm_object_content_unset()
     *
     * @ingroup Conformant
     */
-   EAPI Evas_Object *elm_conformant_content_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
+   EINA_DEPRECATED EAPI Evas_Object *elm_conformant_content_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
 
    /**
     * Unset the content of the conformant widget.
@@ -24418,11 +24422,11 @@ extern "C" {
     *
     * Unparent and return the content object which was set for this widget.
     *
-    * @see elm_conformant_content_set() for more details.
+    * @see elm_object_content_set().
     *
     * @ingroup Conformant
     */
-   EAPI Evas_Object *elm_conformant_content_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
+   EINA_DEPRECATED EAPI Evas_Object *elm_conformant_content_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
 
    /**
     * Returns the Evas_Object that represents the content area.
index b632175..620b79e 100644 (file)
@@ -47,6 +47,12 @@ static void _del_pre_hook(Evas_Object *obj);
 static void _del_hook(Evas_Object *obj);
 static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
 static void _theme_hook(Evas_Object *obj);
+static void _content_set_hook(Evas_Object *obj,
+                              const char *part,
+                              Evas_Object *content);
+static Evas_Object *_content_get_hook(const Evas_Object *obj,
+                                      const char *part);
+static Evas_Object *_content_unset_hook(Evas_Object *obj, const char *part);
 static void _swallow_conformant_parts(Evas_Object *obj);
 static void _conformant_part_size_set(Evas_Object *obj,
                                       Evas_Object *sobj,
@@ -56,11 +62,15 @@ static void _conformant_part_size_set(Evas_Object *obj,
                                       Evas_Coord sh);
 static void _conformant_part_sizing_eval(Evas_Object *obj,
                                          Conformant_Part_Type part_type);
-static void
-_conformant_move_resize_event_cb(void *data, Evas *e, Evas_Object *obj,
-                                 void *event_info);
+static void _conformant_move_resize_event_cb(void *data,
+                                             Evas *e,
+                                             Evas_Object *obj,
+                                             void *event_info);
 static void _sizing_eval(Evas_Object *obj);
 static Eina_Bool _prop_change(void *data, int type, void *event);
+static void _changed_size_hints(void *data, Evas *e,
+                                Evas_Object *obj,
+                                void *event_info);
 
 /* local functions */
 static void
@@ -111,6 +121,51 @@ _theme_hook(Evas_Object *obj)
 }
 
 static void
+_content_set_hook(Evas_Object *obj, const char *part __UNUSED__, 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;
+   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->base, "elm.swallow.content", content);
+     }
+   _sizing_eval(obj);
+}
+
+static Evas_Object *
+_content_get_hook(const Evas_Object *obj, const char *part __UNUSED__)
+{
+   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) || (!wd->content)) return NULL;
+   content = wd->content;
+   elm_widget_sub_object_del(obj, wd->content);
+   edje_object_part_unswallow(wd->base, wd->content);
+   wd->content = NULL;
+   return content;
+}
+
+static void
 _sizing_eval(Evas_Object *obj)
 {
    Widget_Data *wd = elm_widget_data_get(obj);
@@ -543,48 +598,19 @@ elm_conformant_add(Evas_Object *parent)
 EAPI void
 elm_conformant_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;
-   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->base, "elm.swallow.content", content);
-     }
-   _sizing_eval(obj);
+   _content_set_hook(obj, NULL, content);
 }
 
 EAPI Evas_Object *
 elm_conformant_content_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->content;
+   return _content_get_hook(obj, NULL);
 }
 
 EAPI Evas_Object *
 elm_conformant_content_unset(Evas_Object *obj)
 {
-   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, wd->content);
-   edje_object_part_unswallow(wd->base, wd->content);
-   wd->content = NULL;
-   return content;
+   return _content_unset_hook(obj, NULL);
 }
 
 EAPI Evas_Object *