rimmed pushed a commit to branch master.

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

commit e372316dc2ddd1e7789e1d8ff4c033072b3f668a
Author: Vitalii Vorobiov <vi.vorob...@samsung.com>
Date:   Thu Jan 14 16:56:16 2016 +0000

    live_popup: add swallow set
---
 src/bin/ui/live_view/elementary/live_popup.c | 87 +++++++++++++++++++++++++---
 1 file changed, 80 insertions(+), 7 deletions(-)

diff --git a/src/bin/ui/live_view/elementary/live_popup.c 
b/src/bin/ui/live_view/elementary/live_popup.c
index e506fa8..92551b1 100644
--- a/src/bin/ui/live_view/elementary/live_popup.c
+++ b/src/bin/ui/live_view/elementary/live_popup.c
@@ -20,12 +20,85 @@
 #include "live_elementary_widgets.h"
 
 static void
-_on_popup_swallow_check(void *data __UNUSED__,
+_on_popup_swallow_check(void *data,
                         Evas_Object *obj __UNUSED__,
-                        void *ei __UNUSED__)
+                        void *ei)
 {
-   TODO("Remake on_swallow_check, so that would be used everywhere.")
-   ERR(N_("Complex widgets are not implemented yet."))
+   Demo_Part *part = (Demo_Part *)ei;
+   Evas_Object *object = (Evas_Object *) data;
+   Evas_Object *content;
+   char *pointer = NULL;
+   Eina_Stringshare *but_swallow = NULL, *title_swallow = NULL;
+
+   pointer = strstr(part->name, "button");
+   if (pointer) but_swallow = eina_stringshare_printf("button%c",
+                                                      pointer[sizeof(pointer) 
- 2]);
+   if (!strcmp(part->name, "elm.swallow.title.icon"))
+     title_swallow = eina_stringshare_add("title,icon");
+
+   int content_type = part->swallow_content;
+
+   if (part->change)
+     {
+        if ((content_type == CONTENT_NONE) && (part->object))
+          {
+             if (but_swallow)
+               {
+                  content = elm_object_part_content_get(object, but_swallow);
+                  elm_object_part_content_unset(object, but_swallow);
+               }
+             else if (title_swallow)
+               {
+                  content = elm_object_part_content_get(object, part->name);
+                  elm_object_part_content_unset(object, part->name);
+               }
+             else
+               {
+                  content = elm_object_content_get(object);
+                  elm_object_content_unset(object);
+               }
+             evas_object_del(content);
+             content = NULL;
+             part->object = NULL;
+          }
+
+        if (but_swallow)
+          {
+             part->object = elm_button_add(object);
+             elm_object_text_set(part->object, "OK");
+             elm_object_part_content_set(object, but_swallow, part->object);
+          }
+        else if (title_swallow)
+          {
+             part->object = object_generate(part, object);
+             elm_object_part_content_set(object, title_swallow, part->object);
+          }
+        else
+          {
+             part->object = object_generate(part, object);
+             elm_object_content_set(object, part->object);
+          }
+        part->change = false;
+     }
+
+   if (part->object)
+     {
+        evas_object_color_set(part->object,
+                              part->r,
+                              part->g,
+                              part->b,
+                              part->a);
+
+        evas_object_size_hint_min_set(part->object,
+                                      part->min_w,
+                                      part->min_h);
+        evas_object_size_hint_max_set(part->object,
+                                      part->max_w,
+                                      part->max_h);
+     }
+
+   eina_stringshare_del(but_swallow);
+   eina_stringshare_del(title_swallow);
 }
 
 Evas_Object *
@@ -51,9 +124,9 @@ widget_popup_create(Evas_Object *parent, const Group *group)
    free(style_parsed[0]);
    free(style_parsed);
 
-   evas_object_data_set(object, SWALLOW_FUNC, _on_popup_swallow_check);
-   evas_object_data_set(object, TEXT_FUNC, on_text_check);
-   evas_object_data_set(object, SIGNAL_FUNC, send_signal);
+   evas_object_smart_callback_add(ap.win, SIGNAL_DEMO_SWALLOW_SET, 
_on_popup_swallow_check, object);
+   evas_object_smart_callback_add(ap.win, SIGNAL_DEMO_TEXT_SET, on_text_check, 
object);
+   evas_object_smart_callback_add(ap.win, SIGNAL_DEMO_SIGNAL_SEND, 
send_signal, object);
 
    elm_object_style_set(object, style_name);
    eina_stringshare_del(style_name);

-- 


Reply via email to