Revert "Revert "expedite: fix for 5.5 compatibility.""
[platform/upstream/expedite.git] / src / bin / widgets_list_3_grouped.c
1 #undef FNAME
2 #undef NAME
3 #undef ICON
4
5 /* metadata */
6 #define FNAME widgets_list_3_grouped_start
7 #define NAME "Widgets List 3 Grouped"
8 #define ICON "widgets.png"
9
10 #ifndef PROTO
11 # ifndef UI
12 #  include "main.h"
13
14 /* standard var */
15 static int done = 0;
16 /* private data */
17 #define NUM 512
18 #define ICON_SIZE 64
19 static Evas_Object *o_images[NUM];
20 static Evas_Object *o_icons[NUM];
21 static Evas_Object *o_texts[NUM];
22
23 static const char *icons[] =
24 {
25    "bug.png",
26    "bulb.png",
27    "camera.png",
28    "colorbox.png",
29
30    "e.png",
31    "error.png",
32    "flower.png",
33    "house.png",
34
35    "mushroom.png",
36    "pulse.png",
37    "typewriter.png",
38    "warning.png",
39
40    "watch.png"
41 };
42
43 static const char *labels[] =
44 {
45    "Andrew",
46    "Alex",
47    "Amanda",
48    "Arthur",
49    "Astrid",
50    "Avery",
51
52    "Beethoven",
53    "Billy",
54    "Bob",
55    "Bundy",
56
57    "Candy",
58    "Carsten",
59
60    "Danny",
61    "Dennis",
62    "Dirk",
63    "Doug",
64
65    "Edmond",
66    "Erik",
67
68    "Fernando",
69    "Frank",
70    "Frederick",
71
72    "Gabby",
73    "George",
74    "Gilroy",
75    "Goodrich",
76    "Gumby",
77 };
78
79 /* setup */
80 static void _setup(void)
81 {
82    int i;
83    Evas_Object *o;
84    for (i = 0; i < NUM; i++)
85      {
86         o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas);
87         o_images[i] = o;
88         efl_gfx_image_border_insets_set(o, 2, 2, 2, 2);
89         efl_file_simple_load(o, build_path("pan.png"), NULL);
90         efl_gfx_entity_size_set(o, EINA_SIZE2D(win_w, ICON_SIZE));
91         efl_gfx_entity_visible_set(o, EINA_TRUE);
92
93         o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas);
94         o_icons[i] = o;
95         efl_gfx_image_border_insets_set(o, 2, 2, 2, 2);
96         efl_file_simple_load(o, build_path(icons[i % 13]), NULL);
97         efl_gfx_entity_size_set(o, EINA_SIZE2D(ICON_SIZE - 8, ICON_SIZE - 8));
98         efl_gfx_entity_visible_set(o, EINA_TRUE);
99
100         o = evas_object_text_add(evas);
101         o_texts[i] = o;
102 #if 0
103         efl_text_font_family_set(o, "Vera-Bold");
104         efl_text_font_size_set(o, 10);
105         efl_text_set(o, labels[i % 26]);
106 #else
107         evas_object_text_font_set(o, "Vera-Bold", 10);
108         evas_object_text_text_set(o, labels[i % 26]);
109 #endif
110         efl_gfx_color_set(o, 0, 0, 0, 255);
111         efl_gfx_entity_visible_set(o, EINA_TRUE);
112      }
113    for (i = 0; i < NUM; i++)
114      {
115         efl_gfx_stack_raise_to_top(o_images[i]);
116      }
117    for (i = 0; i < NUM; i++)
118      {
119         efl_gfx_stack_raise_to_top(o_icons[i]);
120      }
121    for (i = 0; i < NUM; i++)
122      {
123         if (i > 13)
124           efl_gfx_stack_above(o_icons[i], o_icons[i - 13]);
125      }
126    for (i = 0; i < NUM; i++)
127      {
128         efl_gfx_stack_raise_to_top(o_texts[i]);
129      }
130    done = 0;
131 }
132
133 /* cleanup */
134 static void _cleanup(void)
135 {
136    int i;
137    for (i = 0; i < NUM; i++)
138      {
139         efl_del(o_images[i]);
140         efl_del(o_icons[i]);
141         efl_del(o_texts[i]);
142      }
143 }
144
145 /* loop - do things */
146 static void _loop(double t, int f)
147 {
148    int i;
149    Evas_Coord x, y, tw, th, cent;
150    x = 0;
151    y = 0 - f;
152    for (i = 0; i < NUM; i++)
153      {
154         efl_gfx_entity_position_set(o_images[i], EINA_POSITION2D(x, y));
155         efl_gfx_entity_position_set(o_icons[i], EINA_POSITION2D(x + 4, y + 4));
156         exp_size_get(o_texts[i], &tw, &th);
157         cent = (ICON_SIZE - th) / 2;
158         efl_gfx_entity_position_set(o_texts[i], EINA_POSITION2D(x + 8 + ICON_SIZE + 8, y + cent));
159         y += ICON_SIZE;
160      }
161    FPS_STD(NAME);
162 }
163
164 /* prepend special key handlers if interactive (before STD) */
165 static void _key(const char *key)
166 {
167    KEY_STD;
168 }
169
170
171
172
173
174
175
176
177
178
179
180
181 /* template stuff - ignore */
182 # endif
183 #endif
184
185 #ifdef UI
186 _ui_menu_item_add(ICON, NAME, FNAME);
187 #endif
188
189 #ifdef PROTO
190 void FNAME(void);
191 #endif
192
193 #ifndef PROTO
194 # ifndef UI
195 void FNAME(void)
196 {
197    _setup();
198    ui_func_set(_key, _loop);
199 }
200 # endif
201 #endif
202 #undef FNAME
203 #undef NAME
204 #undef ICON