diff options
author | Carsten Haitzler <raster@rasterman.com> | 2010-08-07 04:51:53 +0000 |
---|---|---|
committer | Carsten Haitzler <raster@rasterman.com> | 2010-08-07 04:51:53 +0000 |
commit | d1664bd1878b22a023d808fa3d8a65d58055a9f9 (patch) | |
tree | ab076f213f8a46f17a155f10d8fad457dd3a7f89 /src/bin/widgets_file_icons_2_same.c | |
parent | cf2eab4fe66d243d8e2e50aa34d73f776fce49ae (diff) |
tests++
SVN revision: 50887
Diffstat (limited to 'src/bin/widgets_file_icons_2_same.c')
-rw-r--r-- | src/bin/widgets_file_icons_2_same.c | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/src/bin/widgets_file_icons_2_same.c b/src/bin/widgets_file_icons_2_same.c new file mode 100644 index 0000000..47b9b48 --- /dev/null +++ b/src/bin/widgets_file_icons_2_same.c | |||
@@ -0,0 +1,124 @@ | |||
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 = evas_object_image_add(evas); | ||
35 | o_images[i] = o; | ||
36 | evas_object_image_file_set(o, build_path(icons[i % 1]), NULL); | ||
37 | evas_object_image_fill_set(o, 0, 0, ICON_SIZE, ICON_SIZE); | ||
38 | evas_object_resize(o, ICON_SIZE, ICON_SIZE); | ||
39 | evas_object_show(o); | ||
40 | |||
41 | o = evas_object_text_add(evas); | ||
42 | o_texts[i] = o; | ||
43 | evas_object_text_font_set(o, "Vera-Bold", 10); | ||
44 | evas_object_text_text_set(o, icons[i % 1]); | ||
45 | evas_object_color_set(o, 0, 0, 0, 255); | ||
46 | evas_object_show(o); | ||
47 | } | ||
48 | done = 0; | ||
49 | } | ||
50 | |||
51 | /* cleanup */ | ||
52 | static void _cleanup(void) | ||
53 | { | ||
54 | int i; | ||
55 | for (i = 0; i < NUM; i++) evas_object_del(o_images[i]); | ||
56 | for (i = 0; i < NUM; i++) evas_object_del(o_texts[i]); | ||
57 | } | ||
58 | |||
59 | /* loop - do things */ | ||
60 | static void _loop(double t, int f) | ||
61 | { | ||
62 | int i; | ||
63 | Evas_Coord x, y, w, h, tw, th, cent; | ||
64 | x = 0; | ||
65 | y = 0 - f; | ||
66 | w = ICON_SIZE; | ||
67 | h = ICON_SIZE; | ||
68 | for (i = 0; i < NUM; i++) | ||
69 | { | ||
70 | evas_object_move(o_images[i], x + 8, y); | ||
71 | evas_object_geometry_get(o_texts[i], NULL, NULL, &tw, &th); | ||
72 | cent = (ICON_SIZE + 16 - tw) / 2; | ||
73 | evas_object_move(o_texts[i], x + cent, y + ICON_SIZE + 4); | ||
74 | x += ICON_SIZE + 16; | ||
75 | if (x > win_w) | ||
76 | { | ||
77 | x = 0; | ||
78 | y += ICON_SIZE + 16; | ||
79 | } | ||
80 | } | ||
81 | FPS_STD(NAME); | ||
82 | } | ||
83 | |||
84 | /* prepend special key handlers if interactive (before STD) */ | ||
85 | static void _key(char *key) | ||
86 | { | ||
87 | KEY_STD; | ||
88 | } | ||
89 | |||
90 | |||
91 | |||
92 | |||
93 | |||
94 | |||
95 | |||
96 | |||
97 | |||
98 | |||
99 | |||
100 | |||
101 | /* template stuff - ignore */ | ||
102 | # endif | ||
103 | #endif | ||
104 | |||
105 | #ifdef UI | ||
106 | _ui_menu_item_add(ICON, NAME, FNAME); | ||
107 | #endif | ||
108 | |||
109 | #ifdef PROTO | ||
110 | void FNAME(void); | ||
111 | #endif | ||
112 | |||
113 | #ifndef PROTO | ||
114 | # ifndef UI | ||
115 | void FNAME(void) | ||
116 | { | ||
117 | ui_func_set(_key, _loop); | ||
118 | _setup(); | ||
119 | } | ||
120 | # endif | ||
121 | #endif | ||
122 | #undef FNAME | ||
123 | #undef NAME | ||
124 | #undef ICON | ||