rimmed pushed a commit to branch master.

http://git.enlightenment.org/tools/eflete.git/commit/?id=e89cc41697d1ac34615465d963eb303e3de9ddea

commit e89cc41697d1ac34615465d963eb303e3de9ddea
Author: Vitalii Vorobiov <vi.vorob...@samsung.com>
Date:   Tue Dec 22 14:49:44 2015 +0200

    demo: apply and show swallow when SWALLOW part is selected
    
    Shows only name for now but soon....
---
 src/bin/common/signals.h           |  8 +++++
 src/bin/ui/demo_group.c            |  2 +-
 src/bin/ui/property.c              | 41 +++++++++++++++++++++++--
 src/bin/ui/property_demo_swallow.c | 63 ++++++++++++++++++++++++++++++++++++--
 src/bin/ui/property_private.h      |  6 ++++
 5 files changed, 115 insertions(+), 5 deletions(-)

diff --git a/src/bin/common/signals.h b/src/bin/common/signals.h
index 816b93b..1237553 100644
--- a/src/bin/common/signals.h
+++ b/src/bin/common/signals.h
@@ -331,6 +331,14 @@ typedef struct {
 #define SIGNAL_DEMO_SWALLOW_PART_CLICKED "SIGNAL_DEMO_SWALLOW_PART_CLICKED"
 
 /**
+ * emited when swallow part in demo is clicked.
+ * eventinfo - NULL
+ *
+ * @ingroup Window
+ */
+#define SIGNAL_DEMO_SWALLOW_PART_CLICKED "SIGNAL_DEMO_SWALLOW_PART_CLICKED"
+
+/**
  * emited when style/styles in style editor is/are selected.
  * eventinfo - NULL
  *
diff --git a/src/bin/ui/demo_group.c b/src/bin/ui/demo_group.c
index 9aebc25..91eb02b 100644
--- a/src/bin/ui/demo_group.c
+++ b/src/bin/ui/demo_group.c
@@ -149,7 +149,7 @@ _selected_cb(void *data __UNUSED__,
        (part->type == EDJE_PART_TYPE_TEXTBLOCK))
      evas_object_smart_callback_call(ap.win, SIGNAL_DEMO_TEXT_PART_CLICKED, 
part);
    else if (part->type == EDJE_PART_TYPE_SWALLOW)
-     evas_object_smart_callback_call(ap.win, SIGNAL_DEMO_SWALLOW_PART_CLICKED, 
NULL);
+     evas_object_smart_callback_call(ap.win, SIGNAL_DEMO_SWALLOW_PART_CLICKED, 
part);
    else /* empty everything */
      evas_object_smart_callback_call(ap.win, SIGNAL_DIFFERENT_TAB_CLICKED, 
NULL);
 }
diff --git a/src/bin/ui/property.c b/src/bin/ui/property.c
index 146e4c7..288af93 100644
--- a/src/bin/ui/property.c
+++ b/src/bin/ui/property.c
@@ -81,7 +81,8 @@ enum _Property_Type {
    SOUND_PROPERTY,
    STYLE_PROPERTY,
    COLOR_PROPERTY,
-   DEMO_TEXT_PROPERTY
+   DEMO_TEXT_PROPERTY,
+   DEMO_SWALLOW_PROPERTY
 };
 typedef enum _Property_Type Property_Type;
 
@@ -93,6 +94,7 @@ struct _Prop_Data
    Evas_Object *style_property;
    Evas_Object *color_property;
    Evas_Object *demo_text_property;
+   Evas_Object *demo_swallow_property;
    Evas_Object *colorclass_property;
    Evas_Object *layout;
 
@@ -119,6 +121,7 @@ _on_different_clicked(void *data,
    evas_object_hide(pd->style_property);
    evas_object_hide(pd->color_property);
    evas_object_hide(pd->demo_text_property);
+   evas_object_hide(pd->demo_swallow_property);
 
    pd->type = PROPERTY;
 }
