a2f0fa474125e081d7f61a4616cac7d5c1e78abf
[platform/upstream/expedite.git] / src / bin / widgets_list_1.c
1 #undef FNAME
2 #undef NAME
3 #undef ICON
4
5 /* metadata */
6 #define FNAME widgets_list_1_start
7 #define NAME "Widgets List"
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 *labels[] =
23 {
24    "Andrew",
25    "Alex",
26    "Amanda",
27    "Arthur",
28    "Astrid",
29    "Avery",
30
31    "Beethoven",
32    "Billy",
33    "Bob",
34    "Bundy",
35
36    "Candy",
37    "Carsten",
38
39    "Danny",
40    "Dennis",
41    "Dirk",
42    "Doug",
43
44    "Edmond",
45    "Erik",
46
47    "Fernando",
48    "Frank",
49    "Frederick",
50
51    "Gabby",
52    "George",
53    "Gilroy",
54    "Goodrich",
55    "Gumby",
56 };
57
58 /* setup */
59 static void _setup(void)
60 {
61    int i;
62    Evas_Object *o;
63    for (i = 0; i < NUM; i++)
64      {
65         o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas);
66         o_images[i] = o;
67         efl_gfx_image_border_insets_set(o, 2, 2, 2, 2);
68         efl_file_simple_load(o, build_path("pan.png"), NULL);
69         efl_gfx_entity_size_set(o, EINA_SIZE2D(win_w, ICON_SIZE));
70         efl_gfx_entity_visible_set(o, EINA_TRUE);
71
72         o = evas_object_text_add(evas);
73         o_texts[i] = o;
74         efl_text_font_family_set(o, "Vera-Bold");
75         efl_text_font_size_set(o, 10);
76         efl_text_set(o, labels[i % 26]);
77         efl_gfx_color_set(o, 0, 0, 0, 255);
78         efl_gfx_entity_visible_set(o, EINA_TRUE);
79      }
80    done = 0;
81 }
82
83 /* cleanup */
84 static void _cleanup(void)
85 {
86    int i;
87    for (i = 0; i < NUM; i++)
88      {
89         efl_del(o_images[i]);
90         efl_del(o_texts[i]);
91      }
92 }
93
94 /* loop - do things */
95 static void _loop(double t, int f)
96 {
97    int i;
98    Evas_Coord x, y, tw, th, cent;
99    x = 0;
100    y = 0 - f;
101    for (i = 0; i < NUM; i++)
102      {
103         efl_gfx_entity_position_set(o_images[i], EINA_POSITION2D(x, y));
104         exp_size_get(o_texts[i], &tw, &th);
105         cent = (ICON_SIZE - th) / 2;
106         efl_gfx_entity_position_set(o_texts[i], EINA_POSITION2D(x + 8, y + cent));
107         y += ICON_SIZE;
108      }
109    FPS_STD(NAME);
110 }
111
112 /* prepend special key handlers if interactive (before STD) */
113 static void _key(const char *key)
114 {
115    KEY_STD;
116 }
117
118
119
120
121
122
123
124
125
126
127
128
129 /* template stuff - ignore */
130 # endif
131 #endif
132
133 #ifdef UI
134 _ui_menu_item_add(ICON, NAME, FNAME);
135 #endif
136
137 #ifdef PROTO
138 void FNAME(void);
139 #endif
140
141 #ifndef PROTO
142 # ifndef UI
143 void FNAME(void)
144 {
145    _setup();
146    ui_func_set(_key, _loop);
147 }
148 # endif
149 #endif
150 #undef FNAME
151 #undef NAME
152 #undef ICON