summaryrefslogtreecommitdiff
path: root/src/examples/elementary/radio_cxx_example_01.cc
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-11-06 14:25:22 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-11-07 09:57:24 +0900
commit778c5afb3f29fe0763d875d31f6411b24cbb997d (patch)
treee253817b380f6b1ca8bafc032032c00fc2a95310 /src/examples/elementary/radio_cxx_example_01.cc
parent4f98b549159811d2f649a9e3eca6bbe20bc86740 (diff)
cxx: Fix some examples, disable or remove others
make examples now builds all c++ examples but some of them are in fact empty skeletons. Those either need some c++ love or the final eo api to be ready (eg. menu, popup, ...). I removed some examples that don't have an exact equivalent in EO since the widget is legacy only.
Diffstat (limited to 'src/examples/elementary/radio_cxx_example_01.cc')
-rw-r--r--src/examples/elementary/radio_cxx_example_01.cc93
1 files changed, 38 insertions, 55 deletions
diff --git a/src/examples/elementary/radio_cxx_example_01.cc b/src/examples/elementary/radio_cxx_example_01.cc
index 7a760aaa82..71507947ad 100644
--- a/src/examples/elementary/radio_cxx_example_01.cc
+++ b/src/examples/elementary/radio_cxx_example_01.cc
@@ -1,79 +1,62 @@
1// g++ -g `pkg-config --cflags --libs elementary-cxx efl-cxx eina-cxx eo-cxx ecore-cxx evas-cxx edje-cxx` radio_cxx_example_01.cc -o radio_cxx_example_01
2
3#define EFL_CXX_WREF_EASY
1#include <Elementary.hh> 4#include <Elementary.hh>
5#include <iostream>
6
7using efl::eo::instantiate;
2 8
3EAPI_MAIN int 9static void
4elm_main (int argc, char *argv[]) 10efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
5{ 11{
6 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); 12 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
7 13
8 static int val = 1; 14 efl::ui::Win win(instantiate);
9 15 win.text_set("Radio Example");
10 ::elm::win_standard win;
11 win.title_set("Radio");
12 win.autohide_set(true); 16 win.autohide_set(true);
13 17
14 ::efl::ui::Box bx(efl::eo::parent = win); 18 efl::ui::Box bx(instantiate, win);
15 bx.horizontal_set(true); 19 bx.direction_set(EFL_UI_DIR_HORIZONTAL);
16 bx.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 20 win.content_set(bx);
17 win.resize_object_add(bx);
18 bx.visible_set(true);
19 21
20 ::elm::radio radio(efl::eo::parent = win); 22 efl::ui::Radio radio(instantiate, win);
21 ::elm::radio group(efl::eo::parent = win); 23 efl::ui::Radio group = radio;
22 group = radio; 24 radio.text_set("Radio 1");
23 radio.text_set("elm.text", "Radio 1");
24 radio.state_value_set(1); 25 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 26
34 auto cb_val = std::bind([] () { std::cout << "val is now: " << val << std::endl; }); 27 efl::ui::Image ic(instantiate, win);
28 ic.icon_set("home");
29 radio.content_set(ic);
30 bx.pack_end(radio);
35 31
36 radio.callback_changed_add(cb_val); 32 auto cb_val = std::bind([] (efl::ui::Radio &obj)
33 { std::cout << "val is now: " << obj.value_get() << std::endl; },
34 std::placeholders::_1);
35 efl::eolian::event_add(efl::ui::Radio::changed_event, radio, cb_val);
37 36
38 ::elm::radio radio2(efl::eo::parent = win); 37 efl::ui::Radio radio2(instantiate, win);
39 radio2.text_set("elm.text", "Radio 2"); 38 radio2.text_set("Radio 2");
40 radio2.state_value_set(2); 39 radio2.state_value_set(2);
41 radio2.value_pointer_set(&val);
42 radio2.group_add(group); 40 radio2.group_add(group);
43 ::elm::icon ic2(efl::eo::parent = win); 41
44 ic2.standard_set("file"); 42 efl::ui::Image ic2(instantiate, win);
45 radio2.content_set("icon", ic2); 43 ic2.icon_set("file");
44 radio2.content_set(ic2);
46 bx.pack_end(radio2); 45 bx.pack_end(radio2);
47 radio2.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 46 efl::eolian::event_add(efl::ui::Radio::changed_event, radio2, cb_val);
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 47
52 ::elm::radio radio3(efl::eo::parent = win); 48 efl::ui::Radio radio3(instantiate, win);
53 radio3.text_set("elm.text", "Radio 3"); 49 radio3.text_set("Radio 3");
54 radio3.state_value_set(3); 50 radio3.state_value_set(3);
55 radio3.value_pointer_set(&val);
56 radio3.group_add(group); 51 radio3.group_add(group);
57 bx.pack_end(radio3); 52 bx.pack_end(radio3);
58 radio3.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 53 efl::eolian::event_add(efl::ui::Radio::changed_event, radio3, cb_val);
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 54
63 ::elm::radio radio4(efl::eo::parent = win); 55 efl::ui::Radio radio4(instantiate, win);
64 radio4.text_set("elm.text", "Radio 4"); 56 radio4.text_set("Radio 4");
65 radio4.state_value_set(4); 57 radio4.state_value_set(4);
66 radio4.value_pointer_set(&val);
67 radio4.group_add(group); 58 radio4.group_add(group);
68 bx.pack_end(radio4); 59 bx.pack_end(radio4);
69 radio4.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 60 efl::eolian::event_add(efl::ui::Radio::changed_event, radio4, cb_val);
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} 61}
79ELM_MAIN() 62EFL_MAIN()