@@ -141,6 +144,7 @@ _on_image_editor_clicked(void *data,
    evas_object_hide(pd->style_property);
    evas_object_hide(pd->color_property);
    evas_object_hide(pd->demo_text_property);
+   evas_object_hide(pd->demo_swallow_property);
    evas_object_show(pd->image_property);
 
    pd->type = IMAGE_PROPERTY;
@@ -164,6 +168,7 @@ _on_sound_editor_clicked(void *data,
    evas_object_hide(pd->style_property);
    evas_object_hide(pd->color_property);
    evas_object_hide(pd->demo_text_property);
+   evas_object_hide(pd->demo_swallow_property);
    evas_object_show(pd->sound_property);
 
    pd->type = SOUND_PROPERTY;
@@ -187,6 +192,7 @@ _on_style_editor_clicked(void *data,
    evas_object_hide(pd->sound_property);
    evas_object_hide(pd->color_property);
    evas_object_hide(pd->demo_text_property);
+   evas_object_hide(pd->demo_swallow_property);
    evas_object_show(pd->style_property);
 
    pd->type = STYLE_PROPERTY;
@@ -232,6 +238,7 @@ _on_text_part_clicked(void *data,
    evas_object_hide(pd->image_property);
    evas_object_hide(pd->sound_property);
    evas_object_hide(pd->style_property);
+   evas_object_hide(pd->demo_swallow_property);
    evas_object_show(pd->demo_text_property);
 
    ui_property_demo_text_part_set(pd->demo_text_property, part);
@@ -240,6 +247,32 @@ _on_text_part_clicked(void *data,
 }
 
 static void
+_on_swallow_part_clicked(void *data,
+                         Evas_Object *obj __UNUSED__,
+                         void *event_info __UNUSED__)
+{
+   Evas_Object *property = data;
+   PROP_DATA_GET()
+   Part_ *part = (Part_ *) event_info;
+
+   assert(pd != NULL);
+
+   ui_property_group_unset(pd->group_property);
+   elm_object_content_unset(pd->layout);
+   elm_object_content_set(pd->layout, pd->demo_swallow_property);
+   evas_object_hide(pd->group_property);
+   evas_object_hide(pd->image_property);
+   evas_object_hide(pd->sound_property);
+   evas_object_hide(pd->style_property);
+   evas_object_hide(pd->demo_text_property);
+   evas_object_show(pd->demo_swallow_property);
+
+   ui_property_demo_swallow_part_set(pd->demo_swallow_property, part);
+
+   pd->type = DEMO_SWALLOW_PROPERTY;
+}
+
+static void
 _on_tab_changed(void *data,
                 Evas_Object *obj __UNUSED__,
                 void *event_info)
@@ -266,7 +299,8 @@ _on_tab_changed(void *data,
        pd->type == STYLE_PROPERTY ||
        pd->type == SOUND_PROPERTY ||
        pd->type == COLOR_PROPERTY ||
-       pd->type == PROPERTY || pd->type == DEMO_TEXT_PROPERTY)
+       pd->type == PROPERTY || pd->type == DEMO_TEXT_PROPERTY ||
+       pd->type == DEMO_SWALLOW_PROPERTY)
      {
         elm_object_content_unset(pd->layout);
         elm_object_content_set(pd->layout, pd->group_property);
@@ -275,6 +309,7 @@ _on_tab_changed(void *data,
         evas_object_hide(pd->style_property);
         evas_object_hide(pd->color_property);
         evas_object_hide(pd->demo_text_property);
+        evas_object_hide(pd->demo_swallow_property);
      }
 
    //evas_object_hide(elm_object_content_unset(pd->layout));
@@ -308,6 +343,7 @@ ui_property_add(Evas_Object *parent)
    pd->style_property = ui_property_style_add(pd->layout);
    pd->color_property = ui_property_color_add(pd->layout);
    pd->demo_text_property = ui_property_demo_text_add(pd->layout);
+   pd->demo_swallow_property = ui_property_demo_swallow_add(pd->layout);
    /* register global callbacks */
    evas_object_smart_callback_add(ap.win, SIGNAL_TAB_CHANGED, _on_tab_changed, 
pd->layout);
    evas_object_smart_callback_add(ap.win, SIGNAL_IMAGE_EDITOR_TAB_CLICKED, 
_on_image_editor_clicked, pd->layout);
@@ -315,6 +351,7 @@ ui_property_add(Evas_Object *parent)
    evas_object_smart_callback_add(ap.win, SIGNAL_STYLE_EDITOR_TAB_CLICKED, 
_on_style_editor_clicked, pd->layout);
    evas_object_smart_callback_add(ap.win, SIGNAL_COLOR_EDITOR_TAB_CLICKED, 
_on_color_editor_clicked, pd->layout);
    evas_object_smart_callback_add(ap.win, SIGNAL_DEMO_TEXT_PART_CLICKED, 
_on_text_part_clicked, pd->layout);
+   evas_object_smart_callback_add(ap.win, SIGNAL_DEMO_SWALLOW_PART_CLICKED, 
_on_swallow_part_clicked, pd->layout);
    evas_object_smart_callback_add(ap.win, SIGNAL_DIFFERENT_TAB_CLICKED, 
_on_different_clicked, pd->layout);
 
    return pd->layout;
diff --git a/src/bin/ui/property_demo_swallow.c 
b/src/bin/ui/property_demo_swallow.c
index af13cbb..e37af84 100644
--- a/src/bin/ui/property_demo_swallow.c
+++ b/src/bin/ui/property_demo_swallow.c
@@ -37,9 +37,9 @@
 
 struct _Demo_Swallow_Prop_Data
 {
-   Evas_Object *name;
-   Evas_Object *visibility;
+   Evas_Object *box;
 
+   Evas_Object *name;
    Evas_Object *swallow_content;
 
    Evas_Object *color;
@@ -49,7 +49,66 @@ struct _Demo_Swallow_Prop_Data
    Evas_Object *size_h, *size_w;
    Evas_Object *hint_h, *hint_w;
    Evas_Object *align_x, *align_y;
+
+   Part_ *part;
 };
 typedef struct _Demo_Swallow_Prop_Data Demo_Swallow_Prop_Data;
 
 
+TODO("move from here, property_demo_text and property_group all common stuff")
+static Evas_Object *
+prop_item_label_add(Evas_Object *parent,
+                    Evas_Object **label,
+                    const char *lab_text,
+                    const char *text)
+{
+   assert(parent != NULL);
+   assert(label != NULL);
+
+   PROPERTY_ITEM_ADD(parent, lab_text, "1swallow")
+   LABEL_ADD(item, *label, text)
+   elm_object_part_content_set(item, "elm.swallow.content", *label);
+   return item;
+}
+
+void
+ui_property_demo_swallow_part_set(Evas_Object *property, Part_ *part)
+{
+   DEMO_SWALLOW_PROP_DATA_GET()
+
+   /* setting */
+   if (part)
+     {
+        elm_object_text_set(pd->name, part->name);
+     }
+
+   pd->part = part;
+
+   /* showing */
+   evas_object_show(property);
+}
+
+Evas_Object *
+ui_property_demo_swallow_add(Evas_Object *parent)
+{
+   Demo_Swallow_Prop_Data *pd;
+   Evas_Object *item;
+
+   assert(parent != NULL);
+
+   pd = mem_calloc(1, sizeof(Demo_Swallow_Prop_Data));
+
+   /* editors */
+   BOX_ADD(parent, pd->box, false, false);
+   elm_box_align_set(pd->box, 0.5, 0.0);
+   evas_object_hide(pd->box);
+   evas_object_data_set(pd->box, DEMO_SWALLOW_PROP_DATA, pd);
+
+   /* Frame with info */
+   elm_box_align_set(pd->box, 0.5, 0.0);
+   item = prop_item_label_add(pd->box, &pd->name, _("name"), _(" - "));
+   elm_box_pack_end(pd->box, item);
+
+   return pd->box;
+}
+
diff --git a/src/bin/ui/property_private.h b/src/bin/ui/property_private.h
index 23e2314..371d482 100644
--- a/src/bin/ui/property_private.h
+++ b/src/bin/ui/property_private.h
@@ -73,4 +73,10 @@ ui_property_demo_text_add(Evas_Object *parent);
 void
 ui_property_demo_text_part_set(Evas_Object *property, Part_ *part);
 
+Evas_Object *
+ui_property_demo_swallow_add(Evas_Object *parent);
+
+void
+ui_property_demo_swallow_part_set(Evas_Object *property, Part_ *part);
+
 #endif /* UI_PROPERTY_1_H */

-- 


Reply via email to