rimmed pushed a commit to branch master.

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

commit f3c3db584ae73c69f27540ac9cad21f495221b33
Author: Vitalii Vorobiov <vi.vorob...@samsung.com>
Date:   Tue Jan 12 13:17:19 2016 +0000

    live_multibuttonentry: text, swallow and signal
---
 .../live_view/elementary/live_multibuttonentry.c   | 89 ++++++++++++++++------
 1 file changed, 66 insertions(+), 23 deletions(-)

diff --git a/src/bin/ui/live_view/elementary/live_multibuttonentry.c 
b/src/bin/ui/live_view/elementary/live_multibuttonentry.c
index 809f786..febd81a 100644
--- a/src/bin/ui/live_view/elementary/live_multibuttonentry.c
+++ b/src/bin/ui/live_view/elementary/live_multibuttonentry.c
@@ -20,43 +20,86 @@
 #include "live_elementary_widgets.h"
 
 static void
-_on_multibutton_swallow_check(void *data __UNUSED__,
+_on_multibutton_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;
+   Elm_Object_Item *multi_item = elm_multibuttonentry_first_item_get(data);
+   Evas_Object *content;
+   int content_type = part->swallow_content;
+
+   while (multi_item)
+     {
+        if (part->change)
+          {
+             /* if NONE - delete object */
+             if ((content_type == CONTENT_NONE) && (part->object))
+               {
+                  content = elm_object_part_content_unset(multi_item, 
part->name);
+                  evas_object_del(content);
+                  content = NULL;
+                  part->object = NULL;
+               }
+
+             part->object = object_generate(part, multi_item);
+             part->change = false;
+             elm_object_part_content_set(multi_item, part->name, part->object);
+          }
+
+        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);
+          }
+        elm_object_item_part_text_set(multi_item, part->name, 
part->text_content);
+        multi_item = elm_multibuttonentry_item_next_get(multi_item);
+     }
 }
 
 static void
-_on_multibutton_text_check(void *data __UNUSED__,
+_on_multibutton_text_check(void *data,
                            Evas_Object *obj __UNUSED__,
-                           void *ei __UNUSED__)
+                           void *ei)
 {
-   TODO("Remake on_text_check, so that would be used everywhere.")
-   ERR(N_("Complex widgets are not implemented yet."))
+   Demo_Part *part = (Demo_Part *)ei;
+   Elm_Object_Item *multi_item = elm_multibuttonentry_first_item_get(data);
+
+   while (multi_item)
+     {
+        elm_object_item_part_text_set(multi_item, part->name, 
part->text_content);
+        multi_item = elm_multibuttonentry_item_next_get(multi_item);
+     }
 }
 
 static void
 _multibutton_send_signal(void *data,
-                         Evas_Object *obj,
-                         void *ei __UNUSED__)
+                         Evas_Object *obj __UNUSED__,
+                         void *ei)
 {
+   Demo_Signal *sig = (Demo_Signal *)ei;
    Elm_Object_Item *item = NULL;
 
    assert(data != NULL);
 
    item = elm_multibuttonentry_first_item_get(data);
-
-   const char *name = evas_object_data_get(obj, SIGNAL_NAME);
-   const char *source = evas_object_data_get(obj, SIGNAL_SOURCE);
-
-   assert(name != NULL);
-   assert(source != NULL);
+   assert(sig != NULL);
+   assert(sig->sig_name != NULL);
+   assert(sig->source_name != NULL);
 
    while (item)
      {
-        elm_object_item_signal_emit(item, name, source);
+        elm_object_item_signal_emit(item, sig->sig_name, sig->source_name);
         item = elm_multibuttonentry_item_next_get(item);
      }
 }
@@ -87,15 +130,15 @@ widget_multibuttonentry_create(Evas_Object *parent, const 
Group *group)
    /** in case when we edit button gorup, we need to apply changes to items */
    if (strcmp(group->class, "btn") == 0)
      {
-        evas_object_data_set(object, SWALLOW_FUNC, 
_on_multibutton_swallow_check);
-        evas_object_data_set(object, TEXT_FUNC, _on_multibutton_text_check);
-        evas_object_data_set(object, SIGNAL_FUNC, _multibutton_send_signal);
+        evas_object_smart_callback_add(ap.win, SIGNAL_DEMO_SWALLOW_SET, 
_on_multibutton_swallow_check, object);
+        evas_object_smart_callback_add(ap.win, SIGNAL_DEMO_TEXT_SET,    
_on_multibutton_text_check, object);
+        evas_object_smart_callback_add(ap.win, SIGNAL_DEMO_SIGNAL_SEND, 
_multibutton_send_signal, object);
      }
    else /** on all other cases we need to apply changes to whole object */
      {
-        evas_object_data_set(object, SWALLOW_FUNC, on_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_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);
      }
 
    /** closed button is group used for showing collapsed multibuttonentry only 
*/

-- 


Reply via email to