summaryrefslogtreecommitdiff
path: root/src/examples/radio_cxx_example_01.cc
diff options
context:
space:
mode:
authorLuciana Magno de Almeida <luciana@expertisesolutions.com.br>2014-12-16 19:04:43 -0200
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2015-08-25 03:42:34 -0300
commitcf4d84c85b48d32fd85deeafdc7aee4543875725 (patch)
tree0c5c7a61507819bff113eb8ee8883c7026f33465 /src/examples/radio_cxx_example_01.cc
parentdfb979950cfcebc21d1b0e933d4f02ab2084e304 (diff)
cxx: Added examples and tutorial for C++ binding
Summary: Added the following examples: * bg_cxx_example_01 * bg_cxx_example_02 * bubble_cxx_example_01 * button_cxx_example_00 * button_cxx_example_01 * calendar_cxx_example_01 * calendar_cxx_example_02 * calendar_cxx_example_03 * calendar_cxx_example_04 * calendar_cxx_example_05 * clock_cxx_example * datetime_cxx_example * glview_cxx_example_01 * hoversel_cxx_example_01 * icon_cxx_example_01 * location_cxx_example_01 * menu_cxx_example_01 * popup_cxx_example_01 * radio_cxx_example_01 * separator_cxx_example_01 * slider_cxx_example * spinner_cxx_example * table_cxx_example_01 * table_cxx_example_02 * thumb_cxx_example_01 Added documentation for the above examples, as well as how using lambdas with C++ elm binding. How to use autohide feature and how to use the C++ wrappers to create windows, widgets and call Eo functions from them with automatic C++ type conversion and how to use signals from C++.
Diffstat (limited to 'src/examples/radio_cxx_example_01.cc')
-rw-r--r--src/examples/radio_cxx_example_01.cc79
1 files changed, 79 insertions, 0 deletions
diff --git a/src/examples/radio_cxx_example_01.cc b/src/examples/radio_cxx_example_01.cc
new file mode 100644
index 0000000..34a9f09
--- /dev/null
+++ b/src/examples/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()