summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChunEon Park <chuneon.park@samsung.com>2015-04-14 22:51:56 +0900
committerChunEon Park <chuneon.park@samsung.com>2015-04-14 22:51:56 +0900
commit5a6c25d332d085780eb76916d2fefed92d298646 (patch)
tree537807b926aab06c24dda9fb44c77c068675d5ff
parentc442e54c6e7ea35a2031e66d978b15dd5e7150b7 (diff)
devs hermet: add radio sample
-rw-r--r--radio.c110
1 files changed, 110 insertions, 0 deletions
diff --git a/radio.c b/radio.c
new file mode 100644
index 0000000..10a4b81
--- /dev/null
+++ b/radio.c
@@ -0,0 +1,110 @@
1#include <Elementary.h>
2
3#define PACKAGE_BIN_DIR "/usr/local/bin"
4#define PACKAGE_LIB_DIR "/usr/local/lib"
5#define PACKAGE_DATA_DIR "/usr/local/share/elm_app"
6
7void elm_setup();
8
9void
10win_delete_request_cb(void *data, Evas_Object *obj, void *event_info)
11{
12 elm_exit();
13}
14
15void
16radio_changed_cb(void *data, Evas_Object *obj, void *event_info)
17{
18 printf("radio state is changed = (%d)\n", elm_radio_state_value_get(obj));
19}
20
21EAPI_MAIN int
22elm_main(int argc, char **argv)
23{
24 elm_setup();
25
26 Evas_Object *win = elm_win_util_standard_add("Elementary App", "Elementary App");
27 elm_win_autodel_set(win, EINA_TRUE);
28 evas_object_smart_callback_add(win, "delete,request", win_delete_request_cb, NULL);
29
30 Evas_Object *box = elm_box_add(win);
31 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
32 elm_win_resize_object_add(win, box);
33 evas_object_show(box);
34
35 Evas_Object *label = elm_label_add(box);
36 evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
37 evas_object_size_hint_align_set(label, 0, 0.5);
38 elm_object_text_set(label, "Q. 다음 중 길거리에서 Hermet 님을 만났을 때 대처해야 할 올바른 행동을 고르시오.");
39 evas_object_show(label);
40 elm_box_pack_end(box, label);
41
42 Evas_Object *radio, *radio_group;
43
44 radio = elm_radio_add(box);
45 elm_radio_state_value_set(radio, 0);
46 elm_object_text_set(radio, "1) 일단 도망간다.");
47 evas_object_smart_callback_add(radio, "changed", radio_changed_cb, NULL);
48 evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
49 evas_object_size_hint_align_set(radio, 0, EVAS_HINT_FILL);
50 evas_object_show(radio);
51 elm_box_pack_end(box, radio);
52
53 radio_group = radio;
54
55 radio = elm_radio_add(box);
56 elm_radio_state_value_set(radio, 1);
57 elm_radio_group_add(radio, radio_group);
58 elm_object_text_set(radio, "2) 혹시 아는 척 하실 수도 있으니 경계한다.");
59 evas_object_smart_callback_add(radio, "changed", radio_changed_cb, NULL);
60 evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
61 evas_object_size_hint_align_set(radio, 0, EVAS_HINT_FILL);
62 evas_object_show(radio);
63 elm_box_pack_end(box, radio);
64
65 radio = elm_radio_add(box);
66 elm_radio_state_value_set(radio, 2);
67 elm_radio_group_add(radio, radio_group);
68 elm_object_text_set(radio, "3) 창피하므로 모른 척 한다.");
69 evas_object_smart_callback_add(radio, "changed", radio_changed_cb, NULL);
70 evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
71 evas_object_size_hint_align_set(radio, 0, EVAS_HINT_FILL);
72 evas_object_show(radio);
73
74 elm_box_pack_end(box, radio);
75
76 radio = elm_radio_add(box);
77 elm_radio_state_value_set(radio, 3);
78 elm_radio_group_add(radio, radio_group);
79 elm_object_text_set(radio, "4) 쫓아가서 Evas_Object 가 뭔지 가능한 열정적으로 질문한다.");
80 evas_object_smart_callback_add(radio, "changed", radio_changed_cb, NULL);
81 evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
82 evas_object_size_hint_align_set(radio, 0, EVAS_HINT_FILL);
83 evas_object_show(radio);
84
85 elm_box_pack_end(box, radio);
86
87 elm_radio_value_set(radio_group, 3);
88
89 evas_object_resize(win, 400, 400);
90 evas_object_show(win);
91
92 elm_run();
93
94 elm_shutdown();
95
96 return 0;
97}
98ELM_MAIN()
99
100void
101elm_setup()
102{
103 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
104 elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR);
105 elm_app_compile_lib_dir_set(PACKAGE_LIB_DIR);
106 elm_app_compile_data_dir_set(PACKAGE_DATA_DIR);
107 elm_app_info_set(elm_main, "Elementary App", "images/logo.png");
108}
109
110