summaryrefslogtreecommitdiff
path: root/src/bin/elementary/test_ui_items.c
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-07-29 15:00:32 +0200
committerCedric BAIL <cedric.bail@free.fr>2019-07-29 11:17:42 -0700
commit764f35b7a3e795e344d2414e252e280c3c34756d (patch)
tree9415e355ba2f570a788c0b98f8e61dae5be16b95 /src/bin/elementary/test_ui_items.c
parent7f2ce2f99a345d4b3b667755db1d73f7db213f03 (diff)
elm_test: add a example that shows efl_ui_item instances
this is just a little showcase to show the possible items Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D9430
Diffstat (limited to '')
-rw-r--r--src/bin/elementary/test_ui_items.c87
1 files changed, 87 insertions, 0 deletions
diff --git a/src/bin/elementary/test_ui_items.c b/src/bin/elementary/test_ui_items.c
new file mode 100644
index 0000000..4c2254a
--- /dev/null
+++ b/src/bin/elementary/test_ui_items.c
@@ -0,0 +1,87 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#include <Efl_Ui.h>
6
7static Efl_Ui_Widget*
8_item_add(Eo *box, const Efl_Class *c, int i)
9{
10 Eo *check, *rect, *il = efl_add(c, box);
11 int r = 0, g = 0, b = 0;
12 char buf[PATH_MAX];
13
14 snprintf(buf, sizeof(buf), "%d - Test %d", i, i%13);
15 efl_text_set(il, buf);
16
17 rect = efl_add(EFL_CANVAS_RECTANGLE_CLASS, evas_object_evas_get(il));
18 switch (i % 5)
19 {
20 case 0:
21 r = 255;
22 break;
23 case 1:
24 g = 255;
25 break;
26 case 2:
27 b = 255;
28 break;
29 case 3:
30 r = g = b = 255;
31 break;
32 case 4:
33 r = g = b = 0;
34 break;
35 }
36 efl_gfx_color_set(rect, r, g, b, 255);
37 efl_content_set(il, rect);
38
39 check = efl_add(EFL_UI_CHECK_CLASS, il);
40 efl_content_set(efl_part(il, "extra"), check);
41
42 if (c == EFL_UI_GRID_DEFAULT_ITEM_CLASS)
43 efl_gfx_hint_size_min_set(il, EINA_SIZE2D(100, 180));
44 else
45 efl_gfx_hint_size_min_set(il, EINA_SIZE2D(40, 40+(i%2)*40));
46
47 return il;
48}
49
50void test_efl_ui_item(void *data EINA_UNUSED,
51 Evas_Object *obj EINA_UNUSED,
52 void *event_info EINA_UNUSED)
53{
54 Eo *win, *box, *o;
55
56 win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
57 efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
58 efl_text_set(efl_added, "Item examples"),
59 efl_ui_win_autodel_set(efl_added, EINA_TRUE)
60 );
61
62 box = efl_add(EFL_UI_BOX_CLASS, win,
63 efl_content_set(win, efl_added));
64
65 o = _item_add(box, EFL_UI_GRID_DEFAULT_ITEM_CLASS, 1);
66 efl_pack_end(box, o);
67
68 o = _item_add(box, EFL_UI_GRID_DEFAULT_ITEM_CLASS, 2);
69 efl_ui_widget_disabled_set(o, EINA_TRUE);
70 efl_pack_end(box, o);
71
72 o = _item_add(box, EFL_UI_LIST_DEFAULT_ITEM_CLASS, 3);
73 efl_pack_end(box, o);
74
75 o = _item_add(box, EFL_UI_LIST_DEFAULT_ITEM_CLASS, 4);
76 efl_ui_widget_disabled_set(o, EINA_TRUE);
77 efl_pack_end(box, o);
78
79 o = efl_add(EFL_UI_LIST_PLACEHOLDER_ITEM_CLASS, box);
80 efl_gfx_hint_size_min_set(o, EINA_SIZE2D(40, 40+40));
81 efl_pack_end(box, o);
82
83 o = efl_add(EFL_UI_LIST_PLACEHOLDER_ITEM_CLASS, box);
84 efl_gfx_hint_size_min_set(o, EINA_SIZE2D(40, 40));
85 efl_ui_widget_disabled_set(o, EINA_TRUE);
86 efl_pack_end(box, o);
87}