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