[JungWooHyun] doing merge job ~
[framework/uifw/elementary.git] / src / examples / flip_example_01.c
1 //Compile with:
2 //gcc -g `pkg-config --cflags --libs elementary` flip_example_01.c -o flip_example_01
3
4 #include <Elementary.h>
5 #ifdef HAVE_CONFIG_H
6 # include "elementary_config.h"
7 #endif
8
9 static void _change_interaction(void *data, Evas_Object *obj, void *event_info);
10
11 EAPI_MAIN int
12 elm_main(int argc, char **argv)
13 {
14    Evas_Object *win, *bg, *rect, *rect2, *flip, *radio, *radio2, *radio3;
15
16    win = elm_win_add(NULL, "flip", ELM_WIN_BASIC);
17    elm_win_title_set(win, "Flip");
18    elm_win_autodel_set(win, EINA_TRUE);
19    elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
20
21    bg = elm_bg_add(win);
22    elm_win_resize_object_add(win, bg);
23    evas_object_show(bg);
24
25    rect = evas_object_rectangle_add(evas_object_evas_get(win));
26    evas_object_resize(rect, 150, 150);
27    evas_object_color_set(rect, 0, 0, 255, 255);
28    evas_object_show(rect);
29
30    rect2 = evas_object_rectangle_add(evas_object_evas_get(win));
31    evas_object_color_set(rect2, 0, 255, 0, 255);
32    evas_object_show(rect2);
33
34    flip = elm_flip_add(win);
35 <<<<<<< HEAD
36    elm_flip_content_front_set(flip, rect);
37    elm_flip_content_back_set(flip, rect2);
38 =======
39    elm_object_part_content_set(flip, "front", rect);
40    elm_object_part_content_set(flip, "back", rect2);
41 >>>>>>> remotes/origin/upstream
42    evas_object_resize(flip, 150, 150);
43    evas_object_move(flip, 10, 10);
44    evas_object_show(flip);
45
46    elm_flip_interaction_set(flip, ELM_FLIP_INTERACTION_PAGE);
47 <<<<<<< HEAD
48    elm_flip_interacton_direction_enabled_set(flip, ELM_FLIP_DIRECTION_UP, EINA_TRUE);
49    elm_flip_interacton_direction_enabled_set(flip, ELM_FLIP_DIRECTION_DOWN, EINA_TRUE);
50    elm_flip_interacton_direction_enabled_set(flip, ELM_FLIP_DIRECTION_LEFT, EINA_TRUE);
51    elm_flip_interacton_direction_enabled_set(flip, ELM_FLIP_DIRECTION_RIGHT, EINA_TRUE);
52    elm_flip_interacton_direction_hitsize_set(flip, ELM_FLIP_DIRECTION_UP, 1);
53    elm_flip_interacton_direction_hitsize_set(flip, ELM_FLIP_DIRECTION_DOWN, 1);
54    elm_flip_interacton_direction_hitsize_set(flip, ELM_FLIP_DIRECTION_LEFT, 1);
55    elm_flip_interacton_direction_hitsize_set(flip, ELM_FLIP_DIRECTION_RIGHT, 1);
56 =======
57    elm_flip_interaction_direction_enabled_set(flip, ELM_FLIP_DIRECTION_UP, EINA_TRUE);
58    elm_flip_interaction_direction_enabled_set(flip, ELM_FLIP_DIRECTION_DOWN, EINA_TRUE);
59    elm_flip_interaction_direction_enabled_set(flip, ELM_FLIP_DIRECTION_LEFT, EINA_TRUE);
60    elm_flip_interaction_direction_enabled_set(flip, ELM_FLIP_DIRECTION_RIGHT, EINA_TRUE);
61    elm_flip_interaction_direction_hitsize_set(flip, ELM_FLIP_DIRECTION_UP, 1);
62    elm_flip_interaction_direction_hitsize_set(flip, ELM_FLIP_DIRECTION_DOWN, 1);
63    elm_flip_interaction_direction_hitsize_set(flip, ELM_FLIP_DIRECTION_LEFT, 1);
64    elm_flip_interaction_direction_hitsize_set(flip, ELM_FLIP_DIRECTION_RIGHT, 1);
65 >>>>>>> remotes/origin/upstream
66
67    radio = elm_radio_add(win);
68    elm_object_text_set(radio, "page");
69    elm_radio_value_set(radio, ELM_FLIP_INTERACTION_PAGE);
70    elm_radio_state_value_set(radio, ELM_FLIP_INTERACTION_PAGE);
71    evas_object_resize(radio, 55, 30);
72    evas_object_move(radio, 10, 160);
73    evas_object_show(radio);
74    evas_object_smart_callback_add(radio, "changed", _change_interaction, flip);
75
76    radio2 = elm_radio_add(win);
77    elm_object_text_set(radio2, "cube");
78    elm_radio_state_value_set(radio2, ELM_FLIP_INTERACTION_CUBE);
79    elm_radio_group_add(radio2, radio);
80    evas_object_resize(radio2, 55, 30);
81    evas_object_move(radio2, 75, 160);
82    evas_object_show(radio2);
83    evas_object_smart_callback_add(radio2, "changed", _change_interaction, flip);
84
85    radio3 = elm_radio_add(win);
86    elm_object_text_set(radio3, "rotate");
87    elm_radio_state_value_set(radio3, ELM_FLIP_INTERACTION_ROTATE);
88    elm_radio_group_add(radio3, radio);
89    evas_object_resize(radio3, 55, 30);
90    evas_object_move(radio3, 140, 160);
91    evas_object_show(radio3);
92    evas_object_smart_callback_add(radio3, "changed", _change_interaction, flip);
93
94    evas_object_resize(win, 200, 200);
95    evas_object_show(win);
96
97    elm_run();
98
99    return 0;
100 }
101 ELM_MAIN()
102
103 static void
104 _change_interaction(void *data, Evas_Object *obj, void *event_info)
105 {
106    elm_flip_interaction_set(data, elm_radio_state_value_get(obj));
107    elm_flip_go(data, ELM_FLIP_ROTATE_XZ_CENTER_AXIS);
108 }