summaryrefslogtreecommitdiff
path: root/src/examples/elementary/radio_cxx_example_01.cc
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-03-23 12:56:14 -0700
committerCedric BAIL <cedric@osg.samsung.com>2016-03-23 13:24:41 -0700
commitc2a1c49ab2042f559b28e840e54feb8494888e0e (patch)
treec6eb110b7c479499854eede9d0c3ab0a80c9a11a /src/examples/elementary/radio_cxx_example_01.cc
parent9340855597e7e465435c69b6278650346688da14 (diff)
elementary: move all legacy files to their expected new location.
Diffstat (limited to 'src/examples/elementary/radio_cxx_example_01.cc')
-rw-r--r--src/examples/elementary/radio_cxx_example_01.cc79
1 files changed, 79 insertions, 0 deletions
diff --git a/src/examples/elementary/radio_cxx_example_01.cc b/src/examples/elementary/radio_cxx_example_01.cc
new file mode 100644
index 0000000000..34a9f09abe
--- /dev/null
+++ b/src/examples/elementary/radio_cxx_example_01.cc
@@ -0,0 +1,79 @@
1#include <Elementary.hh>
2
3EAPI_MAIN int
4elm_main (int argc, char *argv[])
5{
6 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
7
8 static int val = 1;
9
10 ::elm::win_standard win;
11 win.title_set("Radio");
12 win.autohide_set(true);
13
14 ::elm::box bx(efl::eo::parent = win);
15 bx.horizontal_set(true);
16 bx.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
17 win.resize_object_add(bx);
18 bx.visible_set(true);
19
20 ::elm::radio radio(efl::eo::parent = win);
21 ::elm::radio group(efl::eo::parent = win);
22 group = radio;
23 radio.text_set("elm.text", "Radio 1");
24 radio.state_value_set(1);
25 radio.value_pointer_set(&val);
26 ::elm::icon ic(efl::eo::parent = win);
27 ic.standard_set("home");
28 radio.content_set("icon", ic);
29 bx.pack_end(radio);
30 radio.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
31 radio.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
32 radio.visible_set(true);
33
34 auto cb_val = std::bind([] () { std::cout << "val is now: " << val << std::endl; });
35
36 radio.callback_changed_add(cb_val);
37
38 ::elm::radio radio2(efl::eo::parent = win);
39 radio2.text_set("elm.text", "Radio 2");
40 radio2.state_value_set(2);
41 radio2.value_pointer_set(&val);
42 radio2.group_add(group);
43 ::elm::icon ic2(efl::eo::parent = win);
44 ic2.standard_set("file");
45 radio2.content_set("icon", ic2);
46 bx.pack_end(radio2);
47 radio2.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
48 radio2.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
49 radio2.visible_set(true);
50 radio2.callback_changed_add(cb_val);
51
52 ::elm::radio radio3(efl::eo::parent = win);
53 radio3.text_set("elm.text", "Radio 3");
54 radio3.state_value_set(3);
55 radio3.value_pointer_set(&val);
56 radio3.group_add(group);
57 bx.pack_end(radio3);
58 radio3.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
59 radio3.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
60 radio3.visible_set(true);
61 radio3.callback_changed_add(cb_val);
62
63 ::elm::radio radio4(efl::eo::parent = win);
64 radio4.text_set("elm.text", "Radio 4");
65 radio4.state_value_set(4);
66 radio4.value_pointer_set(&val);
67 radio4.group_add(group);
68 bx.pack_end(radio4);
69 radio4.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
70 radio4.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
71 radio4.visible_set(true);
72 radio4.callback_changed_add(cb_val);
73
74 win.visible_set(true);
75
76 elm_run();
77 return 0;
78}
79ELM_MAIN()