Imported Upstream version 1.7.1
[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 = evas_object_image_add(evas);
50         o_images[i] = o;
51         evas_object_image_file_set(o, build_path(icons[i % 13]), NULL);
52         evas_object_image_fill_set(o, 0, 0, ICON_SIZE, ICON_SIZE);
53         evas_object_resize(o, ICON_SIZE, ICON_SIZE);
54         evas_object_show(o);
55         
56         o = evas_object_text_add(evas);
57         o_texts[i] = o;
58         evas_object_text_font_set(o, "Vera-Bold", 10);
59         evas_object_text_text_set(o, icons[i % 13]);
60         evas_object_text_style_set(o, EVAS_TEXT_STYLE_FAR_SOFT_SHADOW);
61         evas_object_color_set(o, 255, 255, 255, 255);
62         evas_object_text_shadow_color_set(o, 0, 0, 0, 24);
63         evas_object_show(o);
64      }
65    done = 0;
66 }
67
68 /* cleanup */
69 static void _cleanup(void)
70 {
71    int i;
72    for (i = 0; i < NUM; i++) evas_object_del(o_images[i]);
73    for (i = 0; i < NUM; i++) evas_object_del(o_texts[i]);
74 }
75
76 /* loop - do things */
77 static void _loop(double t, int f)
78 {
79    int i;
80    Evas_Coord x, y, tw, th, cent;
81    x = 0;
82    y = 0 - f;
83    for (i = 0; i < NUM; i++)
84      {
85         evas_object_move(o_images[i], x + 8, y);
86         evas_object_geometry_get(o_texts[i], NULL, NULL, &tw, &th);
87         cent = (ICON_SIZE + 16 - tw) / 2;
88         evas_object_move(o_texts[i], x + cent, y + ICON_SIZE + 4);
89         x += ICON_SIZE + 16;
90         if (x > win_w)
91           {
92              x = 0;
93              y += ICON_SIZE + 16;
94           }
95      }
96    FPS_STD(NAME);
97 }
98
99 /* prepend special key handlers if interactive (before STD) */
100 static void _key(char *key)
101 {
102    KEY_STD;
103 }
104
105
106
107
108
109
110
111
112
113
114
115
116 /* template stuff - ignore */
117 # endif
118 #endif
119
120 #ifdef UI
121 _ui_menu_item_add(ICON, NAME, FNAME);
122 #endif
123
124 #ifdef PROTO
125 void FNAME(void);
126 #endif
127
128 #ifndef PROTO
129 # ifndef UI
130 void FNAME(void)
131 {
132    ui_func_set(_key, _loop);
133    _setup();
134 }
135 # endif
136 #endif
137 #undef FNAME
138 #undef NAME
139 #undef ICON