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