diff options
Diffstat (limited to 'libraries/elementary/src/bin/test_flip.c')
-rw-r--r-- | libraries/elementary/src/bin/test_flip.c | 610 |
1 files changed, 610 insertions, 0 deletions
diff --git a/libraries/elementary/src/bin/test_flip.c b/libraries/elementary/src/bin/test_flip.c new file mode 100644 index 0000000..20d4e49 --- /dev/null +++ b/libraries/elementary/src/bin/test_flip.c | |||
@@ -0,0 +1,610 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include "elementary_config.h" | ||
3 | #endif | ||
4 | #include <Elementary.h> | ||
5 | #ifndef ELM_LIB_QUICKLAUNCH | ||
6 | |||
7 | void | ||
8 | my_fl_1(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
9 | { | ||
10 | Evas_Object *fl = data; | ||
11 | elm_flip_go(fl, ELM_FLIP_ROTATE_Y_CENTER_AXIS); | ||
12 | } | ||
13 | |||
14 | void | ||
15 | my_fl_2(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
16 | { | ||
17 | Evas_Object *fl = data; | ||
18 | elm_flip_go(fl, ELM_FLIP_ROTATE_X_CENTER_AXIS); | ||
19 | } | ||
20 | |||
21 | void | ||
22 | my_fl_3(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
23 | { | ||
24 | Evas_Object *fl = data; | ||
25 | elm_flip_go(fl, ELM_FLIP_ROTATE_XZ_CENTER_AXIS); | ||
26 | } | ||
27 | |||
28 | void | ||
29 | my_fl_4(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
30 | { | ||
31 | Evas_Object *fl = data; | ||
32 | elm_flip_go(fl, ELM_FLIP_ROTATE_YZ_CENTER_AXIS); | ||
33 | } | ||
34 | |||
35 | void | ||
36 | my_fl_5(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
37 | { | ||
38 | Evas_Object *fl = data; | ||
39 | elm_flip_go(fl, ELM_FLIP_CUBE_LEFT); | ||
40 | } | ||
41 | |||
42 | void | ||
43 | my_fl_6(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
44 | { | ||
45 | Evas_Object *fl = data; | ||
46 | elm_flip_go(fl, ELM_FLIP_CUBE_RIGHT); | ||
47 | } | ||
48 | |||
49 | void | ||
50 | my_fl_7(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
51 | { | ||
52 | Evas_Object *fl = data; | ||
53 | elm_flip_go(fl, ELM_FLIP_CUBE_UP); | ||
54 | } | ||
55 | |||
56 | void | ||
57 | my_fl_8(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
58 | { | ||
59 | Evas_Object *fl = data; | ||
60 | elm_flip_go(fl, ELM_FLIP_CUBE_DOWN); | ||
61 | } | ||
62 | |||
63 | void | ||
64 | test_flip(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
65 | { | ||
66 | Evas_Object *win, *bx, *bx2, *fl, *o, *bt, *ly; | ||
67 | char buf[PATH_MAX]; | ||
68 | |||
69 | win = elm_win_util_standard_add("flip", "Flip"); | ||
70 | elm_win_focus_highlight_enabled_set(win, EINA_TRUE); | ||
71 | elm_win_autodel_set(win, EINA_TRUE); | ||
72 | |||
73 | bx = elm_box_add(win); | ||
74 | evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
75 | elm_win_resize_object_add(win, bx); | ||
76 | evas_object_show(bx); | ||
77 | |||
78 | fl = elm_flip_add(win); | ||
79 | evas_object_size_hint_align_set(fl, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
80 | evas_object_size_hint_weight_set(fl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
81 | elm_box_pack_end(bx, fl); | ||
82 | |||
83 | o = elm_bg_add(win); | ||
84 | evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
85 | evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
86 | snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), "sky_01.jpg"); | ||
87 | elm_bg_file_set(o, buf, NULL); | ||
88 | elm_object_part_content_set(fl, "front", o); | ||
89 | evas_object_show(o); | ||
90 | |||
91 | ly = elm_layout_add(win); | ||
92 | snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get()); | ||
93 | elm_layout_file_set(ly, buf, "layout"); | ||
94 | evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
95 | evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
96 | elm_object_part_content_set(fl, "back", ly); | ||
97 | evas_object_show(ly); | ||
98 | |||
99 | bt = elm_button_add(ly); | ||
100 | elm_object_text_set(bt, "Button 1"); | ||
101 | elm_object_part_content_set(ly, "element1", bt); | ||
102 | |||
103 | bt = elm_button_add(ly); | ||
104 | elm_object_text_set(bt, "Button 2"); | ||
105 | elm_object_part_content_set(ly, "element2", bt); | ||
106 | |||
107 | bt = elm_button_add(ly); | ||
108 | elm_object_text_set(bt, "Button 3"); | ||
109 | elm_object_part_content_set(ly, "element3", bt); | ||
110 | |||
111 | evas_object_show(fl); | ||
112 | |||
113 | bx2 = elm_box_add(win); | ||
114 | elm_box_horizontal_set(bx2, EINA_TRUE); | ||
115 | evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
116 | evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); | ||
117 | |||
118 | bt = elm_button_add(win); | ||
119 | elm_object_text_set(bt, "1"); | ||
120 | evas_object_smart_callback_add(bt, "clicked", my_fl_1, fl); | ||
121 | evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
122 | evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); | ||
123 | elm_box_pack_end(bx2, bt); | ||
124 | evas_object_show(bt); | ||
125 | |||
126 | bt = elm_button_add(win); | ||
127 | elm_object_text_set(bt, "2"); | ||
128 | evas_object_smart_callback_add(bt, "clicked", my_fl_2, fl); | ||
129 | evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
130 | evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); | ||
131 | elm_box_pack_end(bx2, bt); | ||
132 | evas_object_show(bt); | ||
133 | |||
134 | bt = elm_button_add(win); | ||
135 | elm_object_text_set(bt, "3"); | ||
136 | evas_object_smart_callback_add(bt, "clicked", my_fl_3, fl); | ||
137 | evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
138 | evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); | ||
139 | elm_box_pack_end(bx2, bt); | ||
140 | evas_object_show(bt); | ||
141 | |||
142 | bt = elm_button_add(win); | ||
143 | elm_object_text_set(bt, "4"); | ||
144 | evas_object_smart_callback_add(bt, "clicked", my_fl_4, fl); | ||
145 | evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
146 | evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); | ||
147 | elm_box_pack_end(bx2, bt); | ||
148 | evas_object_show(bt); | ||
149 | |||
150 | elm_box_pack_end(bx, bx2); | ||
151 | evas_object_show(bx2); | ||
152 | |||
153 | bx2 = elm_box_add(win); | ||
154 | elm_box_horizontal_set(bx2, EINA_TRUE); | ||
155 | evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
156 | evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); | ||
157 | |||
158 | bt = elm_button_add(win); | ||
159 | elm_object_text_set(bt, "5"); | ||
160 | evas_object_smart_callback_add(bt, "clicked", my_fl_5, fl); | ||
161 | evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
162 | evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); | ||
163 | elm_box_pack_end(bx2, bt); | ||
164 | evas_object_show(bt); | ||
165 | |||
166 | bt = elm_button_add(win); | ||
167 | elm_object_text_set(bt, "6"); | ||
168 | evas_object_smart_callback_add(bt, "clicked", my_fl_6, fl); | ||
169 | evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
170 | evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); | ||
171 | elm_box_pack_end(bx2, bt); | ||
172 | evas_object_show(bt); | ||
173 | |||
174 | bt = elm_button_add(win); | ||
175 | elm_object_text_set(bt, "7"); | ||
176 | evas_object_smart_callback_add(bt, "clicked", my_fl_7, fl); | ||
177 | evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
178 | evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); | ||
179 | elm_box_pack_end(bx2, bt); | ||
180 | evas_object_show(bt); | ||
181 | |||
182 | bt = elm_button_add(win); | ||
183 | elm_object_text_set(bt, "8"); | ||
184 | evas_object_smart_callback_add(bt, "clicked", my_fl_8, fl); | ||
185 | evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
186 | evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); | ||
187 | elm_box_pack_end(bx2, bt); | ||
188 | evas_object_show(bt); | ||
189 | |||
190 | elm_box_pack_end(bx, bx2); | ||
191 | evas_object_show(bx2); | ||
192 | |||
193 | evas_object_resize(win, 320, 480); | ||
194 | evas_object_show(win); | ||
195 | } | ||
196 | |||
197 | void | ||
198 | test_flip2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
199 | { | ||
200 | Evas_Object *win, *bg, *bx, *bx2, *fl, *o, *bt, *tb, *li, *en; | ||
201 | char buf[PATH_MAX]; | ||
202 | |||
203 | win = elm_win_add(NULL, "flip2", ELM_WIN_BASIC); | ||
204 | elm_win_title_set(win, "Flip 2"); | ||
205 | elm_win_autodel_set(win, EINA_TRUE); | ||
206 | |||
207 | bg = elm_bg_add(win); | ||
208 | snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), "sky_01.jpg"); | ||
209 | elm_bg_file_set(bg, buf, NULL); | ||
210 | elm_win_resize_object_add(win, bg); | ||
211 | evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
212 | evas_object_show(bg); | ||
213 | |||
214 | bx = elm_box_add(win); | ||
215 | evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
216 | elm_win_resize_object_add(win, bx); | ||
217 | evas_object_show(bx); | ||
218 | |||
219 | fl = elm_flip_add(win); | ||
220 | evas_object_size_hint_align_set(fl, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
221 | evas_object_size_hint_weight_set(fl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
222 | elm_box_pack_end(bx, fl); | ||
223 | |||
224 | o = elm_box_add(win); | ||
225 | evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
226 | evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
227 | |||
228 | tb = elm_toolbar_add(win); | ||
229 | elm_toolbar_homogeneous_set(tb, 0); | ||
230 | evas_object_size_hint_weight_set(tb, 0.0, 0.0); | ||
231 | evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0); | ||
232 | |||
233 | elm_toolbar_item_append(tb, "arrow_left", "Hello", NULL, NULL); | ||
234 | elm_toolbar_item_append(tb, "arrow_right", "Out", NULL, NULL); | ||
235 | elm_toolbar_item_append(tb, "home", "There", NULL, NULL); | ||
236 | elm_toolbar_item_append(tb, "refresh", "World", NULL, NULL); | ||
237 | |||
238 | elm_box_pack_end(o, tb); | ||
239 | evas_object_show(tb); | ||
240 | |||
241 | li = elm_list_add(win); | ||
242 | evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
243 | evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
244 | |||
245 | elm_list_item_append(li, "This is a list", NULL, NULL, NULL, NULL); | ||
246 | elm_list_item_append(li, "Second item", NULL, NULL, NULL, NULL); | ||
247 | elm_list_item_append(li, "3rd", NULL, NULL, NULL, NULL); | ||
248 | elm_list_item_append(li, "Fourth", NULL, NULL, NULL, NULL); | ||
249 | elm_list_item_append(li, "Number five is alive!", NULL, NULL, NULL, NULL); | ||
250 | elm_list_item_append(li, "The quick brown fox jumps over the lazy dog", NULL, NULL, NULL, NULL); | ||
251 | elm_list_item_append(li, "Booyah", NULL, NULL, NULL, NULL); | ||
252 | elm_list_item_append(li, "And another item", NULL, NULL, NULL, NULL); | ||
253 | elm_list_item_append(li, "More of them", NULL, NULL, NULL, NULL); | ||
254 | elm_list_item_append(li, "Get with it", NULL, NULL, NULL, NULL); | ||
255 | |||
256 | elm_list_go(li); | ||
257 | |||
258 | elm_box_pack_end(o, li); | ||
259 | evas_object_show(li); | ||
260 | |||
261 | elm_object_part_content_set(fl, "front", o); | ||
262 | evas_object_show(o); | ||
263 | |||
264 | en = elm_entry_add(win); | ||
265 | elm_entry_scrollable_set(en, EINA_TRUE); | ||
266 | elm_entry_line_wrap_set(en, ELM_WRAP_NONE); | ||
267 | snprintf(buf, sizeof(buf), | ||
268 | "This is an entry widget in this window that<br/>" | ||
269 | "uses markup <b>like this</> for styling and<br/>" | ||
270 | "formatting <em>like this</>, as well as<br/>" | ||
271 | "<a href=X><link>links in the text</></a>, so enter text<br/>" | ||
272 | "in here to edit it. By the way, links are<br/>" | ||
273 | "called <a href=anc-02>Anchors</a> so you will need<br/>" | ||
274 | "to refer to them this way.<br/>" | ||
275 | "<br/>" | ||
276 | |||
277 | "Also you can stick in items with (relsize + ascent): " | ||
278 | "<item relsize=16x16 vsize=ascent href=emoticon/evil-laugh></item>" | ||
279 | " (full) " | ||
280 | "<item relsize=16x16 vsize=full href=emoticon/guilty-smile></item>" | ||
281 | " (to the left)<br/>" | ||
282 | |||
283 | "Also (size + ascent): " | ||
284 | "<item size=16x16 vsize=ascent href=emoticon/haha></item>" | ||
285 | " (full) " | ||
286 | "<item size=16x16 vsize=full href=emoticon/happy-panting></item>" | ||
287 | " (before this)<br/>" | ||
288 | |||
289 | "And as well (absize + ascent): " | ||
290 | "<item absize=64x64 vsize=ascent href=emoticon/knowing-grin></item>" | ||
291 | " (full) " | ||
292 | "<item absize=64x64 vsize=full href=emoticon/not-impressed></item>" | ||
293 | " or even paths to image files on disk too like: " | ||
294 | "<item absize=96x128 vsize=full href=file://%s/images/sky_01.jpg></item>" | ||
295 | " ... end." | ||
296 | , elm_app_data_dir_get() | ||
297 | ); | ||
298 | elm_object_text_set(en, buf); | ||
299 | evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
300 | evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
301 | |||
302 | elm_object_part_content_set(fl, "back", en); | ||
303 | evas_object_show(en); | ||
304 | |||
305 | evas_object_show(fl); | ||
306 | |||
307 | bx2 = elm_box_add(win); | ||
308 | elm_box_horizontal_set(bx2, EINA_TRUE); | ||
309 | evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
310 | evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); | ||
311 | |||
312 | bt = elm_button_add(win); | ||
313 | elm_object_text_set(bt, "1"); | ||
314 | evas_object_smart_callback_add(bt, "clicked", my_fl_1, fl); | ||
315 | evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
316 | evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); | ||
317 | elm_box_pack_end(bx2, bt); | ||
318 | evas_object_show(bt); | ||
319 | |||
320 | bt = elm_button_add(win); | ||
321 | elm_object_text_set(bt, "2"); | ||
322 | evas_object_smart_callback_add(bt, "clicked", my_fl_2, fl); | ||
323 | evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
324 | evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); | ||
325 | elm_box_pack_end(bx2, bt); | ||
326 | evas_object_show(bt); | ||
327 | |||
328 | bt = elm_button_add(win); | ||
329 | elm_object_text_set(bt, "3"); | ||
330 | evas_object_smart_callback_add(bt, "clicked", my_fl_3, fl); | ||
331 | evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
332 | evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); | ||
333 | elm_box_pack_end(bx2, bt); | ||
334 | evas_object_show(bt); | ||
335 | |||
336 | bt = elm_button_add(win); | ||
337 | elm_object_text_set(bt, "4"); | ||
338 | evas_object_smart_callback_add(bt, "clicked", my_fl_4, fl); | ||
339 | evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
340 | evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); | ||
341 | elm_box_pack_end(bx2, bt); | ||
342 | evas_object_show(bt); | ||
343 | |||
344 | bt = elm_button_add(win); | ||
345 | elm_object_text_set(bt, "5"); | ||
346 | evas_object_smart_callback_add(bt, "clicked", my_fl_5, fl); | ||
347 | evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
348 | evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); | ||
349 | elm_box_pack_end(bx2, bt); | ||
350 | evas_object_show(bt); | ||
351 | |||
352 | bt = elm_button_add(win); | ||
353 | elm_object_text_set(bt, "6"); | ||
354 | evas_object_smart_callback_add(bt, "clicked", my_fl_6, fl); | ||
355 | evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
356 | evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); | ||
357 | elm_box_pack_end(bx2, bt); | ||
358 | evas_object_show(bt); | ||
359 | |||
360 | elm_box_pack_end(bx, bx2); | ||
361 | evas_object_show(bx2); | ||
362 | |||
363 | evas_object_resize(win, 320, 480); | ||
364 | evas_object_show(win); | ||
365 | } | ||
366 | |||
367 | void | ||
368 | test_flip3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
369 | { | ||
370 | Evas_Object *win, *bx, *bx2, *fl, *fl_f, *fl_b, *o, *bt, *fr; | ||
371 | char buf[PATH_MAX]; | ||
372 | |||
373 | win = elm_win_util_standard_add("flip3", "Flip Flip"); | ||
374 | elm_win_autodel_set(win, EINA_TRUE); | ||
375 | |||
376 | bx = elm_box_add(win); | ||
377 | evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
378 | elm_win_resize_object_add(win, bx); | ||
379 | evas_object_show(bx); | ||
380 | |||
381 | fl = elm_flip_add(win); | ||
382 | evas_object_size_hint_align_set(fl, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
383 | evas_object_size_hint_weight_set(fl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
384 | elm_box_pack_end(bx, fl); | ||
385 | evas_object_show(fl); | ||
386 | |||
387 | fr = elm_frame_add(win); | ||
388 | elm_object_text_set(fr, "Front"); | ||
389 | evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
390 | evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
391 | elm_object_part_content_set(fl, "front", fr); | ||
392 | evas_object_show(fr); | ||
393 | |||
394 | fl_f = elm_flip_add(win); | ||
395 | evas_object_size_hint_align_set(fl_f, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
396 | evas_object_size_hint_weight_set(fl_f, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
397 | elm_object_content_set(fr, fl_f); | ||
398 | evas_object_show(fl_f); | ||
399 | |||
400 | o = elm_bg_add(win); | ||
401 | evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
402 | evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
403 | snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), "sky_01.jpg"); | ||
404 | elm_bg_file_set(o, buf, NULL); | ||
405 | elm_object_part_content_set(fl_f, "front", o); | ||
406 | evas_object_show(o); | ||
407 | |||
408 | o = elm_bg_add(win); | ||
409 | evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
410 | evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
411 | snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), "sky_02.jpg"); | ||
412 | elm_bg_file_set(o, buf, NULL); | ||
413 | elm_object_part_content_set(fl_f, "back", o); | ||
414 | evas_object_show(o); | ||
415 | |||
416 | fr = elm_frame_add(win); | ||
417 | elm_object_text_set(fr, "Back"); | ||
418 | evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
419 | evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
420 | elm_object_part_content_set(fl, "back", fr); | ||
421 | evas_object_show(fr); | ||
422 | |||
423 | fl_b = elm_flip_add(win); | ||
424 | evas_object_size_hint_align_set(fl_b, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
425 | evas_object_size_hint_weight_set(fl_b, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
426 | elm_object_content_set(fr, fl_b); | ||
427 | evas_object_show(fl_b); | ||
428 | |||
429 | o = elm_bg_add(win); | ||
430 | evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
431 | evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
432 | snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), "sky_03.jpg"); | ||
433 | elm_bg_file_set(o, buf, NULL); | ||
434 | elm_object_part_content_set(fl_b, "front", o); | ||
435 | evas_object_show(o); | ||
436 | |||
437 | o = elm_bg_add(win); | ||
438 | evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
439 | evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
440 | snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), "sky_04.jpg"); | ||
441 | elm_bg_file_set(o, buf, NULL); | ||
442 | elm_object_part_content_set(fl_b, "back", o); | ||
443 | evas_object_show(o); | ||
444 | |||
445 | bx2 = elm_box_add(win); | ||
446 | elm_box_horizontal_set(bx2, EINA_TRUE); | ||
447 | evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
448 | evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); | ||
449 | |||
450 | bt = elm_button_add(win); | ||
451 | elm_object_text_set(bt, "Main Flip"); | ||
452 | evas_object_smart_callback_add(bt, "clicked", my_fl_6, fl); | ||
453 | evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
454 | evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); | ||
455 | elm_box_pack_end(bx2, bt); | ||
456 | evas_object_show(bt); | ||
457 | |||
458 | bt = elm_button_add(win); | ||
459 | elm_object_text_set(bt, "Front Flip"); | ||
460 | evas_object_smart_callback_add(bt, "clicked", my_fl_6, fl_f); | ||
461 | evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
462 | evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); | ||
463 | elm_box_pack_end(bx2, bt); | ||
464 | evas_object_show(bt); | ||
465 | |||
466 | bt = elm_button_add(win); | ||
467 | elm_object_text_set(bt, "Back Flip"); | ||
468 | evas_object_smart_callback_add(bt, "clicked", my_fl_6, fl_b); | ||
469 | evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
470 | evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); | ||
471 | elm_box_pack_end(bx2, bt); | ||
472 | evas_object_show(bt); | ||
473 | |||
474 | elm_box_pack_end(bx, bx2); | ||
475 | evas_object_show(bx2); | ||
476 | |||
477 | evas_object_resize(win, 320, 480); | ||
478 | evas_object_show(win); | ||
479 | } | ||
480 | |||
481 | |||
482 | static void | ||
483 | my_fl_go(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
484 | { | ||
485 | Evas_Object *win = data; | ||
486 | Evas_Object *fl = evas_object_data_get(win, "fl"); | ||
487 | elm_flip_go(fl, ELM_FLIP_PAGE_LEFT); | ||
488 | } | ||
489 | |||
490 | static void | ||
491 | my_fl_ch(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
492 | { | ||
493 | Evas_Object *win = data; | ||
494 | Evas_Object *fl = evas_object_data_get(win, "fl"); | ||
495 | Evas_Object *rdg = evas_object_data_get(win, "rdg"); | ||
496 | elm_flip_interaction_set(fl, elm_radio_value_get(rdg)); | ||
497 | } | ||
498 | |||
499 | void | ||
500 | test_flip4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
501 | { | ||
502 | Evas_Object *win, *bx, *fl, *im, *li, *bt, *rd, *rdg; | ||
503 | char buf[PATH_MAX]; | ||
504 | |||
505 | win = elm_win_util_standard_add("flip-interactive", "Flip Interactive"); | ||
506 | elm_win_autodel_set(win, EINA_TRUE); | ||
507 | |||
508 | bx = elm_box_add(win); | ||
509 | evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
510 | elm_win_resize_object_add(win, bx); | ||
511 | evas_object_show(bx); | ||
512 | |||
513 | fl = elm_flip_add(win); | ||
514 | evas_object_size_hint_align_set(fl, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
515 | evas_object_size_hint_weight_set(fl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
516 | elm_box_pack_end(bx, fl); | ||
517 | evas_object_data_set(win, "fl", fl); | ||
518 | |||
519 | elm_flip_interaction_set(fl, ELM_FLIP_INTERACTION_NONE); | ||
520 | elm_flip_interaction_direction_enabled_set(fl, ELM_FLIP_DIRECTION_UP, EINA_TRUE); | ||
521 | elm_flip_interaction_direction_enabled_set(fl, ELM_FLIP_DIRECTION_DOWN, EINA_TRUE); | ||
522 | elm_flip_interaction_direction_enabled_set(fl, ELM_FLIP_DIRECTION_LEFT, EINA_TRUE); | ||
523 | elm_flip_interaction_direction_enabled_set(fl, ELM_FLIP_DIRECTION_RIGHT, EINA_TRUE); | ||
524 | elm_flip_interaction_direction_hitsize_set(fl, ELM_FLIP_DIRECTION_UP, 0.25); | ||
525 | elm_flip_interaction_direction_hitsize_set(fl, ELM_FLIP_DIRECTION_DOWN, 0.25); | ||
526 | elm_flip_interaction_direction_hitsize_set(fl, ELM_FLIP_DIRECTION_LEFT, 0.25); | ||
527 | elm_flip_interaction_direction_hitsize_set(fl, ELM_FLIP_DIRECTION_RIGHT, 0.25); | ||
528 | evas_object_show(fl); | ||
529 | |||
530 | im = evas_object_image_filled_add(evas_object_evas_get(win)); | ||
531 | evas_object_size_hint_weight_set(im, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
532 | snprintf(buf, sizeof(buf), "%s/images/%s", | ||
533 | elm_app_data_dir_get(), "twofish.jpg"); | ||
534 | evas_object_image_file_set(im, buf, NULL); | ||
535 | elm_object_part_content_set(fl, "front", im); | ||
536 | evas_object_show(im); | ||
537 | |||
538 | #if 0 | ||
539 | im = evas_object_image_filled_add(evas_object_evas_get(win)); | ||
540 | evas_object_size_hint_weight_set(im, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
541 | snprintf(buf, sizeof(buf), "%s/images/%s", | ||
542 | elm_app_data_dir_get(), "sky_04.jpg"); | ||
543 | evas_object_image_file_set(im, buf, NULL); | ||
544 | elm_object_part_content_set(fl, "back", im); | ||
545 | evas_object_show(im); | ||
546 | #else | ||
547 | li = elm_list_add(win); | ||
548 | evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
549 | elm_list_item_append(li, "Item 0", NULL, NULL, NULL, NULL); | ||
550 | elm_list_item_append(li, "Item 1", NULL, NULL, NULL, NULL); | ||
551 | elm_list_item_append(li, "Item 2", NULL, NULL, NULL, NULL); | ||
552 | elm_list_item_append(li, "Item 3 (Which is very long just for testing purposes)", NULL, NULL, NULL, NULL); | ||
553 | elm_list_go(li); | ||
554 | elm_object_part_content_set(fl, "back", li); | ||
555 | evas_object_show(li); | ||
556 | #endif | ||
557 | |||
558 | rd = elm_radio_add(win); | ||
559 | evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
560 | evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, 0.0); | ||
561 | elm_radio_state_value_set(rd, ELM_FLIP_INTERACTION_NONE); | ||
562 | elm_object_text_set(rd, "None"); | ||
563 | elm_box_pack_end(bx, rd); | ||
564 | evas_object_show(rd); | ||
565 | evas_object_smart_callback_add(rd, "changed", my_fl_ch, win); | ||
566 | rdg = rd; | ||
567 | evas_object_data_set(win, "rdg", rdg); | ||
568 | |||
569 | rd = elm_radio_add(win); | ||
570 | evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
571 | evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, 0.0); | ||
572 | elm_radio_state_value_set(rd, ELM_FLIP_INTERACTION_ROTATE); | ||
573 | elm_object_text_set(rd, "Rotate"); | ||
574 | elm_radio_group_add(rd, rdg); | ||
575 | elm_box_pack_end(bx, rd); | ||
576 | evas_object_show(rd); | ||
577 | evas_object_smart_callback_add(rd, "changed", my_fl_ch, win); | ||
578 | |||
579 | rd = elm_radio_add(win); | ||
580 | evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
581 | evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, 0.0); | ||
582 | elm_radio_state_value_set(rd, ELM_FLIP_INTERACTION_CUBE); | ||
583 | elm_object_text_set(rd, "Cube"); | ||
584 | elm_radio_group_add(rd, rdg); | ||
585 | elm_box_pack_end(bx, rd); | ||
586 | evas_object_show(rd); | ||
587 | evas_object_smart_callback_add(rd, "changed", my_fl_ch, win); | ||
588 | |||
589 | rd = elm_radio_add(win); | ||
590 | evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
591 | evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, 0.0); | ||
592 | elm_radio_state_value_set(rd, ELM_FLIP_INTERACTION_PAGE); | ||
593 | elm_object_text_set(rd, "Page"); | ||
594 | elm_radio_group_add(rd, rdg); | ||
595 | elm_box_pack_end(bx, rd); | ||
596 | evas_object_show(rd); | ||
597 | evas_object_smart_callback_add(rd, "changed", my_fl_ch, win); | ||
598 | |||
599 | bt = elm_button_add(win); | ||
600 | elm_object_text_set(bt, "Go"); | ||
601 | evas_object_smart_callback_add(bt, "clicked", my_fl_go, win); | ||
602 | evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
603 | evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); | ||
604 | elm_box_pack_end(bx, bt); | ||
605 | evas_object_show(bt); | ||
606 | |||
607 | evas_object_resize(win, 320, 480); | ||
608 | evas_object_show(win); | ||
609 | } | ||
610 | #endif | ||