upldate 1.7.10
[platform/upstream/expedite.git] / src / bin / widgets_file_icons_4.c
1 #undef FNAME
2 #undef NAME
3 #undef ICON
4
5 /* metadata */
6 #define FNAME widgets_file_icons_4_start
7 #define NAME "Widgets File Icons 4"
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 96
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 = eo_add(EVAS_IMAGE_CLASS, evas);
50         o_images[i] = o;
51         eo_do(o, efl_file_set(build_path(icons[i % 13]), NULL),
52                  efl_gfx_fill_set(0, 0, ICON_SIZE, ICON_SIZE),
53                  efl_gfx_size_set(ICON_SIZE, ICON_SIZE),
54                  efl_gfx_visible_set(EINA_TRUE));
55
56         o = eo_add(EVAS_TEXT_CLASS, evas);
57         o_texts[i] = o;
58         eo_do(o, efl_text_properties_font_set("Vera-Bold", 10),
59                  efl_text_set(icons[i % 13]),
60                  efl_gfx_color_set(0, 0, 0, 255),
61                  efl_gfx_visible_set(EINA_TRUE));
62      }
63    done = 0;
64 }
65
66 /* cleanup */
67 static void _cleanup(void)
68 {
69    int i;
70    for (i = 0; i < NUM; i++)
71      {
72         eo_del(o_images[i]);
73         eo_del(o_texts[i]);
74      }
75 }
76
77 /* loop - do things */
78 static void _loop(double t, int f)
79 {
80    int i;
81    Evas_Coord x, y, tw, th, cent;
82    x = 0;
83    y = 0 - f;
84    for (i = 0; i < NUM; i++)
85      {
86         eo_do(o_images[i], efl_gfx_position_set(x + 8, y));
87         eo_do(o_texts[i], efl_gfx_size_get(&tw, &th));
88         cent = (ICON_SIZE + 16 - tw) / 2;
89         eo_do(o_texts[i], efl_gfx_position_set(x + cent, y + ICON_SIZE + 4));
90         x += ICON_SIZE + 16;
91         if (x > win_w)
92           {
93              x = 0;
94              y += ICON_SIZE + 16;
95           }
96      }
97    FPS_STD(NAME);
98 }
99
100 /* prepend special key handlers if interactive (before STD) */
101 static void _key(char *key)
102 {
103    KEY_STD;
104 }
105
106
107
108
109
110
111
112
113
114
115
116
117 /* template stuff - ignore */
118 # endif
119 #endif
120
121 #ifdef UI
122 _ui_menu_item_add(ICON, NAME, FNAME);
123 #endif
124
125 #ifdef PROTO
126 void FNAME(void);
127 #endif
128
129 #ifndef PROTO
130 # ifndef UI
131 void FNAME(void)
132 {
133    ui_func_set(_key, _loop);
134    _setup();
135 }
136 # endif
137 #endif
138 #undef FNAME
139 #undef NAME
140 #undef ICON