containing ui setup steps in the profiling again.
[platform/upstream/expedite.git] / src / bin / widgets_list_4_grouped.c
1 #undef FNAME
2 #undef NAME
3 #undef ICON
4
5 /* metadata */
6 #define FNAME widgets_list_4_grouped_start
7 #define NAME "Widgets List 4 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 32
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         efl_gfx_stack_above(o_icons[i], o_icons[i - 13]);
124      }
125    for (i = 0; i < NUM; i++)
126      {
127         efl_gfx_stack_raise_to_top(o_texts[i]);
128      }
129    done = 0;
130 }
131
132 /* cleanup */
133 static void _cleanup(void)
134 {
135    int i;
136    for (i = 0; i < NUM; i++)
137      {
138         efl_del(o_images[i]);
139         efl_del(o_icons[i]);
140         efl_del(o_texts[i]);
141      }
142 }
143
144 /* loop - do things */
145 static void _loop(double t, int f)
146 {
147    int i;
148    Evas_Coord x, y, tw, th, cent;
149    x = 0;
150    y = 0 - f;
151    for (i = 0; i < NUM; i++)
152      {
153         efl_gfx_entity_position_set(o_images[i], EINA_POSITION2D(x, y));
154         efl_gfx_entity_position_set(o_icons[i], EINA_POSITION2D(x + 4, y + 4));
155         exp_size_get(o_texts[i], &tw, &th);
156         cent = (ICON_SIZE - th) / 2;
157         efl_gfx_entity_position_set(o_texts[i], EINA_POSITION2D(x + 8 + ICON_SIZE + 8, y + cent));
158         y += ICON_SIZE;
159      }
160    FPS_STD(NAME);
161 }
162
163 /* prepend special key handlers if interactive (before STD) */
164 static void _key(const char *key)
165 {
166    KEY_STD;
167 }
168
169
170
171
172
173
174
175
176
177
178
179
180 /* template stuff - ignore */
181 # endif
182 #endif
183
184 #ifdef UI
185 _ui_menu_item_add(ICON, NAME, FNAME);
186 #endif
187
188 #ifdef PROTO
189 void FNAME(void);
190 #endif
191
192 #ifndef PROTO
193 # ifndef UI
194 void FNAME(void)
195 {
196    ui_func_set(_key, _loop, _setup);
197 }
198 # endif
199 #endif
200 #undef FNAME
201 #undef NAME
202 #undef ICON