Revert "Revert "Setup before starting fps measurement""
[platform/upstream/expedite.git] / src / bin / widgets_file_icons_2_same.c
1 #undef FNAME
2 #undef NAME
3 #undef ICON
4
5 /* metadata */
6 #define FNAME widgets_file_icons_2_same_start
7 #define NAME "Widgets File Icons 2 Same"
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 *icons[] = 
23 {
24    "e.png",
25 };
26
27 /* setup */
28 static void _setup(void)
29 {
30    int i;
31    Evas_Object *o;
32    for (i = 0; i < NUM; i++)
33      {
34         o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas);
35         o_images[i] = o;
36         efl_file_simple_load(o, build_path(icons[i % 1]), NULL);
37         efl_gfx_fill_set(o, EINA_RECT(0, 0, ICON_SIZE, ICON_SIZE));
38         efl_gfx_entity_size_set(o, EINA_SIZE2D(ICON_SIZE, ICON_SIZE));
39         efl_gfx_entity_visible_set(o, EINA_TRUE);
40
41         o = evas_object_text_add(evas);
42         o_texts[i] = o;
43 #if 0
44         efl_text_font_family_set(o, "Vera-Bold");
45         efl_text_font_size_set(o, 10);
46         efl_text_set(o, icons[i % 1]);
47 #else
48         evas_object_text_font_set(o, "Vera-Bold", 10);
49         evas_object_text_text_set(o, icons[i % 1]);
50 #endif
51         efl_gfx_color_set(o, 0, 0, 0, 255);
52         efl_gfx_entity_visible_set(o, EINA_TRUE);
53      }
54    done = 0;
55 }
56
57 /* cleanup */
58 static void _cleanup(void)
59 {
60    int i;
61    for (i = 0; i < NUM; i++)
62      {
63         efl_del(o_images[i]);
64         efl_del(o_texts[i]);
65      }
66 }
67
68 /* loop - do things */
69 static void _loop(double t, int f)
70 {
71    int i;
72    Evas_Coord x, y, tw, th, cent;
73    x = 0;
74    y = 0 - f;
75    for (i = 0; i < NUM; i++)
76      {
77         efl_gfx_entity_position_set(o_images[i], EINA_POSITION2D(x + 8, y));
78         exp_size_get(o_texts[i], &tw, &th);
79         cent = (ICON_SIZE + 16 - tw) / 2;
80         efl_gfx_entity_position_set(o_texts[i], EINA_POSITION2D(x + cent, y + ICON_SIZE + 4));
81         x += ICON_SIZE + 16;
82         if (x > win_w)
83           {
84              x = 0;
85              y += ICON_SIZE + 16;
86           }
87      }
88    FPS_STD(NAME);
89 }
90
91 /* prepend special key handlers if interactive (before STD) */
92 static void _key(const char *key)
93 {
94    KEY_STD;
95 }
96
97
98
99
100
101
102
103
104
105
106
107
108 /* template stuff - ignore */
109 # endif
110 #endif
111
112 #ifdef UI
113 _ui_menu_item_add(ICON, NAME, FNAME);
114 #endif
115
116 #ifdef PROTO
117 void FNAME(void);
118 #endif
119
120 #ifndef PROTO
121 # ifndef UI
122 void FNAME(void)
123 {
124    _setup();
125    ui_func_set(_key, _loop);
126 }
127 # endif
128 #endif
129 #undef FNAME
130 #undef NAME
131 #undef ICON