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