summaryrefslogtreecommitdiff
path: root/src/examples/elementary/toolbar_cxx_example_01.cc
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2017-09-07 18:02:43 +0900
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2017-09-08 11:47:29 +0900
commit48b3c127f7c4e7ffc7dbf66013c3ec2812ae9a5f (patch)
tree30f2a04e2b8ae4fa69e700bc1103a8ea4aaba31b /src/examples/elementary/toolbar_cxx_example_01.cc
parentff96e30c7239118b349883f8b1b882e9c64d10c5 (diff)
eo-cxx: Require instantiate keyword for constructors calling efl_add to avoid ambiguity
Diffstat (limited to 'src/examples/elementary/toolbar_cxx_example_01.cc')
-rw-r--r--src/examples/elementary/toolbar_cxx_example_01.cc135
1 files changed, 135 insertions, 0 deletions
diff --git a/src/examples/elementary/toolbar_cxx_example_01.cc b/src/examples/elementary/toolbar_cxx_example_01.cc
new file mode 100644
index 0000000000..5d19c4bd2e
--- /dev/null
+++ b/src/examples/elementary/toolbar_cxx_example_01.cc
@@ -0,0 +1,135 @@
1#define ELM_WIDGET_PROTECTED
2#define ELM_WIDGET_CLASS_PROTECTED
3
4#ifdef HAVE_CONFIG_H
5#include "config.h"
6#endif
7
8#include <Elementary.hh>
9#include <Evas.hh>
10
11EAPI int
12elm_main(int argc, char* argv[])
13{
14 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
15
16 using efl::eo::instantiate;
17
18 efl::ui::Win win_1
19 (instantiate,
20 [&]
21 {
22 win_1.text_set("Toolbar");
23 win_1.name_set("toolbar");
24 win_1.type_set(EFL_UI_WIN_BASIC);
25 });
26
27 win_1.autodel_set(true);
28 win_1.eo_cxx::efl::Gfx::size_set(320, 300);
29
30 efl::ui::Box box_1(instantiate, win_1);
31 box_1.hint_weight_set(1.0, 1.0);
32 box_1.visible_set(true);
33
34 elm::Toolbar toolbar_1(instantiate, win_1);
35 toolbar_1.shrink_mode_set(ELM_TOOLBAR_SHRINK_MENU);
36 toolbar_1.hint_weight_set(0, 0);
37 toolbar_1.hint_align_set(-1, 0);
38 toolbar_1.menu_parent_set(win_1);
39 elm::toolbar::Item item_1 = efl::eo::downcast<elm::toolbar::Item>
40 (toolbar_1.item_append("document-print", "Hello", nullptr, nullptr));
41 item_1.disabled_set(true);
42 item_1.priority_set(100);
43 elm::toolbar::Item item_2 = efl::eo::downcast<elm::toolbar::Item>
44 (toolbar_1.item_append("folder-new", "World", nullptr, nullptr));
45 item_2.priority_set(100);
46 elm::toolbar::Item item_3 = efl::eo::downcast<elm::toolbar::Item>
47 (toolbar_1.item_append("object-rotate-right", "H", nullptr, nullptr));
48 item_3.priority_set(150);
49 elm::toolbar::Item item_4 = efl::eo::downcast<elm::toolbar::Item>
50 (toolbar_1.item_append("mail-send", "Comes", nullptr, nullptr));
51 item_4.priority_set(0);
52 elm::toolbar::Item item_5 = efl::eo::downcast<elm::toolbar::Item>
53 (toolbar_1.item_append("clock", "Elementary", nullptr, nullptr));
54 item_5.priority_set(200);
55 elm::toolbar::Item item_6 = efl::eo::downcast<elm::toolbar::Item>
56 (toolbar_1.item_append("refresh", "Menu", nullptr, nullptr));
57 item_6.menu_set(true);
58 item_6.priority_set(9999);
59 elm::Menu menu_1 = efl::eo::downcast<elm::Menu>
60 (item_6.menu_get());
61 elm::menu::Item item_7 = efl::eo::downcast<elm::menu::Item>
62 (menu_1.item_add(nullptr, "edit-cut", "Shrink", nullptr, nullptr));
63 elm::menu::Item item_8 = efl::eo::downcast<elm::menu::Item>
64 (menu_1.item_add(nullptr, "edit-copy", "Mode", nullptr, nullptr));
65 elm::menu::Item item_9 = efl::eo::downcast<elm::menu::Item>
66 (menu_1.item_add(item_8, "edit-paste", "is set to", nullptr, nullptr));
67 elm::menu::Item item_10 = efl::eo::downcast<elm::menu::Item>
68 (menu_1.item_add(nullptr, "edit-delete", "Menu", nullptr, nullptr));
69
70 box_1.pack_end(toolbar_1);
71 elm::Widget table_1(elm_table_add(win_1._eo_ptr()));
72 table_1.hint_weight_set(0.0, 1.0);
73 table_1.hint_align_set(-1, -1);
74 table_1.visible_set(true);
75
76 elm::Widget photo_1(elm_photo_add(win_1._eo_ptr()));
77 elm_photo_size_set(photo_1._eo_ptr(), 40);
78 efl_file_set(photo_1._eo_ptr(), "/opt/e/share/elementary/images/plant_01.jpg", nullptr);
79 photo_1.hint_weight_set(1, 1);
80 photo_1.hint_align_set(0.5, 0.5);
81 photo_1.visible_set(true);
82
83 elm_table_pack(table_1._eo_ptr(), photo_1._eo_ptr(), 0, 0, 1, 1);
84 elm::Widget photo_2(elm_photo_add(win_1._eo_ptr()));
85 elm_photo_size_set(photo_2._eo_ptr(), 80);
86 photo_2.hint_weight_set(1, 1);
87 photo_2.hint_align_set(0.5, 0.5);
88 photo_2.visible_set(true);
89
90 elm_table_pack(table_1._eo_ptr(), photo_2._eo_ptr(), 1, 0, 1, 1);
91 elm::Widget photo_3(elm_photo_add(win_1._eo_ptr()));
92 elm_photo_size_set(photo_3._eo_ptr(), 20);
93 efl_file_set(photo_3._eo_ptr(), "/opt/e/share/elementary/images/sky_01.jpg", nullptr);
94 photo_3.hint_weight_set(1, 1);
95 photo_3.hint_align_set(0.5, 0.5);
96 photo_3.visible_set(true);
97
98 elm_table_pack(table_1._eo_ptr(), photo_3._eo_ptr(), 0, 1, 1, 1);
99 elm::Widget photo_4(elm_photo_add(win_1._eo_ptr()));
100 elm_photo_size_set(photo_4._eo_ptr(), 60);
101 efl_file_set(photo_4._eo_ptr(), "/opt/e/share/elementary/images/sky_02.jpg", nullptr);
102 photo_4.hint_weight_set(1, 1);
103 photo_4.hint_align_set(0.5, 0.5);
104 photo_4.visible_set(true);
105
106 elm_table_pack(table_1._eo_ptr(), photo_4._eo_ptr(), 1, 1, 1, 1);
107 box_1.pack_end(table_1);
108
109 win_1.content_set(box_1);
110
111 auto _item_2_selected_cb = std::bind([&] () {
112 efl_file_set(photo_1._eo_ptr(), "/opt/e/share/elementary/images/rock_01.jpg", nullptr);
113 });
114 efl::eolian::event_add(efl::ui::Selectable::selected_event, item_2, _item_2_selected_cb);
115
116 auto _item_3_selected_cb = std::bind([&] () {
117 efl_file_set(photo_4._eo_ptr(), "/opt/e/share/elementary/images/wood_01.jpg", nullptr);
118 });
119
120 efl::eolian::event_add(efl::ui::Selectable::selected_event, item_3, _item_3_selected_cb);
121 auto _item_4_selected_cb = std::bind([&] () {
122 efl_file_set(photo_4._eo_ptr(), "/opt/e/share/elementary/images/sky_03.jpg", nullptr);
123 });
124
125 efl::eolian::event_add(efl::ui::Selectable::selected_event, item_4, _item_4_selected_cb);
126 auto _item_5_selected_cb = std::bind([&] () {
127 efl_file_set(photo_4._eo_ptr(), nullptr, nullptr);
128 });
129
130 efl::eolian::event_add(efl::ui::Selectable::selected_event, item_5, _item_5_selected_cb);
131
132 elm_run();
133 return 0;
134}
135ELM_MAIN()