summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/examples/elementary/Makefile.am121
-rw-r--r--src/examples/elementary/box_cxx_example_02.cc4
-rw-r--r--src/examples/elementary/button_cxx_example_00.cc20
-rw-r--r--src/examples/elementary/button_cxx_example_01.cc365
-rw-r--r--src/examples/elementary/calendar_cxx_example_01.cc9
-rw-r--r--src/examples/elementary/calendar_cxx_example_02.cc6
-rw-r--r--src/examples/elementary/calendar_cxx_example_03.cc9
-rw-r--r--src/examples/elementary/calendar_cxx_example_04.cc7
-rw-r--r--src/examples/elementary/calendar_cxx_example_05.cc7
-rw-r--r--src/examples/elementary/clock_cxx_example.cc5
-rw-r--r--src/examples/elementary/glview_cxx_example_01.cc263
-rw-r--r--src/examples/elementary/hoversel_cxx_example_01.cc84
-rw-r--r--src/examples/elementary/icon_cxx_example_01.cc14
-rw-r--r--src/examples/elementary/location_cxx_example_01.cc82
-rw-r--r--src/examples/elementary/menu_cxx_example_01.cc15
-rw-r--r--src/examples/elementary/popup_cxx_example_01.cc32
-rw-r--r--src/examples/elementary/radio_cxx_example_01.cc93
-rw-r--r--src/examples/elementary/slider_cxx_example.cc144
-rw-r--r--src/examples/elementary/spinner_cxx_example.cc86
-rw-r--r--src/examples/elementary/table_cxx_example_01.cc56
-rw-r--r--src/examples/elementary/table_cxx_example_02.cc71
21 files changed, 444 insertions, 1049 deletions
diff --git a/src/examples/elementary/Makefile.am b/src/examples/elementary/Makefile.am
index 6e6b9ac4c5..2db4ea7e0b 100644
--- a/src/examples/elementary/Makefile.am
+++ b/src/examples/elementary/Makefile.am
@@ -107,7 +107,6 @@ genlist_example_02.c \
107genlist_example_03.c \ 107genlist_example_03.c \
108genlist_example_04.c \ 108genlist_example_04.c \
109genlist_example_05.c \ 109genlist_example_05.c \
110glview_example_01.c \
111hover_example_01.c \ 110hover_example_01.c \
112hoversel_example_01.c \ 111hoversel_example_01.c \
113icon_example_01.c \ 112icon_example_01.c \
@@ -179,6 +178,9 @@ if HAVE_CXX11
179SRCS += \ 178SRCS += \
180bg_cxx_example_01.cc \ 179bg_cxx_example_01.cc \
181bg_cxx_example_02.cc \ 180bg_cxx_example_02.cc \
181box_cxx_example_02.cc \
182button_cxx_example_00.cc \
183button_cxx_example_01.cc \
182calendar_cxx_example_01.cc \ 184calendar_cxx_example_01.cc \
183calendar_cxx_example_02.cc \ 185calendar_cxx_example_02.cc \
184calendar_cxx_example_03.cc \ 186calendar_cxx_example_03.cc \
@@ -186,27 +188,15 @@ calendar_cxx_example_04.cc \
186calendar_cxx_example_05.cc \ 188calendar_cxx_example_05.cc \
187clock_cxx_example.cc \ 189clock_cxx_example.cc \
188icon_cxx_example_01.cc \ 190icon_cxx_example_01.cc \
189button_cxx_example_00.cc
190endif
191#table_cxx_example_02.cc \
192table_cxx_example_01.cc \
193spinner_cxx_example.cc \
194slider_cxx_example.cc \
195radio_cxx_example_01.cc \
196popup_cxx_example_01.cc \
197menu_cxx_example_01.cc \ 191menu_cxx_example_01.cc \
198location_cxx_example_01.cc \ 192radio_cxx_example_01.cc \
199hoversel_cxx_example_01.cc \ 193slider_cxx_example.cc \
200glview_cxx_example_01.cc \ 194spinner_cxx_example.cc \
201calendar_cxx_example_05.cc \ 195table_cxx_example_01.cc \
202calendar_cxx_example_04.cc \ 196table_cxx_example_02.cc \
203calendar_cxx_example_03.cc \ 197toolbar_cxx_example_01.cc \
204calendar_cxx_example_02.cc \ 198$(NULL)
205calendar_cxx_example_01.cc \ 199endif
206button_cxx_example_01.cc \
207box_cxx_example_02.cc \
208bg_cxx_example_02.cc \
209bg_cxx_example_01.cc
210 200
211EDCS = \ 201EDCS = \
212twitter_example_01.edc \ 202twitter_example_01.edc \
@@ -305,7 +295,6 @@ genlist_example_02 \
305genlist_example_03 \ 295genlist_example_03 \
306genlist_example_04 \ 296genlist_example_04 \
307genlist_example_05 \ 297genlist_example_05 \
308glview_example_01 \
309hover_example_01 \ 298hover_example_01 \
310hoversel_example_01 \ 299hoversel_example_01 \
311icon_example_01 \ 300icon_example_01 \
@@ -402,6 +391,9 @@ if HAVE_CXX11
402examples_PROGRAMS += \ 391examples_PROGRAMS += \
403bg_cxx_example_01 \ 392bg_cxx_example_01 \
404bg_cxx_example_02 \ 393bg_cxx_example_02 \
394box_cxx_example_02 \
395button_cxx_example_00 \
396button_cxx_example_01 \
405calendar_cxx_example_01 \ 397calendar_cxx_example_01 \
406calendar_cxx_example_02 \ 398calendar_cxx_example_02 \
407calendar_cxx_example_03 \ 399calendar_cxx_example_03 \
@@ -409,31 +401,14 @@ calendar_cxx_example_04 \
409calendar_cxx_example_05 \ 401calendar_cxx_example_05 \
410clock_cxx_example \ 402clock_cxx_example \
411icon_cxx_example_01 \ 403icon_cxx_example_01 \
404menu_cxx_example_01 \
405radio_cxx_example_01 \
406slider_cxx_example \
407spinner_cxx_example \
408table_cxx_example_01 \
409table_cxx_example_02 \
412toolbar_cxx_example_01 \ 410toolbar_cxx_example_01 \
413button_cxx_example_00 411$(NULL)
414# examples_PROGRAMS += \
415# table_cxx_example_02 \
416# table_cxx_example_01 \
417# spinner_cxx_example \
418# slider_cxx_example \
419# radio_cxx_example_01 \
420# popup_cxx_example_01 \
421# menu_cxx_example_01 \
422# location_cxx_example_01 \
423# icon_cxx_example_01 \
424# hoversel_cxx_example_01 \
425# glview_cxx_example_01 \
426# clock_cxx_example \
427# calendar_cxx_example_05 \
428# calendar_cxx_example_04 \
429# calendar_cxx_example_03 \
430# calendar_cxx_example_02 \
431# calendar_cxx_example_01 \
432# button_cxx_example_01 \
433# button_cxx_example_00 \
434# box_cxx_example_02 \
435# bg_cxx_example_02 \
436# bg_cxx_example_01
437endif 412endif
438 413
439efl_thread_1_SOURCES = efl_thread_1.c 414efl_thread_1_SOURCES = efl_thread_1.c
@@ -442,39 +417,25 @@ efl_thread_3_SOURCES = efl_thread_3.c
442efl_thread_4_SOURCES = efl_thread_4.c 417efl_thread_4_SOURCES = efl_thread_4.c
443 418
444if HAVE_CXX11 419if HAVE_CXX11
445icon_cxx_example_01_SOURCES = icon_cxx_example_01.cc
446clock_cxx_example_SOURCES = clock_cxx_example.cc
447calendar_cxx_example_05_SOURCES = calendar_cxx_example_05.cc
448calendar_cxx_example_04_SOURCES = calendar_cxx_example_04.cc
449calendar_cxx_example_03_SOURCES = calendar_cxx_example_03.cc
450calendar_cxx_example_02_SOURCES = calendar_cxx_example_02.cc
451calendar_cxx_example_01_SOURCES = calendar_cxx_example_01.cc
452bg_cxx_example_02_SOURCES = bg_cxx_example_02.cc
453bg_cxx_example_01_SOURCES = bg_cxx_example_01.cc 420bg_cxx_example_01_SOURCES = bg_cxx_example_01.cc
421bg_cxx_example_02_SOURCES = bg_cxx_example_02.cc
422box_cxx_example_02_SOURCES = box_cxx_example_02.cc
454button_cxx_example_00_SOURCES = button_cxx_example_00.cc 423button_cxx_example_00_SOURCES = button_cxx_example_00.cc
424button_cxx_example_01_SOURCES = button_cxx_example_01.cc
425calendar_cxx_example_01_SOURCES = calendar_cxx_example_01.cc
426calendar_cxx_example_02_SOURCES = calendar_cxx_example_02.cc
427calendar_cxx_example_03_SOURCES = calendar_cxx_example_03.cc
428calendar_cxx_example_04_SOURCES = calendar_cxx_example_04.cc
429calendar_cxx_example_05_SOURCES = calendar_cxx_example_05.cc
430clock_cxx_example_SOURCES = clock_cxx_example.cc
431icon_cxx_example_01_SOURCES = icon_cxx_example_01.cc
432menu_cxx_example_01_SOURCES = menu_cxx_example_01.cc
433radio_cxx_example_01_SOURCES = radio_cxx_example_01.cc
434slider_cxx_example_SOURCES = slider_cxx_example.cc
435spinner_cxx_example_SOURCES = spinner_cxx_example.cc
436table_cxx_example_01_SOURCES = table_cxx_example_01.cc
437table_cxx_example_02_SOURCES = table_cxx_example_02.cc
455toolbar_cxx_example_01_SOURCES = toolbar_cxx_example_01.cc 438toolbar_cxx_example_01_SOURCES = toolbar_cxx_example_01.cc
456# table_cxx_example_02_SOURCES = table_cxx_example_02.cc
457# table_cxx_example_01_SOURCES = table_cxx_example_01.cc
458# spinner_cxx_example_SOURCES = spinner_cxx_example.cc
459# slider_cxx_example_SOURCES = slider_cxx_example.cc
460# radio_cxx_example_01_SOURCES = radio_cxx_example_01.cc
461# popup_cxx_example_01_SOURCES = popup_cxx_example_01.cc
462# menu_cxx_example_01_SOURCES = menu_cxx_example_01.cc
463# location_cxx_example_01_SOURCES = location_cxx_example_01.cc
464# icon_cxx_example_01_SOURCES = icon_cxx_example_01.cc
465# hoversel_cxx_example_01_SOURCES = hoversel_cxx_example_01.cc
466# glview_cxx_example_01_SOURCES = glview_cxx_example_01.cc
467# clock_cxx_example_SOURCES = clock_cxx_example.cc
468# calendar_cxx_example_05_SOURCES = calendar_cxx_example_05.cc
469# calendar_cxx_example_04_SOURCES = calendar_cxx_example_04.cc
470# calendar_cxx_example_03_SOURCES = calendar_cxx_example_03.cc
471# calendar_cxx_example_02_SOURCES = calendar_cxx_example_02.cc
472# calendar_cxx_example_01_SOURCES = calendar_cxx_example_01.cc
473# button_cxx_example_01_SOURCES = button_cxx_example_01.cc
474# button_cxx_example_00_SOURCES = button_cxx_example_00.cc
475# box_cxx_example_02_SOURCES = box_cxx_example_02.cc
476# bg_cxx_example_02_SOURCES = bg_cxx_example_02.cc
477# bg_cxx_example_01_SOURCES = bg_cxx_example_01.cc
478endif 439endif
479 440
480# This variable will hold the list of screenshots that will be made 441# This variable will hold the list of screenshots that will be made
@@ -565,6 +526,7 @@ menu_example_01:menu_example_01.png:0.5
565 526
566if HAVE_CXX11 527if HAVE_CXX11
567SCREENSHOTS += \ 528SCREENSHOTS += \
529 bg_cxx_example_01:bg_cxx_example_01.png:0.0 \
568 bg_cxx_example_02:bg_cxx_example_02.png:0.0 \ 530 bg_cxx_example_02:bg_cxx_example_02.png:0.0 \
569 box_cxx_example_02:box_cxx_example_02.png:1.3 \ 531 box_cxx_example_02:box_cxx_example_02.png:1.3 \
570 button_cxx_example_00:button_cxx_example_00.png:0.0 \ 532 button_cxx_example_00:button_cxx_example_00.png:0.0 \
@@ -575,17 +537,16 @@ SCREENSHOTS += \
575 calendar_cxx_example_04:calendar_cxx_example_04.png:0.0 \ 537 calendar_cxx_example_04:calendar_cxx_example_04.png:0.0 \
576 calendar_cxx_example_05:calendar_cxx_example_05.png:0.0 \ 538 calendar_cxx_example_05:calendar_cxx_example_05.png:0.0 \
577 clock_cxx_example:clock_cxx_example.png:0.5 \ 539 clock_cxx_example:clock_cxx_example.png:0.5 \
578 datetime_cxx_example:datetime_cxx_example.png:0.0 \
579 hoversel_cxx_example_01:hoversel_cxx_example_01.png:0.0 \
580 icon_cxx_example_01:icon_cxx_example_01.png:0.0 \ 540 icon_cxx_example_01:icon_cxx_example_01.png:0.0 \
581 menu_cxx_example_01:menu_cxx_example_01.png:0.5 \ 541 menu_cxx_example_01:menu_cxx_example_01.png:0.5 \
582 popup_cxx_example_01:popup_cxx_example_01.png:1.0 \
583 popup_cxx_example_01:popup_cxx_example_01_a.png:6.0 \ 542 popup_cxx_example_01:popup_cxx_example_01_a.png:6.0 \
584 radio_cxx_example_01:radio_cxx_example_01.png:0.0 \ 543 radio_cxx_example_01:radio_cxx_example_01.png:0.0 \
585 slider_cxx_example:slider_cxx_example.png:0.0 \ 544 slider_cxx_example:slider_cxx_example.png:0.0 \
586 spinner_cxx_example:spinner_cxx_example.png:0.0 \ 545 spinner_cxx_example:spinner_cxx_example.png:0.0 \
587 table_cxx_example_01:table_cxx_example_01.png:0.0 \ 546 table_cxx_example_01:table_cxx_example_01.png:0.0 \
588 table_cxx_example_02:table_cxx_example_02.png:0.0 547 table_cxx_example_02:table_cxx_example_02.png:0.0 \
548 toolbar_cxx_example_01:toolbar_cxx_example_01.png:0.0 \
549$(NULL)
589endif 550endif
590 551
591HTML_SS_DIR=$(top_builddir)/doc/html/screenshots 552HTML_SS_DIR=$(top_builddir)/doc/html/screenshots
diff --git a/src/examples/elementary/box_cxx_example_02.cc b/src/examples/elementary/box_cxx_example_02.cc
index 99b257591a..1c0bf81b06 100644
--- a/src/examples/elementary/box_cxx_example_02.cc
+++ b/src/examples/elementary/box_cxx_example_02.cc
@@ -9,11 +9,11 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
9{ 9{
10 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); 10 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
11 11
12 auto win = efl::ui::Win(instantiate); 12 efl::ui::Win win(instantiate);
13 win.text_set("Simple Box Example"); 13 win.text_set("Simple Box Example");
14 win.autohide_set(true); 14 win.autohide_set(true);
15 15
16 auto box = efl::ui::Box(instantiate, win); 16 efl::ui::Box box(instantiate, win);
17 win.content_set(box); 17 win.content_set(box);
18 18
19 for (int i = 0; i < 5; i++) 19 for (int i = 0; i < 5; i++)
diff --git a/src/examples/elementary/button_cxx_example_00.cc b/src/examples/elementary/button_cxx_example_00.cc
index 30c58d84cd..5e899e1591 100644
--- a/src/examples/elementary/button_cxx_example_00.cc
+++ b/src/examples/elementary/button_cxx_example_00.cc
@@ -11,31 +11,31 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
11{ 11{
12 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);
13 13
14 auto win = efl::ui::Win(instantiate); 14 efl::ui::Win win(instantiate);
15 win.text_set("Button Example"); 15 win.text_set("Button Example");
16 win.autohide_set(true); 16 win.autohide_set(true);
17 17
18 auto box = efl::ui::Box(instantiate, win); 18 efl::ui::Box box(instantiate, win);
19 win.content_set(box); 19 win.content_set(box);
20 20
21 auto bt = efl::ui::Button(instantiate, win); 21 efl::ui::Button bt(instantiate, win);
22 bt.text_set("Hello world!"); 22 bt.text_set("Hello world!");
23 box.pack(bt); 23 box.pack(bt);
24 24
25 auto wbt = bt._get_wref(); 25 auto wbt(bt._get_wref());
26 auto cb = std::bind([wbt]() { 26 auto cb(std::bind([wbt]() {
27 std::cout << wbt->text_get() << std::endl; 27 std::cout << wbt->text_get() << std::endl;
28 }); 28 }));
29 efl::eolian::event_add(efl::ui::Clickable::clicked_event, bt, cb); 29 efl::eolian::event_add(efl::ui::Clickable::clicked_event, bt, cb);
30 30
31 auto bt2 = efl::ui::Button(instantiate, win); 31 efl::ui::Button bt2(instantiate, win);
32 bt2.text_set("Click to quit"); 32 bt2.text_set("Click to quit");
33 box.pack(bt2); 33 box.pack(bt2);
34 34
35 auto wwin = win._get_wref(); 35 auto wwin(win._get_wref());
36 auto cb2 = std::bind([wwin]() { 36 auto cb2(std::bind([wwin]() {
37 ::efl_del(wwin->_eo_ptr()); // FIXME: No proper C++ API to delete win 37 ::efl_del(wwin->_eo_ptr()); // FIXME: No proper C++ API to delete win
38 }); 38 }));
39 efl::eolian::event_add(efl::ui::Clickable::clicked_event, bt2, cb2); 39 efl::eolian::event_add(efl::ui::Clickable::clicked_event, bt2, cb2);
40 40
41 win.size_set({320,160}); 41 win.size_set({320,160});
diff --git a/src/examples/elementary/button_cxx_example_01.cc b/src/examples/elementary/button_cxx_example_01.cc
index 72096a3a48..e6b5147af5 100644
--- a/src/examples/elementary/button_cxx_example_01.cc
+++ b/src/examples/elementary/button_cxx_example_01.cc
@@ -1,233 +1,226 @@
1// g++ -g `pkg-config --cflags --libs elementary-cxx efl-cxx eina-cxx eo-cxx ecore-cxx evas-cxx edje-cxx` button_cxx_example_01.cc -o button_cxx_example_01
2
3#define EFL_CXX_WREF_EASY
1#include <Elementary.hh> 4#include <Elementary.hh>
2 5
3EAPI_MAIN int 6using efl::eo::instantiate;
4elm_main(int argc, char *argv[]) 7
8efl::Gfx icon_still(nullptr);
9
10static void
11efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
5{ 12{
6 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); 13 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
7 14
8 ::elm::win_standard win; 15 efl::ui::Win win(instantiate);
9 win.title_set("Button example"); 16 win.text_set("Button example");
10 win.autohide_set(true); 17 win.autohide_set(true);
11 18
12 ::evas::object icon_still(nullptr); 19 efl::ui::Button mid(instantiate, win);
13 ::elm::button mid(efl::eo::parent = win); 20 efl::ui::Button up(instantiate, win);
14 ::elm::button up(efl::eo::parent = win); 21 efl::ui::Button down(instantiate, win);
15 ::elm::button down(efl::eo::parent = win); 22 efl::ui::Button left(instantiate, win);
16 ::elm::button left(efl::eo::parent = win); 23 efl::ui::Button right(instantiate, win);
17 ::elm::button right(efl::eo::parent = win); 24
18 25 efl::ui::Box box(instantiate, win);
19 ::elm::box box(efl::eo::parent = win); 26 win.content_set(box);
20 box.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 27
21 win.resize_object_add(box); 28 efl::ui::Box box_initial(instantiate, win);
22 box.visible_set(true); 29 box_initial.direction_set(EFL_UI_DIR_HORIZONTAL);
23 30 box_initial.hint_weight_set(EFL_GFX_SIZE_HINT_EXPAND, 0.0);
24 ::elm::box box_initial(efl::eo::parent = win);
25 box_initial.horizontal_set(true);
26 box_initial.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0);
27 box.pack_end(box_initial); 31 box.pack_end(box_initial);
28 box_initial.visible_set(true);
29 32
30 ::elm::button btn(efl::eo::parent = win); 33 efl::ui::Button btn(instantiate, win);
31 btn.text_set("elm.text", "Initial: 0.0"); 34 btn.text_set("Initial: 0.0");
32 box_initial.pack_end(btn); 35 box_initial.pack_end(btn);
33 btn.visible_set(true); 36
34 37 auto wup = up._get_wref();
35 auto btn_options = std::bind([&] (evas::clickable_interface ci) 38 auto wdown = up._get_wref();
36 { 39 auto wleft = up._get_wref();
37 ::elm::button b(eo_ref(ci._eo_ptr())); 40 auto wright = up._get_wref();
38 std::string::size_type ptr; 41 auto btn_options = std::bind(
39 efl::eina::optional<std::string> lbl = b.text_get("elm.text"); 42 [wup, wdown, wleft, wright] (efl::ui::Button &button)
40 43 {
41 ptr = lbl->find(":"); 44 efl::ui::Button b(efl::eo::downcast<efl::ui::Button>(button));
42 ptr += 2; 45 efl::eina::optional<std::string> lbl = b.text_get();
43 double t = std::stod(lbl->substr(ptr)); 46 std::string::size_type ptr;
44 47
45 if (lbl->compare(0,7,"Initial") == 0) 48 ptr = lbl->find(":");
46 { 49 ptr += 2;
47 up.autorepeat_initial_timeout_set(t); 50 double t = std::stod(lbl->substr(ptr));
48 down.autorepeat_initial_timeout_set(t); 51
49 left.autorepeat_initial_timeout_set(t); 52 if (lbl->compare(0,7,"Initial") == 0)
50 right.autorepeat_initial_timeout_set(t); 53 {
51 } 54 wup->autorepeat_initial_timeout_set(t);
52 else if (lbl->compare(0,3,"Gap") == 0) 55 wdown->autorepeat_initial_timeout_set(t);
53 { 56 wleft->autorepeat_initial_timeout_set(t);
54 up.autorepeat_gap_timeout_set(t); 57 wright->autorepeat_initial_timeout_set(t);
55 down.autorepeat_gap_timeout_set(t); 58 }
56 left.autorepeat_gap_timeout_set(t); 59 else if (lbl->compare(0,3,"Gap") == 0)
57 right.autorepeat_gap_timeout_set(t); 60 {
58 } 61 wup->autorepeat_gap_timeout_set(t);
59 }, std::placeholders::_1); 62 wdown->autorepeat_gap_timeout_set(t);
60 63 wleft->autorepeat_gap_timeout_set(t);
61 btn.callback_clicked_add(btn_options); 64 wright->autorepeat_gap_timeout_set(t);
62 65 }
63 ::elm::button btn2(efl::eo::parent = win); 66 }, std::placeholders::_1);
64 btn2.text_set("elm.text", "Initial: 1.0"); 67 efl::eolian::event_add(efl::ui::Clickable::clicked_event, btn, btn_options);
68
69 efl::ui::Button btn2(instantiate, win);
70 btn2.text_set("Initial: 1.0");
65 box_initial.pack_end(btn2); 71 box_initial.pack_end(btn2);
66 btn2.visible_set(true); 72 efl::eolian::event_add(efl::ui::Clickable::clicked_event, btn2, btn_options);
67 btn2.callback_clicked_add(btn_options);
68 73
69 ::elm::button btn3(efl::eo::parent = win); 74 efl::ui::Button btn3(instantiate, win);
70 btn3.text_set("elm.text", "Initial: 5.0"); 75 btn3.text_set("Initial: 5.0");
71 box_initial.pack_end(btn3); 76 box_initial.pack_end(btn3);
72 btn3.visible_set(true); 77 efl::eolian::event_add(efl::ui::Clickable::clicked_event, btn3, btn_options);
73 btn3.callback_clicked_add(btn_options);
74 78
75 ::elm::box box_gap(efl::eo::parent = win); 79 efl::ui::Box box_gap(instantiate, win);
76 box_gap.horizontal_set(true); 80 box_gap.direction_set(EFL_UI_DIR_HORIZONTAL);
77 box_gap.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0); 81 box_gap.hint_weight_set(EFL_GFX_SIZE_HINT_EXPAND, 0.0);
78 box.pack_end(box_gap); 82 box.pack_end(box_gap);
79 box_gap.visible_set(true);
80 83
81 ::elm::button btn4(efl::eo::parent = win); 84 efl::ui::Button btn4(instantiate, win);
82 btn4.text_set("elm.text", "Gap: 0.1"); 85 btn4.text_set("Gap: 0.1");
83 box_gap.pack_end(btn4); 86 box_gap.pack_end(btn4);
84 btn4.visible_set(true); 87 efl::eolian::event_add(efl::ui::Clickable::clicked_event, btn4, btn_options);
85 btn4.callback_clicked_add(btn_options);
86 88
87 ::elm::button btn5(efl::eo::parent = win); 89 efl::ui::Button btn5(instantiate, win);
88 btn5.text_set("elm.text", "Gap: 0.5"); 90 btn5.text_set("Gap: 0.5");
89 box_gap.pack_end(btn5); 91 box_gap.pack_end(btn5);
90 btn5.visible_set(true); 92 efl::eolian::event_add(efl::ui::Clickable::clicked_event, btn5, btn_options);
91 btn5.callback_clicked_add(btn_options);
92 93
93 ::elm::button btn6(efl::eo::parent = win); 94 efl::ui::Button btn6(instantiate, win);
94 btn6.text_set("elm.text", "Gap: 1.0"); 95 btn6.text_set("Gap: 1.0");
95 box_gap.pack_end(btn6); 96 box_gap.pack_end(btn6);
96 btn6.visible_set(true); 97 efl::eolian::event_add(efl::ui::Clickable::clicked_event, btn6, btn_options);
97 btn6.callback_clicked_add(btn_options);
98 98
99 up.autorepeat_set(true); 99 up.autorepeat_enabled_set(true);
100 up.autorepeat_initial_timeout_set(1.0); 100 up.autorepeat_initial_timeout_set(1.0);
101 up.autorepeat_gap_timeout_set(0.5); 101 up.autorepeat_gap_timeout_set(0.5);
102 up.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0); 102 up.hint_weight_set(EFL_GFX_SIZE_HINT_EXPAND, 0.0);
103 up.size_hint_align_set(EVAS_HINT_FILL, 0.0); 103 up.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.0);
104 box.pack_end(up); 104 box.pack_end(up);
105 up.visible_set(true); 105
106 106 auto wmid = mid._get_wref();
107 auto btn_cursors_move = std::bind([&] (evas::clickable_interface ci2) 107 auto btn_cursors_move = std::bind(
108 { 108 [wmid, wup, wdown, wleft, wright] (efl::ui::Button &button)
109 ::elm::button button = efl::eo::downcast<elm::button>(ci2); 109 {
110 double ax, ay; 110 efl::ui::Button b(efl::eo::downcast<efl::ui::Button>(button));
111 111 auto pmid = wmid.lock();
112 if (!icon_still) 112 double ax, ay;
113 { 113
114 ::elm::icon obj(efl::eo::parent = mid); 114 if (!pmid) return;
115 efl::eina::optional<evas::object> icon_still_p = mid.content_unset("icon"); 115
116 if(icon_still_p) 116 auto cmid = pmid.get();
117 { 117 if (!icon_still)
118 icon_still = *icon_still_p; 118 {
119 icon_still.visible_set(false); 119 efl::ui::Image obj(instantiate, cmid);
120 } 120 efl::eina::optional<efl::Gfx> icon_still_p = cmid.content_unset();
121 obj.standard_set("chat"); 121 if (icon_still_p)
122 mid.content_set("icon", obj); 122 {
123 } 123 icon_still = *icon_still_p;
124 124 icon_still.visible_set(false);
125 mid.size_hint_align_get(&ax, &ay); 125 }
126 if (button == up) 126 obj.icon_set("chat");
127 { 127 cmid.content_set(obj);
128 ay -= 0.05; 128 }
129 if (ay < 0.0) 129
130 ay = 0.0; 130 cmid.hint_align_get(ax, ay);
131 } 131 if (b == wup)
132 else if (button == down) 132 {
133 { 133 ay -= 0.05;
134 ay += 0.05; 134 if (ay < 0.0)
135 if (ay > 1.0) 135 ay = 0.0;
136 ay = 1.0; 136 }
137 } 137 else if (b == wdown)
138 else if (button == left) 138 {
139 { 139 ay += 0.05;
140 ax -= 0.05; 140 if (ay > 1.0)
141 if (ax < 0.0) 141 ay = 1.0;
142 ax = 0.0; 142 }
143 } 143 else if (b == wleft)
144 else if (button == right) 144 {
145 { 145 ax -= 0.05;
146 ax += 0.05; 146 if (ax < 0.0)
147 if (ax > 1.0) 147 ax = 0.0;
148 ax = 1.0; 148 }
149 } 149 else if (b == wright)
150 mid.size_hint_align_set(ax, ay); 150 {
151 }, std::placeholders::_1); 151 ax += 0.05;
152 152 if (ax > 1.0)
153 up.callback_repeated_add(btn_cursors_move); 153 ax = 1.0;
154 154 }
155 auto btn_cursors_release = std::bind([&] () 155 cmid.hint_align_set(ax, ay);
156 { 156 }, std::placeholders::_1);
157 if (icon_still) 157 efl::eolian::event_add(efl::ui::Clickable::repeated_event, up, btn_cursors_move);
158 { 158
159 mid.content_set("icon", icon_still); 159 auto btn_cursors_release = std::bind(
160 icon_still = evas::object(nullptr); 160 [wmid] ()
161 } 161 {
162 }); 162 if (icon_still)
163 163 {
164 up.callback_unpressed_add(btn_cursors_release); 164 wmid->content_set(icon_still);
165 165 icon_still = nullptr;
166 ::elm::icon icon_up(efl::eo::parent = win); 166 }
167 icon_up.standard_set("arrow_up"); 167 });
168 up.content_set("icon", icon_up); 168 efl::eolian::event_add(efl::ui::Clickable::unpressed_event, up, btn_cursors_release);
169 169
170 ::elm::box box_inferior(efl::eo::parent = win); 170 efl::ui::Image icon_up(instantiate, win);
171 box_inferior.horizontal_set(true); 171 icon_up.icon_set("arrow_up");
172 box_inferior.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 172 up.content_set(icon_up);
173 box_inferior.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL); 173
174 efl::ui::Box box_inferior(instantiate, win);
175 box_inferior.direction_set(EFL_UI_DIR_HORIZONTAL);
174 box.pack_end(box_inferior); 176 box.pack_end(box_inferior);
175 box_inferior.visible_set(true); 177 box_inferior.visible_set(true);
176 178
177 left.autorepeat_set(true); 179 left.autorepeat_enabled_set(true);
178 left.autorepeat_initial_timeout_set(1.0); 180 left.autorepeat_initial_timeout_set(1.0);
179 left.autorepeat_gap_timeout_set(0.5); 181 left.autorepeat_gap_timeout_set(0.5);
180 left.size_hint_weight_set(0.0, EVAS_HINT_EXPAND); 182 left.hint_weight_set(0.0, EFL_GFX_SIZE_HINT_EXPAND);
181 left.size_hint_align_set(0.0, EVAS_HINT_FILL); 183 left.hint_align_set(0.0, EFL_GFX_SIZE_HINT_FILL);
182 box_inferior.pack_end(left); 184 box_inferior.pack_end(left);
183 left.visible_set(true); 185 efl::eolian::event_add(efl::ui::Clickable::repeated_event, left, btn_cursors_move);
184 left.callback_repeated_add(btn_cursors_move); 186 efl::eolian::event_add(efl::ui::Clickable::unpressed_event, left, btn_cursors_release);
185 left.callback_unpressed_add(btn_cursors_release);
186 187
187 ::elm::icon icon_left(efl::eo::parent = win); 188 efl::ui::Image icon_left(instantiate, win);
188 icon_left.standard_set("arrow_left"); 189 icon_left.icon_set("arrow_left");
189 left.content_set("icon", icon_left); 190 left.content_set(icon_left);
190 191
191 mid.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
192 box_inferior.pack_end(mid); 192 box_inferior.pack_end(mid);
193 mid.visible_set(true);
194 193
195 ::elm::icon icon_mid(efl::eo::parent = win); 194 efl::ui::Image icon_mid(instantiate, win);
196 icon_mid.standard_set("close"); 195 icon_mid.icon_set("close");
197 mid.content_set("icon", icon_mid); 196 mid.content_set(icon_mid);
198 197
199 right.autorepeat_set(true); 198 right.autorepeat_enabled_set(true);
200 right.autorepeat_initial_timeout_set(1.0); 199 right.autorepeat_initial_timeout_set(1.0);
201 right.autorepeat_gap_timeout_set(0.5); 200 right.autorepeat_gap_timeout_set(0.5);
202 right.size_hint_weight_set(0.0, EVAS_HINT_EXPAND); 201 right.hint_weight_set(0.0, EFL_GFX_SIZE_HINT_EXPAND);
203 right.size_hint_align_set(0.0, EVAS_HINT_FILL); 202 right.hint_align_set(0.0, EFL_GFX_SIZE_HINT_FILL);
204 box_inferior.pack_end(right); 203 box_inferior.pack_end(right);
205 right.visible_set(true); 204 efl::eolian::event_add(efl::ui::Clickable::repeated_event, right, btn_cursors_move);
206 right.callback_repeated_add(btn_cursors_move); 205 efl::eolian::event_add(efl::ui::Clickable::unpressed_event, right, btn_cursors_release);
207 right.callback_unpressed_add(btn_cursors_release);
208 206
209 ::elm::icon icon_right(efl::eo::parent = win); 207 efl::ui::Image icon_right(instantiate, win);
210 icon_right.standard_set("arrow_right"); 208 icon_right.icon_set("arrow_right");
211 right.content_set("icon", icon_right); 209 right.content_set(icon_right);
212 210
213 down.autorepeat_set(true); 211 down.autorepeat_enabled_set(true);
214 down.autorepeat_initial_timeout_set(1.0); 212 down.autorepeat_initial_timeout_set(1.0);
215 down.autorepeat_gap_timeout_set(0.5); 213 down.autorepeat_gap_timeout_set(0.5);
216 down.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0); 214 down.hint_weight_set(EFL_GFX_SIZE_HINT_EXPAND, 0.0);
217 down.size_hint_align_set(EVAS_HINT_FILL, 0.0); 215 down.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.0);
218 box.pack_end(down); 216 box.pack_end(down);
219 down.visible_set(true); 217 efl::eolian::event_add(efl::ui::Clickable::repeated_event, down, btn_cursors_move);
220 down.callback_repeated_add(btn_cursors_move); 218 efl::eolian::event_add(efl::ui::Clickable::unpressed_event, down, btn_cursors_release);
221 down.callback_unpressed_add(btn_cursors_release);
222
223 ::elm::icon icon_down(efl::eo::parent = win);
224 icon_down.standard_set("arrow_down");
225 down.content_set("icon", icon_down);
226 219
227 win.size_set(300, 320); 220 efl::ui::Image icon_down(instantiate, win);
228 win.visible_set(true); 221 icon_down.icon_set("arrow_down");
222 down.content_set(icon_down);
229 223
230 elm_run(); 224 win.size_set({300, 320});
231 return 0;
232} 225}
233ELM_MAIN() 226EFL_MAIN()
diff --git a/src/examples/elementary/calendar_cxx_example_01.cc b/src/examples/elementary/calendar_cxx_example_01.cc
index 4e24fff699..0d89dfe2d6 100644
--- a/src/examples/elementary/calendar_cxx_example_01.cc
+++ b/src/examples/elementary/calendar_cxx_example_01.cc
@@ -1,8 +1,3 @@
1#ifdef HAVE_CONFIG_H
2#include "config.h"
3#include "elementary_config.h"
4#endif
5
6#include <Elementary.hh> 1#include <Elementary.hh>
7 2
8using efl::eo::instantiate; 3using efl::eo::instantiate;
@@ -12,11 +7,11 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
12{ 7{
13 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); 8 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
14 9
15 auto win = efl::ui::Win(instantiate); 10 efl::ui::Win win(instantiate);
16 win.text_set("Calendar Creation Example"); 11 win.text_set("Calendar Creation Example");
17 win.autohide_set(true); 12 win.autohide_set(true);
18 13
19 auto cal = efl::ui::Calendar(instantiate, win); 14 efl::ui::Calendar cal(instantiate, win);
20 win.content_set(cal); 15 win.content_set(cal);
21 16
22 win.size_set({320,320}); 17 win.size_set({320,320});
diff --git a/src/examples/elementary/calendar_cxx_example_02.cc b/src/examples/elementary/calendar_cxx_example_02.cc
index 6027b1658d..cec2342be4 100644
--- a/src/examples/elementary/calendar_cxx_example_02.cc
+++ b/src/examples/elementary/calendar_cxx_example_02.cc
@@ -1,9 +1,3 @@
1#ifdef HAVE_CONFIG_H
2#include "config.h"
3#include "elementary_config.h"
4#endif
5
6#include <Efl.hh>
7#include <Elementary.hh> 1#include <Elementary.hh>
8 2
9using efl::eo::instantiate; 3using efl::eo::instantiate;
diff --git a/src/examples/elementary/calendar_cxx_example_03.cc b/src/examples/elementary/calendar_cxx_example_03.cc
index c780987f48..5b44afb557 100644
--- a/src/examples/elementary/calendar_cxx_example_03.cc
+++ b/src/examples/elementary/calendar_cxx_example_03.cc
@@ -1,8 +1,3 @@
1#ifdef HAVE_CONFIG_H
2#include "config.h"
3#include "elementary_config.h"
4#endif
5
6#include <Elementary.hh> 1#include <Elementary.hh>
7 2
8using efl::eo::instantiate; 3using efl::eo::instantiate;
@@ -17,11 +12,11 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
17 min.tm_year = 2020 - 1900; 12 min.tm_year = 2020 - 1900;
18 max.tm_year = 2022 - 1900; 13 max.tm_year = 2022 - 1900;
19 14
20 auto win = efl::ui::Win(instantiate); 15 efl::ui::Win win(instantiate);
21 win.text_set("Calendar Min/Max Year Example"); 16 win.text_set("Calendar Min/Max Year Example");
22 win.autohide_set(true); 17 win.autohide_set(true);
23 18
24 auto cal = efl::ui::Calendar(instantiate, win); 19 efl::ui::Calendar cal(instantiate, win);
25 win.content_set(cal); 20 win.content_set(cal);
26 cal.date_min_set(min); 21 cal.date_min_set(min);
27 cal.date_max_set(max); 22 cal.date_max_set(max);
diff --git a/src/examples/elementary/calendar_cxx_example_04.cc b/src/examples/elementary/calendar_cxx_example_04.cc
index e0983268f8..aec44c1295 100644
--- a/src/examples/elementary/calendar_cxx_example_04.cc
+++ b/src/examples/elementary/calendar_cxx_example_04.cc
@@ -1,12 +1,7 @@
1#ifdef HAVE_CONFIG_H 1#include <Elementary.hh>
2#include "config.h"
3#include "elementary_config.h"
4#endif
5 2
6#warning This example can't be implemented with EO APIs... FIXME 3#warning This example can't be implemented with EO APIs... FIXME
7 4
8#include <Elementary.hh>
9
10using efl::eo::instantiate; 5using efl::eo::instantiate;
11 6
12#define SECS_DAY 86400 7#define SECS_DAY 86400
diff --git a/src/examples/elementary/calendar_cxx_example_05.cc b/src/examples/elementary/calendar_cxx_example_05.cc
index f5185eff45..8b54d85654 100644
--- a/src/examples/elementary/calendar_cxx_example_05.cc
+++ b/src/examples/elementary/calendar_cxx_example_05.cc
@@ -1,12 +1,7 @@
1#ifdef HAVE_CONFIG_H 1#include <Elementary.hh>
2#include "config.h"
3#include "elementary_config.h"
4#endif
5 2
6#warning This example can't be implemented with EO APIs... FIXME 3#warning This example can't be implemented with EO APIs... FIXME
7 4
8#include <Elementary.hh>
9
10EAPI_MAIN int 5EAPI_MAIN int
11elm_main (int argc EINA_UNUSED, char **argv EINA_UNUSED) 6elm_main (int argc EINA_UNUSED, char **argv EINA_UNUSED)
12{ 7{
diff --git a/src/examples/elementary/clock_cxx_example.cc b/src/examples/elementary/clock_cxx_example.cc
index 9939746468..a290c08267 100644
--- a/src/examples/elementary/clock_cxx_example.cc
+++ b/src/examples/elementary/clock_cxx_example.cc
@@ -1,8 +1,3 @@
1#ifdef HAVE_CONFIG_H
2#include "config.h"
3#include "elementary_config.h"
4#endif
5
6#include <Elementary.hh> 1#include <Elementary.hh>
7 2
8using efl::eo::instantiate; 3using efl::eo::instantiate;
diff --git a/src/examples/elementary/glview_cxx_example_01.cc b/src/examples/elementary/glview_cxx_example_01.cc
deleted file mode 100644
index b94d8c26ca..0000000000
--- a/src/examples/elementary/glview_cxx_example_01.cc
+++ /dev/null
@@ -1,263 +0,0 @@
1#include <Elementary.hh>
2
3#include <Evas_GL.h>
4#include <stdio.h>
5
6typedef struct _GLData GLData;
7
8struct _GLData
9{
10 Evas_GL_API *glapi;
11 GLuint program;
12 GLuint vtx_shader;
13 GLuint fgmt_shader;
14 GLuint vbo;
15 int initialized : 1;
16};
17
18static float red = 1.0;
19
20static GLuint
21load_shader(GLData *gld, GLenum type, const char *shader_src )
22{
23 Evas_GL_API *gl = gld->glapi;
24 GLuint shader;
25 GLint compiled;
26
27 shader = gl->glCreateShader(type);
28 if (shader==0)
29 return 0;
30
31 gl->glShaderSource(shader, 1, &shader_src, NULL);
32 gl->glCompileShader(shader);
33 gl->glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
34
35 if (!compiled)
36 {
37 GLint info_len = 0;
38 gl->glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &info_len);
39 if (info_len > 1)
40 {
41 char* info_log = new char[sizeof(char) * info_len];
42
43 gl->glGetShaderInfoLog(shader, info_len, NULL, info_log);
44 printf("Error compiling shader:\n%s\n======\n%s\n======\n", info_log, shader_src );
45 delete [] info_log;
46 }
47 gl->glDeleteShader(shader);
48 return 0;
49 }
50
51 return shader;
52}
53
54static int
55init_shaders(GLData *gld)
56{
57 Evas_GL_API *gl = gld->glapi;
58
59 GLbyte vShaderStr[] =
60 "attribute vec4 vPosition; \n"
61 "void main() \n"
62 "{ \n"
63 " gl_Position = vPosition; \n"
64 "} \n";
65
66 GLbyte fShaderStr[] =
67 "#ifdef GL_ES \n"
68 "precision mediump float; \n"
69 "#endif \n"
70 "void main() \n"
71 "{ \n"
72 " gl_FragColor = vec4 ( 1.0, 0.0, 0.0, 1.0 );\n"
73 "} \n";
74
75 GLint linked;
76
77 gld->vtx_shader = load_shader(gld, GL_VERTEX_SHADER, (const char*)vShaderStr);
78 gld->fgmt_shader = load_shader(gld, GL_FRAGMENT_SHADER, (const char*)fShaderStr);
79
80 gld->program = gl->glCreateProgram( );
81 if (gld->program==0)
82 return 0;
83
84 gl->glAttachShader(gld->program, gld->vtx_shader);
85 gl->glAttachShader(gld->program, gld->fgmt_shader);
86
87 gl->glBindAttribLocation(gld->program, 0, "vPosition");
88 gl->glLinkProgram(gld->program);
89 gl->glGetProgramiv(gld->program, GL_LINK_STATUS, &linked);
90
91 if (!linked)
92 {
93 GLint info_len = 0;
94 gl->glGetProgramiv(gld->program, GL_INFO_LOG_LENGTH, &info_len);
95 if (info_len > 1)
96 {
97 char* info_log = new char[sizeof(char) * info_len];
98
99 gl->glGetProgramInfoLog(gld->program, info_len, NULL, info_log);
100 printf("Error linking program:\n%s\n", info_log);
101 delete [] info_log;
102 }
103 gl->glDeleteProgram(gld->program);
104 return 0;
105 }
106 return 1;
107}
108
109static void
110_init_gl(Evas_Object *obj)
111{
112 GLData *gld = static_cast<GLData*>(evas_object_data_get(obj, "gld"));
113 assert(gld != 0);
114 ::elm::glview glv(eo_ref(obj));
115 Evas_GL_API *gl = glv.gl_api_get();
116 GLfloat vVertices[] = {
117 0.0f, 0.5f, 0.0f,
118 -0.5f, -0.5f, 0.0f,
119 0.5f, -0.5f, 0.0f };
120
121 if (!init_shaders(gld))
122 {
123 std::cout << "Error Initializing Shaders" << std::endl;
124 return;
125 }
126
127 gl->glGenBuffers(1, &gld->vbo);
128 gl->glBindBuffer(GL_ARRAY_BUFFER, gld->vbo);
129 gl->glBufferData(GL_ARRAY_BUFFER, 3 * 3 * 4, vVertices, GL_STATIC_DRAW);
130
131}
132
133static void
134_del_gl(Evas_Object *obj)
135{
136 GLData *gld = static_cast<GLData*>(evas_object_data_get(obj, "gld"));
137 if (!gld)
138 {
139 std::cout << "Unable to get GLData. " << std::endl;
140 return;
141 }
142 ::elm::glview glv(eo_ref(obj));
143 Evas_GL_API *gl = glv.gl_api_get();
144
145 gl->glDeleteShader(gld->vtx_shader);
146 gl->glDeleteShader(gld->fgmt_shader);
147 gl->glDeleteProgram(gld->program);
148 gl->glDeleteBuffers(1, &gld->vbo);
149
150 evas_object_data_del(obj, "..gld");
151 free(gld);
152}
153
154static void
155_resize_gl(Evas_Object *obj)
156{
157 int w, h;
158 ::elm::glview glv(eo_ref(obj));
159 Evas_GL_API *gl = glv.gl_api_get();
160
161 glv.size_get(&w, &h);
162
163 gl->glViewport(0, 0, w, h);
164}
165
166static void
167_draw_gl(Evas_Object *obj)
168{
169 GLData *gld = static_cast<GLData*>(evas_object_data_get(obj, "gld"));
170 ::elm::glview glv(eo_ref(obj));
171 Evas_GL_API *gl = glv.gl_api_get();
172
173 if (!gld) return;
174 int w, h;
175
176 glv.size_get(&w, &h);
177
178 gl->glViewport(0, 0, w, h);
179 gl->glClearColor(red,0.8,0.3,1);
180 gl->glClear(GL_COLOR_BUFFER_BIT);
181
182 gl->glEnable(GL_BLEND);
183
184 gl->glUseProgram(gld->program);
185
186 gl->glBindBuffer(GL_ARRAY_BUFFER, gld->vbo);
187 gl->glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
188 gl->glEnableVertexAttribArray(0);
189
190 gl->glDrawArrays(GL_TRIANGLES, 0, 3);
191
192 gl->glFinish();
193
194 red -= 0.1;
195 if (red < 0.0) red = 1.0;
196}
197
198static Eina_Bool
199_anim(void* data)
200{
201 static_cast<elm::glview*>(data)->changed_set();
202
203 return EINA_TRUE;
204}
205
206EAPI_MAIN int
207elm_main (int argc, char *argv[])
208{
209 GLData *gld = NULL;
210
211 if (!(gld = static_cast<GLData*>(calloc(1, sizeof(GLData))))) return 1;
212
213 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
214
215 ::elm::win win(elm_win_util_standard_add("glview simple", "GLView Simple"));
216 win.autohide_set(true);
217
218 ::elm::box bx(efl::eo::parent = win);
219 bx.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
220 win.resize_object_add(bx);
221 bx.visible_set(true);
222
223 ::elm::glview gl(efl::eo::parent = win,
224 gl.version_constructor(EVAS_GL_GLES_2_X));
225 gld->glapi = gl.gl_api_get();
226 gl.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
227 gl.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
228
229 int gl_mode = ELM_GLVIEW_ALPHA | ELM_GLVIEW_DEPTH;
230 gl.mode_set(static_cast<Elm_GLView_Mode>(gl_mode));
231 gl.resize_policy_set(ELM_GLVIEW_RESIZE_POLICY_RECREATE);
232 gl.render_policy_set(ELM_GLVIEW_RENDER_POLICY_ON_DEMAND);
233 gl.init_func_set(_init_gl);
234 gl.del_func_set(_del_gl);
235 gl.resize_func_set(_resize_gl);
236 gl.render_func_set(_draw_gl);
237
238 bx.pack_end(gl);
239 gl.visible_set(true);
240
241 gl.object::focus_set(true);
242
243 Ecore_Animator *ani = ecore_animator_add(_anim, &gl);
244
245 evas_object_data_set(gl._eo_ptr(), "ani", ani);
246 evas_object_data_set(gl._eo_ptr(), "gld", gld);
247 gl.object::callback_del_add(std::bind([&] () { ecore_animator_del(ani); }));
248
249 ::elm::button bt(efl::eo::parent = win);
250 bt.text_set(nullptr, "OK");
251 bt.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
252 bt.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0);
253 bx.pack_end(bt);
254 bt.visible_set(true);
255 bt.callback_clicked_add(std::bind([] () { elm_exit(); }));
256
257 win.size_set(320, 480);
258 win.visible_set(true);
259
260 elm_run();
261 return 0;
262}
263ELM_MAIN()
diff --git a/src/examples/elementary/hoversel_cxx_example_01.cc b/src/examples/elementary/hoversel_cxx_example_01.cc
deleted file mode 100644
index 13d8187cc5..0000000000
--- a/src/examples/elementary/hoversel_cxx_example_01.cc
+++ /dev/null
@@ -1,84 +0,0 @@
1#include <Elementary.hh>
2#include <Eina.hh>
3#include <Evas.hh>
4
5static void _print_items(void *data, Evas_Object *obj, void *event_info);
6static void _free(void *data, Evas_Object *obj, void *event_info);
7
8EAPI_MAIN int
9elm_main (int argc, char *argv[])
10{
11 efl::eina::eina_init eina_init;
12
13 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
14
15 ::elm::win::Standard win;
16 win.title_set("Hoversel");
17 win.autohide_set(true);
18
19 ::evas::Rectangle rect(efl::eo::parent = win);
20 rect.color_set(255, 0, 0, 255);
21 rect.visible_set(true);
22
23 ::elm::hoversel hoversel(efl::eo::parent = win);
24 hoversel.horizontal_set(false);
25 hoversel.part_text_set("elm.text", "Add an item to Hoversel");
26 hoversel.part_content_set(nullptr, rect);
27
28 hoversel.item_add("Print items", nullptr, ELM_ICON_NONE, &_print_items, NULL);
29 hoversel.item_add( "Option 2", "home", ELM_ICON_STANDARD, NULL,NULL);
30
31 auto add_item = std::bind([] (::elm::hoversel obj)
32 {
33 static int num = 0;
34 char *str = new char[sizeof(char) * 10];
35
36 snprintf(str, 10, "item %d", ++num);
37
38 elm::widget_item hoversel_item = obj.item_add(str, nullptr, ELM_ICON_NONE, NULL, str);
39 elm_object_item_del_cb_set(hoversel_item._eo_ptr(), &_free);
40 }, std::placeholders::_1);
41
42 hoversel.callback_clicked_add(add_item);
43
44 hoversel.size_set(180, 30);
45 hoversel.position_set( 10, 10);
46 hoversel.visible_set(true);
47
48 ::elm::button btn(efl::eo::parent = win);
49 btn.text_set("elm.text", "Clear all Items");
50
51 auto clear_btn_clicked = std::bind([&] () { hoversel.clear(); });
52
53 btn.callback_clicked_add(clear_btn_clicked);
54 btn.size_set(180, 30);
55 btn.position_set(10, 50);
56 btn.visible_set(true);
57
58 win.size_set(200, 300);
59 win.visible_set(true);
60
61 elm_run();
62
63 return 0;
64}
65ELM_MAIN()
66
67static void
68_print_items(void *data, Evas_Object *obj, void *event_info)
69{
70 efl::eina::range_list<const elm::hoversel_item> items(elm_hoversel_items_get(obj));
71
72 for (auto i : items)
73 try
74 {
75 std::cout << i.part_text_get(nullptr) << std::endl;
76 }
77 catch (std::logic_error const&) {}
78}
79
80static void
81_free(void *data, Evas_Object *obj, void *event_info)
82{
83 delete[] static_cast<char *>(data);
84}
diff --git a/src/examples/elementary/icon_cxx_example_01.cc b/src/examples/elementary/icon_cxx_example_01.cc
index c3eb91de93..8ca0f2ff19 100644
--- a/src/examples/elementary/icon_cxx_example_01.cc
+++ b/src/examples/elementary/icon_cxx_example_01.cc
@@ -1,8 +1,3 @@
1#ifdef HAVE_CONFIG_H
2#include "config.h"
3#include "elementary_config.h"
4#endif
5
6#include <Elementary.hh> 1#include <Elementary.hh>
7 2
8EAPI_MAIN int 3EAPI_MAIN int
@@ -30,13 +25,8 @@ elm_main (int argc EINA_UNUSED, char **argv EINA_UNUSED)
30 //icon.smooth_set(false); 25 //icon.smooth_set(false);
31 //icon.fill_outside_set(true); 26 //icon.fill_outside_set(true);
32 27
33 // icon.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 28 win.content_set(icon);
34 //win.resize_object_add(icon); 29 win.size_set({320, 320});
35 icon.eo_cxx::efl::Gfx::size_set({320,320});
36 icon.visible_set(true);
37
38 win.eo_cxx::efl::Gfx::size_set({320, 320});
39 win.visible_set(true);
40 30
41 elm_run(); 31 elm_run();
42 return 0; 32 return 0;
diff --git a/src/examples/elementary/location_cxx_example_01.cc b/src/examples/elementary/location_cxx_example_01.cc
deleted file mode 100644
index b31adee425..0000000000
--- a/src/examples/elementary/location_cxx_example_01.cc
+++ /dev/null
@@ -1,82 +0,0 @@
1#include <Elementary.hh>
2
3#ifdef ELM_ELOCATION
4#include <Elocation.h>
5#endif
6
7#ifdef ELM_ELOCATION
8static void
9_print_position(Elocation_Position *position, ::elm::label label)
10{
11 char buffer[1024];
12
13 if (!position) return;
14 snprintf(buffer, sizeof(buffer),
15 "<b>GeoClue position reply with data from timestamp</b> %i<br/>"
16 "<b>Latitude:</b> %f<br/>"
17 "<b>Longitude:</b> %f<br/>"
18 "<b>Altitude:</b> %f<br/>"
19 "<b>Accuracy level:</b> %i<br/>"
20 "<b>Accuracy horizontal:</b> %f<br/>"
21 "<b>Accuracy vertical:</b> %f",
22 position->timestamp, position->latitude, position->longitude,
23 position->altitude, position->accur->level,
24 position->accur->horizontal, position->accur->vertical);
25 label.text_set("elm.text", buffer);
26}
27
28static Eina_Bool
29_position_changed(void *data, int ev_type, void *event)
30{
31 Elocation_Position *position;
32
33 position = static_cast<Elocation_Position*>(event);
34 _print_position(position, *static_cast<::elm::label*>(data));
35 return ECORE_CALLBACK_DONE;
36}
37#endif
38
39EAPI_MAIN int
40elm_main(int argc, char *argv[])
41{
42#ifdef ELM_ELOCATION
43 Elocation_Address *address;
44 Elocation_Position *position;
45#endif
46
47 if (elm_need_elocation() == false)
48 return -1;
49
50 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
51
52 ::elm::win win(elm_win_util_standard_add("elocation", "Elocation example"));
53 win.autohide_set(true);
54
55 ::elm::label label(efl::eo::parent = win);
56 label.line_wrap_set(ELM_WRAP_CHAR);
57 label.text_set("elm.text", "Getting location ...");
58 label.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0);
59 label.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
60 label.slide_mode_set(ELM_LABEL_SLIDE_MODE_ALWAYS);
61 label.size_set(600, 480);
62 label.visible_set(true);
63
64#ifdef ELM_ELOCATION
65 address = elocation_address_new();
66 position = elocation_position_new();
67
68 ecore_event_handler_add(ELOCATION_EVENT_POSITION, _position_changed, &label);
69
70 elocation_position_get(position);
71 _print_position(position, label);
72#endif
73
74 win.size_set(600, 480);
75 win.visible_set(true);
76
77 elm_run();
78 return 0;
79}
80ELM_MAIN()
81
82
diff --git a/src/examples/elementary/menu_cxx_example_01.cc b/src/examples/elementary/menu_cxx_example_01.cc
index 9aeb35e580..cf6cb5cedd 100644
--- a/src/examples/elementary/menu_cxx_example_01.cc
+++ b/src/examples/elementary/menu_cxx_example_01.cc
@@ -1,18 +1,19 @@
1#include <Elementary.hh> 1#include <Elementary.hh>
2#include <Eina.hh> 2
3#include <Evas.hh> 3#warning This example can't be implemented with EO APIs... FIXME
4 4
5EAPI_MAIN int 5EAPI_MAIN int
6elm_main (int argc, char *argv[]) 6elm_main (int argc EINA_UNUSED, char *argv[] EINA_UNUSED)
7{ 7{
8 efl::eina::eina_init eina_init; 8 efl::eina::eina_init eina_init;
9 9
10 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); 10 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
11 11
12 ::elm::win_standard win; 12 efl::ui::Win win(efl::eo::instantiate);
13 win.title_set("Menu"); 13 win.text_set("Menu Example");
14 win.autohide_set(true); 14 win.autohide_set(true);
15 15
16#if 0
16 evas::rectangle rect(efl::eo::parent = win); 17 evas::rectangle rect(efl::eo::parent = win);
17 win.resize_object_add(rect); 18 win.resize_object_add(rect);
18 rect.size_hint_min_set(0, 0); 19 rect.size_hint_min_set(0, 0);
@@ -60,8 +61,8 @@ elm_main (int argc, char *argv[])
60 rect.callback_mouse_down_add( show ); 61 rect.callback_mouse_down_add( show );
61 menu.visible_set(true); 62 menu.visible_set(true);
62 63
63 win.size_set(250, 350); 64#endif
64 win.visible_set(true); 65 win.size_set({250, 350});
65 66
66 elm_run(); 67 elm_run();
67 return 0; 68 return 0;
diff --git a/src/examples/elementary/popup_cxx_example_01.cc b/src/examples/elementary/popup_cxx_example_01.cc
deleted file mode 100644
index a678533114..0000000000
--- a/src/examples/elementary/popup_cxx_example_01.cc
+++ /dev/null
@@ -1,32 +0,0 @@
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 ::elm::win_standard win;
9 win.title_set("Popup");
10 win.autohide_set(true);
11
12 ::elm::popup popup(efl::eo::parent = win);
13 popup.timeout_set(3.0);
14 popup.text_set(nullptr, "Title");
15 popup.visible_set(true);
16
17 auto popup_hide = std::bind ( [&] ()
18 {
19 popup.visible_set(false);
20 });
21
22 popup.callback_timeout_add(popup_hide);
23 popup.callback_block_clicked_add(popup_hide);
24 win.size_set(480, 800);
25 win.visible_set(true);
26
27 elm_run();
28 return 0;
29}
30ELM_MAIN()
31
32
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()
diff --git a/src/examples/elementary/slider_cxx_example.cc b/src/examples/elementary/slider_cxx_example.cc
index 4f6f948c04..797e1bd5b6 100644
--- a/src/examples/elementary/slider_cxx_example.cc
+++ b/src/examples/elementary/slider_cxx_example.cc
@@ -1,109 +1,89 @@
1// g++ -g `pkg-config --cflags --libs elementary-cxx efl-cxx eina-cxx eo-cxx ecore-cxx evas-cxx edje-cxx` slider_cxx_example.cc -o slider_cxx_example
2
1#include <Elementary.hh> 3#include <Elementary.hh>
2 4
3EAPI_MAIN int 5using efl::eo::instantiate;
4elm_main (int argc, char *argv[]) 6
7static void
8efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
5{ 9{
6 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); 10 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
7 11
8 ::elm::win win(elm_win_util_standard_add("slider", "Slider Example")); 12 efl::ui::Win win(instantiate);
13 win.text_set("Slider example");
9 win.autohide_set(true); 14 win.autohide_set(true);
10 15
11 ::elm::box bx(efl::eo::parent = win); 16 efl::ui::Box bx(instantiate, win);
12 bx.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 17 win.content_set(bx);
13 win.resize_object_add(bx);
14 bx.visible_set(true);
15 18
16 ::elm::slider sl(efl::eo::parent = win); 19 efl::ui::Slider sl(instantiate, win);
17 sl.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 20 sl.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5);
18 sl.size_hint_align_set(EVAS_HINT_FILL, 0.5);
19 bx.pack_end(sl); 21 bx.pack_end(sl);
20 sl.visible_set(true); 22
21 23 efl::ui::Slider sl2(instantiate, win);
22 ::elm::slider sl2(efl::eo::parent = win); 24 sl2.text_set("Counter");
23 sl2.text_set("elm.text", "Counter"); 25 efl::ui::Image ic(instantiate, win);
24 ::elm::icon ic(efl::eo::parent = win); 26 ic.icon_set("home");
25 ic.standard_set("home"); 27 ic.scalable_set(false, false);
26 ic.resizable_set(false, false); 28 sl2.content_set(ic);
27 sl2.content_set("icon", ic); 29
28 30 efl::ui::Image ic2(instantiate, win);
29 ::elm::icon ic2(efl::eo::parent = win); 31 ic2.icon_set("folder");
30 ic2.standard_set("folder"); 32 ic2.scalable_set(false, false);
31 ic2.resizable_set(false, false); 33 efl::eo::downcast<efl::Container>(sl2.part("end")).content_set(ic2);
32 sl2.content_set("end", ic2); 34
33 35 sl2.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5);
34 sl2.size_hint_align_set(EVAS_HINT_FILL, 0.5);
35 sl2.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
36 bx.pack_end(sl2); 36 bx.pack_end(sl2);
37 sl2.visible_set(true);
38 37
39 ::elm::slider sl3(efl::eo::parent = win); 38 efl::ui::Slider sl3(instantiate, win);
40 sl3.value_set(1); 39 sl3.range_value_set(1);
41 sl3.hint_min_set(220, 0); 40 sl3.hint_min_set({220, 0});
42 sl3.size_hint_align_set(EVAS_HINT_FILL, 0.5); 41 sl3.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5);
43 sl3.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
44 bx.pack_end(sl3); 42 bx.pack_end(sl3);
45 sl3.visible_set(true);
46 43
47 ::elm::slider sl4(efl::eo::parent = win); 44 efl::ui::Slider sl4(instantiate, win);
48 sl4.unit_format_set("%1.0f units"); 45 sl4.format_string_set("%1.0f units");
49 sl4.min_max_set(0, 100); 46 sl4.range_min_max_set(0, 100);
50 sl4.size_hint_align_set(EVAS_HINT_FILL, 0.5); 47 sl4.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5);
51 sl4.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
52 bx.pack_end(sl4); 48 bx.pack_end(sl4);
53 sl4.visible_set(true);
54 49
55 ::elm::slider sl5(efl::eo::parent = win); 50 efl::ui::Slider sl5(instantiate, win);
56 sl5.indicator_format_set("%1.2f"); 51 sl5.indicator_format_set("%1.2f");
57 sl5.inverted_set(true); 52 sl4.direction_set(EFL_UI_DIR_UP);
58 sl5.size_hint_align_set(EVAS_HINT_FILL, 0.5); 53 sl5.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5);
59 sl5.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
60 bx.pack_end(sl5); 54 bx.pack_end(sl5);
61 sl5.visible_set(true);
62 55
63 ::elm::slider sl6(efl::eo::parent = win); 56 efl::ui::Slider sl6(instantiate, win);
64 sl6.horizontal_set(false); 57 sl4.direction_set(EFL_UI_DIR_HORIZONTAL);
65 58
66 auto indicator_format = [] (double val) { 59// FIXME
67 char *indicator = new char[32]; 60// auto indicator_format = [] (double val) {
68 snprintf(indicator, 32, "%1.2f u", val); 61// char *indicator = new char[32];
69 return indicator; 62// snprintf(indicator, 32, "%1.2f u", val);
70 }; 63// return indicator;
64// };
65// auto indicator_free = [] (char *obj) {delete obj;} ;
66// sl6.indicator_format_function_set(indicator_format, indicator_free);
71 67
72 auto indicator_free = [] (char *obj) {delete obj;} ; 68 sl6.hint_align_set(0.5, EFL_GFX_SIZE_HINT_FILL);
73 69 sl6.hint_weight_set(0, EFL_GFX_SIZE_HINT_EXPAND);
74 sl6.indicator_format_function_set(indicator_format, indicator_free);
75
76 sl6.size_hint_align_set(0.5, EVAS_HINT_FILL);
77 sl6.size_hint_weight_set(0, EVAS_HINT_EXPAND);
78 bx.pack_end(sl6); 70 bx.pack_end(sl6);
79 sl6.visible_set(true);
80 71
81 ::elm::slider sl7(efl::eo::parent = win); 72 efl::ui::Slider sl7(instantiate, win);
82 sl7.unit_format_set("%1.3f units"); 73 sl7.format_string_set("%1.3f units");
83 sl7.indicator_format_function_set(indicator_format, indicator_free); 74// sl7.indicator_format_function_set(indicator_format, indicator_free);
84 sl7.size_hint_align_set(EVAS_HINT_FILL, 0.5); 75 sl7.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5);
85 sl7.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
86 bx.pack_end(sl7); 76 bx.pack_end(sl7);
87 sl7.visible_set(true);
88
89 auto changed = std::bind ( [] (::elm::slider obj)
90 {
91 double val = obj.value_get();
92 std::cout << "Changed to " << val << std::endl;
93 } , std::placeholders::_1 );
94
95 auto delay = std::bind ( [] (::elm::slider obj)
96 {
97 double val = obj.value_get();
98 std::cout << "Delay changed to " << val << std::endl;
99 } , std::placeholders::_1 );
100 77
101 sl7.callback_changed_add(changed); 78 auto changed = std::bind ( [] (efl::ui::Slider obj)
102 sl7.callback_delay_changed_add(delay); 79 { std::cout << "Changed to " << obj.range_value_get() << std::endl; }
80 , std::placeholders::_1);
103 81
104 win.visible_set(true); 82 auto delay = std::bind ( [] (efl::ui::Slider obj)
83 { std::cout << "Delay changed to " << obj.range_value_get() << std::endl; }
84 , std::placeholders::_1);
105 85
106 elm_run(); 86 efl::eolian::event_add(sl7.changed_event, sl7, changed);
107 return 0; 87 efl::eolian::event_add(sl7.delay_changed_event, sl7, delay);
108} 88}
109ELM_MAIN() 89EFL_MAIN()
diff --git a/src/examples/elementary/spinner_cxx_example.cc b/src/examples/elementary/spinner_cxx_example.cc
index 561c6adfa2..8799aa1db7 100644
--- a/src/examples/elementary/spinner_cxx_example.cc
+++ b/src/examples/elementary/spinner_cxx_example.cc
@@ -1,57 +1,55 @@
1// g++ -g `pkg-config --cflags --libs elementary-cxx efl-cxx eina-cxx eo-cxx ecore-cxx evas-cxx edje-cxx` spinner_cxx_example.cc -o spinner_cxx_example
2
3#define ELM_WIDGET_PROTECTED
4
1#include <Elementary.hh> 5#include <Elementary.hh>
6#include <iostream>
7
8#warning This example is using legacy elm_spinner
2 9
3EAPI_MAIN int 10using efl::eo::instantiate;
4elm_main (int argc, char *argv[]) 11
12static void
13efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
5{ 14{
6 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); 15 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
7 16
8 ::elm::win win(elm_win_util_standard_add("spinner", "Spinner Example")); 17 efl::ui::Win win(instantiate);
18 win.text_set("Spinner Example");
9 win.autohide_set(true); 19 win.autohide_set(true);
10 20
11 ::elm::box bx(efl::eo::parent = win); 21 efl::ui::Box bx(instantiate, win);
12 bx.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 22 win.content_set(bx);
13 win.resize_object_add(bx);
14 bx.visible_set(true);
15 23
16 ::elm::spinner sp(efl::eo::parent = win); 24 elm::Spinner sp(instantiate, win);
17 sp.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 25 sp.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5);
18 sp.size_hint_align_set(EVAS_HINT_FILL, 0.5);
19 bx.pack_end(sp); 26 bx.pack_end(sp);
20 sp.visible_set(true);
21 27
22 ::elm::spinner sp2(efl::eo::parent = win); 28 elm::Spinner sp2(instantiate, win);
23 sp2.label_format_set("Percentage %%%1.2f something"); 29 sp2.label_format_set("Percentage %%%1.2f something");
24 sp2.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 30 sp2.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5);
25 sp2.size_hint_align_set(EVAS_HINT_FILL, 0.5);
26 bx.pack_end(sp2); 31 bx.pack_end(sp2);
27 sp2.visible_set(true);
28 32
29 ::elm::spinner sp3(efl::eo::parent = win); 33 elm::Spinner sp3(instantiate, win);
30 sp3.label_format_set("%1.1f units"); 34 sp3.label_format_set("%1.1f units");
31 sp3.step_set(1.5); 35 sp3.step_set(1.5);
32 sp3.wrap_set(true); 36 sp3.wrap_set(true);
33 sp3.min_max_set(-50.0, 250.0); 37 sp3.min_max_set(-50.0, 250.0);
34 sp3.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 38 sp3.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5);
35 sp3.size_hint_align_set(EVAS_HINT_FILL, 0.5);
36 bx.pack_end(sp3); 39 bx.pack_end(sp3);
37 sp3.visible_set(true);
38 40
39 ::elm::spinner sp4(efl::eo::parent = win); 41 elm::Spinner sp4(instantiate, win);
40 sp4.style_set("vertical"); 42 sp4.style_set("vertical");
41 sp4.interval_set(0.2); 43 sp4.interval_set(0.2);
42 sp4.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 44 sp4.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5);
43 sp4.size_hint_align_set(EVAS_HINT_FILL, 0.5);
44 bx.pack_end(sp4); 45 bx.pack_end(sp4);
45 sp4.visible_set(true);
46 46
47 ::elm::spinner sp5(efl::eo::parent = win); 47 elm::Spinner sp5(instantiate, win);
48 sp5.editable_set(false); 48 sp5.editable_set(false);
49 sp5.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 49 sp5.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5);
50 sp5.size_hint_align_set(EVAS_HINT_FILL, 0.5);
51 bx.pack_end(sp5); 50 bx.pack_end(sp5);
52 sp5.visible_set(true);
53 51
54 ::elm::spinner sp6(efl::eo::parent = win); 52 elm::Spinner sp6(instantiate, win);
55 sp6.editable_set(false); 53 sp6.editable_set(false);
56 sp6.min_max_set(1, 12); 54 sp6.min_max_set(1, 12);
57 sp6.special_value_add(1, "January"); 55 sp6.special_value_add(1, "January");
@@ -66,30 +64,22 @@ elm_main (int argc, char *argv[])
66 sp6.special_value_add(10, "October"); 64 sp6.special_value_add(10, "October");
67 sp6.special_value_add(11, "November"); 65 sp6.special_value_add(11, "November");
68 sp6.special_value_add(12, "December"); 66 sp6.special_value_add(12, "December");
69 sp6.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 67 sp6.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5);
70 sp6.size_hint_align_set(EVAS_HINT_FILL, 0.5);
71 bx.pack_end(sp6); 68 bx.pack_end(sp6);
72 sp6.visible_set(true);
73 69
74 ::elm::spinner sp7(efl::eo::parent = win); 70 elm::Spinner sp7(instantiate, win);
75 sp7.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 71 sp7.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5);
76 sp7.size_hint_align_set(EVAS_HINT_FILL, 0.5);
77 bx.pack_end(sp7); 72 bx.pack_end(sp7);
78 sp7.visible_set(true);
79 sp7.editable_set(true); 73 sp7.editable_set(true);
80 74
81 auto changed = std::bind([&] () { std::cout << "Value changed to " << sp7.value_get() << std::endl; }); 75 auto changed = std::bind([] (elm::Spinner &spinner)
82 76 { std::cout << "Value changed to " << spinner.value_get() << std::endl; },
83 sp7.callback_changed_add( changed ); 77 std::placeholders::_1);
78 efl::eolian::event_add(elm::Spinner::changed_event, sp7, changed);
84 79
85 auto delay = std::bind([&] () {std::cout << "Value delay changed to " << sp7.value_get() << std::endl;}); 80 auto delay = std::bind([] (elm::Spinner &spinner)
86 81 { std::cout << "Value changed to " << spinner.value_get() << "" << std::endl; },
87 sp7.callback_delay_changed_add( delay ); 82 std::placeholders::_1);
88 83 efl::eolian::event_add(elm::Spinner::delay_changed_event, sp7, delay);
89 win.visible_set(true);
90
91 elm_run();
92 return 0;
93} 84}
94ELM_MAIN() 85EFL_MAIN()
95
diff --git a/src/examples/elementary/table_cxx_example_01.cc b/src/examples/elementary/table_cxx_example_01.cc
index c55637e9c0..c0155c3c32 100644
--- a/src/examples/elementary/table_cxx_example_01.cc
+++ b/src/examples/elementary/table_cxx_example_01.cc
@@ -1,44 +1,38 @@
1// g++ -g `pkg-config --cflags --libs elementary-cxx efl-cxx eina-cxx eo-cxx ecore-cxx evas-cxx edje-cxx` table_cxx_example_01.cc -o table_cxx_example_01
1 2
2#include <Elementary.hh> 3#include <Elementary.hh>
3 4
4EAPI_MAIN int 5using efl::eo::instantiate;
5elm_main (int argc, char *argv[]) 6
7static void
8efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
6{ 9{
7 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); 10 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
8 11
9 ::elm::win win(elm_win_util_standard_add("table", "Table")); 12 efl::ui::Win win(instantiate);
13 win.text_set("Table example");
10 win.autohide_set(true); 14 win.autohide_set(true);
11 15
12 ::elm::table table(efl::eo::parent = win); 16 efl::ui::Grid table(instantiate, win);
13 win.resize_object_add(table); 17 win.content_set(table);
14 table.visible_set(true); 18 table.pack_padding_set(5, 5, true);
15 table.padding_set(5, 5); 19// FIXME
16 table.homogeneous_set(true); 20// table.homogeneous_set(true);
17
18 ::elm::label label(efl::eo::parent = win);
19 label.text_set(nullptr, "label 0");
20 label.visible_set(true);
21 table.pack(label, 0, 0, 1, 1);
22 21
23 ::elm::label label1(efl::eo::parent = win); 22 efl::ui::Text label(instantiate, win);
24 label1.text_set(nullptr, "label 1"); 23 label.text_set("label 0");
25 label1.visible_set(true); 24 table.pack_grid(label, 0, 0, 1, 1);
26 table.pack(label1, 1, 0, 1, 1);
27 25
28 ::elm::label label2(efl::eo::parent = win); 26 efl::ui::Text label1(instantiate, win);
29 label2.text_set(nullptr, "label 2"); 27 label1.text_set("label 1");
30 label2.visible_set(true); 28 table.pack_grid(label1, 1, 0, 1, 1);
31 table.pack(label2, 0, 1, 1, 1);
32 29
33 ::elm::label label3(efl::eo::parent = win); 30 efl::ui::Text label2(instantiate, win);
34 label3.text_set(nullptr, "label 3"); 31 label2.text_set("label 2");
35 label3.visible_set(true); 32 table.pack_grid(label2, 0, 1, 1, 1);
36 table.pack(label3, 1, 1, 1, 1);
37 33
38 win.visible_set(true); 34 efl::ui::Text label3(instantiate, win);
39 35 label3.text_set("label 3");
40 elm_run(); 36 table.pack_grid(label3, 1, 1, 1, 1);
41 return 0;
42} 37}
43ELM_MAIN() 38EFL_MAIN()
44
diff --git a/src/examples/elementary/table_cxx_example_02.cc b/src/examples/elementary/table_cxx_example_02.cc
index 9ab119c077..d37e6f307b 100644
--- a/src/examples/elementary/table_cxx_example_02.cc
+++ b/src/examples/elementary/table_cxx_example_02.cc
@@ -1,46 +1,41 @@
1#include <Elementary.hh> 1// g++ -g `pkg-config --cflags --libs elementary-cxx efl-cxx eina-cxx eo-cxx ecore-cxx evas-cxx edje-cxx` table_cxx_example_01.cc -o table_cxx_example_01
2
2#include <Evas.hh> 3#include <Evas.hh>
4#include <Elementary.hh>
5
6using efl::eo::instantiate;
3 7
4EAPI_MAIN int 8static void
5elm_main (int argc, char *argv[]) 9efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
6{ 10{
7 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); 11 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
8 12
9 ::elm::win win(elm_win_util_standard_add("table", "Table")); 13 efl::ui::Win win(instantiate);
14 win.text_set("Table example");
10 win.autohide_set(true); 15 win.autohide_set(true);
11 16
12 ::elm::table table(efl::eo::parent = win); 17 efl::ui::Grid table(instantiate, win);
13 win.resize_object_add(table); 18 win.content_set(table);
14 table.visible_set(true); 19 table.pack_padding_set(5, 5, true);
15 table.homogeneous_set(false); 20
16 21 efl::canvas::Rectangle rect(instantiate, win);
17 evas::rectangle rect(efl::eo::parent = win); 22 rect.color_set(255, 0, 0, 255);
18 rect.color_set( 255, 0, 0, 255); 23 rect.hint_min_set({100, 50});
19 rect.size_hint_min_set( 100, 50); 24 table.pack_grid(rect, 0, 0, 2, 1);
20 rect.visible_set(true); 25
21 table.pack(rect, 0, 0, 2, 1); 26 efl::canvas::Rectangle rect2(instantiate, win);
22 27 rect2.color_set(0, 255, 0, 255);
23 evas::rectangle rect2(efl::eo::parent = win); 28 rect2.hint_min_set({50, 100});
24 rect2.color_set( 0, 255, 0, 255); 29 table.pack_grid(rect2, 0, 1, 1, 2);
25 rect2.size_hint_min_set(50, 100); 30
26 rect2.visible_set(true); 31 efl::canvas::Rectangle rect3(instantiate, win);
27 table.pack(rect2, 0, 1, 1, 2); 32 rect3.color_set(0, 0, 255, 255);
28 33 rect3.hint_min_set({50, 50});
29 evas::rectangle rect3(efl::eo::parent = win); 34 table.pack_grid(rect3, 1, 1, 1, 1);
30 rect3.color_set( 0, 0, 255, 255); 35
31 rect3.size_hint_min_set(50, 50); 36 efl::canvas::Rectangle rect4(instantiate, win);
32 rect3.visible_set(true); 37 rect4.color_set(255, 255, 0, 255);
33 table.pack(rect3, 1, 1, 1, 1); 38 rect4.hint_min_set({50, 50});
34 39 table.pack_grid(rect4, 1, 2, 1, 1);
35 evas::rectangle rect4(efl::eo::parent = win);
36 rect4.color_set( 255, 255, 0, 255);
37 rect4.size_hint_min_set(50, 50);
38 rect4.visible_set(true);
39 table.pack(rect4, 1, 2, 1, 1);
40
41 win.visible_set(true);
42
43 elm_run();
44 return 0;
45} 40}
46ELM_MAIN() 41EFL_MAIN()