rimmed pushed a commit to branch master.

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

commit 5b70a4d14ce843a8f465d4da7f46714b776c60fd
Author: Vitalii Vorobiov <vi.vorob...@samsung.com>
Date:   Wed Dec 23 12:46:22 2015 +0200

    property_demo_swallow: min max of a content
---
 src/bin/ui/property_demo_swallow.c | 68 ++++++++++++++++++++++++++++++++++----
 1 file changed, 62 insertions(+), 6 deletions(-)

diff --git a/src/bin/ui/property_demo_swallow.c 
b/src/bin/ui/property_demo_swallow.c
index 16f2797..983dac2 100644
--- a/src/bin/ui/property_demo_swallow.c
+++ b/src/bin/ui/property_demo_swallow.c
@@ -47,8 +47,9 @@ struct _Demo_Swallow_Prop_Data
    Evas_Object *picture;
    Evas_Object *widget;
 
-   Evas_Object *size_h, *size_w;
-   Evas_Object *hint_h, *hint_w;
+   Evas_Object *max_w, *max_h;
+   Evas_Object *min_w, *min_h;
+   Evas_Object *hint_w, *hint_h;
    Evas_Object *align_x, *align_y;
 
    Part_ *part;
@@ -56,12 +57,62 @@ struct _Demo_Swallow_Prop_Data
 typedef struct _Demo_Swallow_Prop_Data Demo_Swallow_Prop_Data;
 
 static const char *swallow_content_type[] = { N_("None"),
-                                         N_("Rectangle"),
-                                         N_("Picture"),
-                                         N_("Widget"),
-                                         NULL};
+                                              N_("Rectangle"),
+                                              N_("Picture"),
+                                              N_("Widget"),
+                                              NULL};
+static void
+_on_spinner_mouse_wheel(void *data __UNUSED__,
+                        Evas *e __UNUSED__,
+                        Evas_Object *obj __UNUSED__,
+                        void *event_info)
+{
+   Evas_Event_Mouse_Wheel *mev = event_info;
+   mev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+}
+
+#define PROPERTY_SWALLOW_COMMON_2SPINNER_CALLBACKS(MEMBER, VALUE) \
+static void \
+_on_##MEMBER##_##VALUE##_change(void *data __UNUSED__, \
+                                Evas_Object *obj, \
+                                void *ei __UNUSED__) \
+{ \
+   int value = elm_spinner_value_get(obj); \
+   printf("Min now is [%d] \n", value); \
+}
+
+#define PROPERTY_SWALLOW_COMMON_2SPINNER_ADD(TEXT, VALUE1, VALUE2, MEMBER) \
+PROPERTY_SWALLOW_COMMON_2SPINNER_CALLBACKS(MEMBER, VALUE1) \
+PROPERTY_SWALLOW_COMMON_2SPINNER_CALLBACKS(MEMBER, VALUE2) \
+static Evas_Object * \
+prop_##MEMBER##_##VALUE1##_##VALUE2##_add(Evas_Object *parent, 
Demo_Swallow_Prop_Data *pd) \
+{ \
+   PROPERTY_ITEM_ADD(parent, TEXT, "2swallow") \
+   SPINNER_ADD(item, pd->MEMBER##_##VALUE1, 0, 9999, 2.0, true) \
+   elm_layout_content_set(item, "swallow.content1", pd->MEMBER##_##VALUE1); \
+   elm_layout_text_set(item, "label.swallow1.start", _("w:")); \
+   elm_layout_text_set(item, "label.swallow1.end", _("px")); \
+   evas_object_event_callback_priority_add(pd->MEMBER##_##VALUE1, 
EVAS_CALLBACK_MOUSE_WHEEL, \
+                                           EVAS_CALLBACK_PRIORITY_BEFORE, \
+                                          _on_spinner_mouse_wheel, NULL); \
+   evas_object_smart_callback_add(pd->MEMBER##_##VALUE1, "changed", 
_on_##MEMBER##_##VALUE1##_change, pd); \
+   SPINNER_ADD(item, pd->MEMBER##_##VALUE2, 0, 9999, 2.0, true) \
+   elm_layout_content_set(item, "swallow.content2", pd->MEMBER##_##VALUE2); \
+   elm_layout_text_set(item, "label.swallow2.start", _("h:")); \
+   elm_layout_text_set(item, "label.swallow2.end", _("px")); \
+   evas_object_event_callback_priority_add(pd->MEMBER##_##VALUE2, 
EVAS_CALLBACK_MOUSE_WHEEL, \
+                                           EVAS_CALLBACK_PRIORITY_BEFORE, \
+                                           _on_spinner_mouse_wheel, NULL); \
+   evas_object_smart_callback_add(pd->MEMBER##_##VALUE2, "changed", 
_on_##MEMBER##_##VALUE2##_change, pd); \
+   return item; \
+}
 
 TODO("move from here, property_demo_text and property_group all common stuff")
+PROPERTY_SWALLOW_COMMON_2SPINNER_ADD(_("min"), w, h, min);
+
+
+PROPERTY_SWALLOW_COMMON_2SPINNER_ADD(_("max"), w, h, max);
+
 static Evas_Object *
 prop_item_label_add(Evas_Object *parent,
                     Evas_Object **label,
@@ -100,6 +151,7 @@ prop_swallow_content_add(Evas_Object *parent, 
Demo_Swallow_Prop_Data *pd)
    ewe_combobox_select_item_set(pd->swallow_content, 0);
    return item;
 }
+
 static void
 _on_rectangle_color_change(void *data,
                            Evas_Object *obj,
@@ -205,6 +257,10 @@ ui_property_demo_swallow_add(Evas_Object *parent)
    elm_box_pack_end(pd->box, item);
    item = prop_rectangle_color_add(pd->box, pd);
    elm_box_pack_end(pd->box, item);
+   item = prop_min_w_h_add(pd->box, pd);
+   elm_box_pack_end(pd->box, item);
+   item = prop_max_w_h_add(pd->box, pd);
+   elm_box_pack_end(pd->box, item);
 
    return pd->box;
 }

-- 


Reply via email to