summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2016-01-18 19:48:31 +0100
committerDave Andreoli <dave@gurumeditation.it>2016-01-18 19:49:28 +0100
commit29ea7e3e649a591e121b066effbe843995946924 (patch)
treef776cfda502cc5e64873d2ace5084f57d5f2bbc7 /src
parent0099187e8c36230054089bbc14ce642c40439395 (diff)
Hoversel: add a test for the populate-on-click scenario
Diffstat (limited to 'src')
-rw-r--r--src/bin/test_hoversel.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/src/bin/test_hoversel.c b/src/bin/test_hoversel.c
index 9dceb3f3a..b59a6c3ef 100644
--- a/src/bin/test_hoversel.c
+++ b/src/bin/test_hoversel.c
@@ -101,6 +101,17 @@ _hoversel_clicked_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
101} 101}
102 102
103static void 103static void
104_hoversel_clicked_populate_cb(void *data EINA_UNUSED, Evas_Object *obj,
105 void *event_info EINA_UNUSED)
106{
107 printf("Hover button is clicked and 'clicked' callback is called.\n");
108 elm_hoversel_item_add(obj, "Item 1", NULL, ELM_ICON_NONE, NULL, NULL);
109 elm_hoversel_item_add(obj, "Item 2", NULL, ELM_ICON_NONE, NULL, NULL);
110 elm_hoversel_item_add(obj, "Item 3", NULL, ELM_ICON_NONE, NULL, NULL);
111 elm_hoversel_item_add(obj, "Item 4", NULL, ELM_ICON_NONE, NULL, NULL);
112}
113
114static void
104_hoversel_selected_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, 115_hoversel_selected_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
105 void *event_info) 116 void *event_info)
106{ 117{
@@ -123,10 +134,13 @@ _hoversel_expanded_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
123 Elm_Object_Item *it = data; 134 Elm_Object_Item *it = data;
124 135
125 printf("'expanded' callback is called.\n"); 136 printf("'expanded' callback is called.\n");
126 printf("old style: %s\n", elm_object_item_style_get(it)); 137 if (it)
127 //item type is button. set the style of button 138 {
128 elm_object_item_style_set(it, "anchor"); 139 printf("old style: %s\n", elm_object_item_style_get(it));
129 printf("new style: %s\n", elm_object_item_style_get(it)); 140 //item type is button. set the style of button
141 elm_object_item_style_set(it, "anchor");
142 printf("new style: %s\n", elm_object_item_style_get(it));
143 }
130} 144}
131 145
132void 146void
@@ -285,6 +299,20 @@ test_hoversel(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_
285 elm_box_pack_end(bx, hoversel); 299 elm_box_pack_end(bx, hoversel);
286 evas_object_show(hoversel); 300 evas_object_show(hoversel);
287 301
302 hoversel = elm_hoversel_add(win);
303 elm_hoversel_hover_parent_set(hoversel, win);
304 elm_object_text_set(hoversel, "Add items when clicked");
305 evas_object_smart_callback_add(hoversel, "clicked",
306 _hoversel_clicked_populate_cb, NULL);
307 evas_object_smart_callback_add(hoversel, "selected",
308 _hoversel_selected_cb, NULL);
309 evas_object_smart_callback_add(hoversel, "dismissed",
310 _hoversel_dismissed_cb, NULL);
311 evas_object_smart_callback_add(hoversel, "expanded",
312 _hoversel_expanded_cb, NULL);
313 elm_box_pack_end(bx, hoversel);
314 evas_object_show(hoversel);
315
288 evas_object_resize(win, 320, 500); 316 evas_object_resize(win, 320, 500);
289 317
290 evas_object_show(win); 318 evas_object_show(win);