Revert "Revert "Setup before starting fps measurement""
[platform/upstream/expedite.git] / src / bin / widgets_list_1.c
1 #undef FNAME
2 #undef NAME
3 #undef ICON
4
5 /* metadata */
6 #define FNAME widgets_list_1_start
7 #define NAME "Widgets List"
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_texts[NUM];
21
22 static const char *labels[] =
23 {
24    "Andrew",
25    "Alex",
26    "Amanda",
27    "Arthur",
28    "Astrid",
29    "Avery",
30
31    "Beethoven",
32    "Billy",
33    "Bob",
34    "Bundy",
35
36    "Candy",
37    "Carsten",
38
39    "Danny",
40    "Dennis",
41    "Dirk",
42    "Doug",
43
44    "Edmond",
45    "Erik",
46
47    "Fernando",
48    "Frank",
49    "Frederick",
50
51    "Gabby",
52    "George",
53    "Gilroy",
54    "Goodrich",
55    "Gumby",
56 };
57
58 /* setup */
59 static void _setup(void)
60 {
61    int i;
62    Evas_Object *o;
63    for (i = 0; i < NUM; i++)
64      {
65         o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas);
66         o_images[i] = o;
67         efl_gfx_image_border_insets_set(o, 2, 2, 2, 2);
68         efl_file_simple_load(o, build_path("pan.png"), NULL);
69         efl_gfx_entity_size_set(o, EINA_SIZE2D(win_w, ICON_SIZE));
70         efl_gfx_entity_visible_set(o, EINA_TRUE);
71
72         o = evas_object_text_add(evas);
73         o_texts[i] = o;
74 #if 0
75         efl_text_font_family_set(o, "Vera-Bold");
76         efl_text_font_size_set(o, 10);
77         efl_text_set(o, labels[i % 26]);
78 #else
79         evas_object_text_font_set(o, "Vera-Bold", 10);
80         evas_object_text_text_set(o, labels[i % 26]);
81 #endif
82         efl_gfx_color_set(o, 0, 0, 0, 255);
83         efl_gfx_entity_visible_set(o, EINA_TRUE);
84      }
85    done = 0;
86 }
87
88 /* cleanup */
89 static void _cleanup(void)
90 {
91    int i;
92    for (i = 0; i < NUM; i++)
93      {
94         efl_del(o_images[i]);
95         efl_del(o_texts[i]);
96      }
97 }
98
99 /* loop - do things */
100 static void _loop(double t, int f)
101 {
102    int i;
103    Evas_Coord x, y, tw, th, cent;
104    x = 0;
105    y = 0 - f;
106    for (i = 0; i < NUM; i++)
107      {
108         efl_gfx_entity_position_set(o_images[i], EINA_POSITION2D(x, y));
109         exp_size_get(o_texts[i], &tw, &th);
110         cent = (ICON_SIZE - th) / 2;
111         efl_gfx_entity_position_set(o_texts[i], EINA_POSITION2D(x + 8, y + cent));
112         y += ICON_SIZE;
113      }
114    FPS_STD(NAME);
115 }
116
117 /* prepend special key handlers if interactive (before STD) */
118 static void _key(const char *key)
119 {
120    KEY_STD;
121 }
122
123
124
125
126
127
128
129
130
131
132
133
134 /* template stuff - ignore */
135 # endif
136 #endif
137
138 #ifdef UI
139 _ui_menu_item_add(ICON, NAME, FNAME);
140 #endif
141
142 #ifdef PROTO
143 void FNAME(void);
144 #endif
145
146 #ifndef PROTO
147 # ifndef UI
148 void FNAME(void)
149 {
150    _setup();
151    ui_func_set(_key, _loop);
152 }
153 # endif
154 #endif
155 #undef FNAME
156 #undef NAME
157 #undef ICON