summaryrefslogtreecommitdiff
path: root/src/examples
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-06-06 02:54:36 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-06-06 02:54:36 -0300
commit2a3d7860dbc11458425e162cd69ee399e9025251 (patch)
tree84c5b21b644c4cf8806a8eee07b4ed81922c92b4 /src/examples
parent4d1b3191d94fcc70472552b1bb554984a9cb0288 (diff)
eolian-cxx: Rewrite to accomodate new features of the C++ binding
Diffstat (limited to 'src/examples')
-rw-r--r--src/examples/elementary/bg_cxx_example_01.cc13
-rw-r--r--src/examples/elementary/button_cxx_example_00.cc25
-rw-r--r--src/examples/eolian_cxx/Makefile.am14
-rw-r--r--src/examples/eolian_cxx/colourable.c1
-rw-r--r--src/examples/eolian_cxx/colourable_cxx.cc1
-rw-r--r--src/examples/eolian_cxx/colourablesquare.c1
-rw-r--r--src/examples/eolian_cxx/colourablesquare_cxx.cc1
-rw-r--r--src/examples/eolian_cxx/eolian_cxx_simple_01.cc12
-rw-r--r--src/examples/eolian_cxx/ns_colourable.eo1
-rw-r--r--src/examples/eolian_cxx/ns_colourablesquare.eo1
10 files changed, 28 insertions, 42 deletions
diff --git a/src/examples/elementary/bg_cxx_example_01.cc b/src/examples/elementary/bg_cxx_example_01.cc
index 9fe20f4..a1db40a 100644
--- a/src/examples/elementary/bg_cxx_example_01.cc
+++ b/src/examples/elementary/bg_cxx_example_01.cc
@@ -1,3 +1,5 @@
1#define EFL_EO_API_SUPPORT
2
1#include <Elementary.hh> 3#include <Elementary.hh>
2 4
3EAPI_MAIN int 5EAPI_MAIN int
@@ -5,16 +7,11 @@ elm_main (int argc, char *argv[])
5{ 7{
6 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);
7 9
8 ::elm::win_standard win; 10 ::elm::win::Standard win;
9 win.title_set("Bg Plain"); 11 // win.title_set("Bg Plain");
10 win.autohide_set(true); 12 win.autohide_set(true);
11 13
12 ::elm::bg bg(efl::eo::parent = win); 14 win.eo_cxx::efl::Gfx::size_set(320,320);
13 bg.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
14 win.resize_object_add(bg);
15 bg.visible_set(true);
16
17 win.size_set(320,320);
18 win.visible_set(true); 15 win.visible_set(true);
19 16
20 elm_run(); 17 elm_run();
diff --git a/src/examples/elementary/button_cxx_example_00.cc b/src/examples/elementary/button_cxx_example_00.cc
index a18d652..c12f504 100644
--- a/src/examples/elementary/button_cxx_example_00.cc
+++ b/src/examples/elementary/button_cxx_example_00.cc
@@ -1,3 +1,5 @@
1#define EFL_EO_API_SUPPORT
2
1#include <Elementary.hh> 3#include <Elementary.hh>
2 4
3EAPI_MAIN int 5EAPI_MAIN int
@@ -5,28 +7,23 @@ elm_main (int argc, char *argv[])
5{ 7{
6 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);
7 9
8 ::elm::win_standard win; 10 ::elm::win::Standard win;
9 win.title_set("Hello, World!"); 11 //win.title_set("Hello, World!");
10 win.autohide_set(true); 12 win.autohide_set(true);
11 13
12 ::elm::bg bg(efl::eo::parent = win); 14 ::elm::Button btn(win);
13 bg.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
14 win.resize_object_add(bg);
15 bg.visible_set(true);
16
17 ::elm::button btn(efl::eo::parent = win);
18 btn.text_set("elm.text","Good-Bye, World!"); 15 btn.text_set("elm.text","Good-Bye, World!");
19 btn.size_set(120, 30); 16 btn.eo_cxx::efl::Gfx::size_set(120, 30);
20 btn.position_set(60, 15); 17 btn.eo_cxx::efl::Gfx::position_set(60, 15);
21 btn.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 18 // btn.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
22 btn.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL); 19 // btn.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
23 btn.visible_set(true); 20 btn.visible_set(true);
24 21
25 auto on_click = std::bind([] () { elm_exit(); }); 22 auto on_click = std::bind([] () { elm_exit(); });
26 23
27 btn.callback_clicked_add( on_click ); 24 efl::eolian::event_add(evas::Clickable_Interface::clicked_event, btn, on_click);
28 25
29 win.size_set(240, 60); 26 win.eo_cxx::efl::Gfx::size_set(240, 60);
30 win.visible_set(true); 27 win.visible_set(true);
31 28
32 elm_run(); 29 elm_run();
diff --git a/src/examples/eolian_cxx/Makefile.am b/src/examples/eolian_cxx/Makefile.am
index 8b6b68f..f0b82d1 100644
--- a/src/examples/eolian_cxx/Makefile.am
+++ b/src/examples/eolian_cxx/Makefile.am
@@ -93,15 +93,15 @@ IMPL = \
93 93
94SRCS = \ 94SRCS = \
95 eolian_cxx_simple_01.cc \ 95 eolian_cxx_simple_01.cc \
96 eolian_cxx_inherit_01.cc \
97 eolian_cxx_callbacks_01.cc \ 96 eolian_cxx_callbacks_01.cc \
98 $(IMPL) 97 $(IMPL)
98# eolian_cxx_inherit_01.cc
99 99
100EXTRA_PROGRAMS = \ 100EXTRA_PROGRAMS = \
101 eolian_cxx_simple_01 \ 101 eolian_cxx_simple_01 \
102 eolian_cxx_simple_01_cxx_impl \ 102 eolian_cxx_simple_01_cxx_impl \
103 eolian_cxx_inherit_01 \
104 eolian_cxx_callbacks_01 103 eolian_cxx_callbacks_01
104# eolian_cxx_inherit_01
105 105
106DATA_FILES = Makefile.examples $(ECXX_EXAMPLE_EOS) 106DATA_FILES = Makefile.examples $(ECXX_EXAMPLE_EOS)
107EXTRA_DIST = $(DATA_FILES) 107EXTRA_DIST = $(DATA_FILES)
@@ -120,11 +120,11 @@ eolian_cxx_simple_01_cxx_impl_SOURCES = \
120 colourablesquare_cxx.cc 120 colourablesquare_cxx.cc
121eolian_cxx_simple_01_cxx_impl.$(OBJEXT): $(GENERATED) 121eolian_cxx_simple_01_cxx_impl.$(OBJEXT): $(GENERATED)
122 122
123eolian_cxx_inherit_01_SOURCES = \ 123# eolian_cxx_inherit_01_SOURCES = \
124 eolian_cxx_inherit_01.cc \ 124# eolian_cxx_inherit_01.cc \
125 colourable.c \ 125# colourable.c \
126 colourablesquare.c 126# colourablesquare.c
127eolian_cxx_inherit_01.$(OBJEXT): $(GENERATED) 127# eolian_cxx_inherit_01.$(OBJEXT): $(GENERATED)
128 128
129eolian_cxx_callbacks_01_SOURCES = eolian_cxx_callbacks_01.cc 129eolian_cxx_callbacks_01_SOURCES = eolian_cxx_callbacks_01.cc
130 130
diff --git a/src/examples/eolian_cxx/colourable.c b/src/examples/eolian_cxx/colourable.c
index dd2cc11..04c233a 100644
--- a/src/examples/eolian_cxx/colourable.c
+++ b/src/examples/eolian_cxx/colourable.c
@@ -63,7 +63,6 @@ _ns_colourable_rgb_24bits_constructor(Eo *obj, Colourable_Data *self, int rgb)
63 self->g = (rgb & 0x0000ff00) >> 8; 63 self->g = (rgb & 0x0000ff00) >> 8;
64 self->b = rgb & 0x000000ff; 64 self->b = rgb & 0x000000ff;
65 DBG("_ns_colourable_rgb_24bits_constructor(0x%.6x)\n", (int)rgb); 65 DBG("_ns_colourable_rgb_24bits_constructor(0x%.6x)\n", (int)rgb);
66 eo_constructor(eo_super(obj, MY_CLASS));
67} 66}
68 67
69void 68void
diff --git a/src/examples/eolian_cxx/colourable_cxx.cc b/src/examples/eolian_cxx/colourable_cxx.cc
index 513e3dc..30f1bb3 100644
--- a/src/examples/eolian_cxx/colourable_cxx.cc
+++ b/src/examples/eolian_cxx/colourable_cxx.cc
@@ -42,7 +42,6 @@ _colourable_rgb_24bits_constructor(Eo *obj, Colourable_Data *self, int rgb)
42 self->r = (rgb & 0x00ff0000) >> 16; 42 self->r = (rgb & 0x00ff0000) >> 16;
43 self->g = (rgb & 0x0000ff00) >> 8; 43 self->g = (rgb & 0x0000ff00) >> 8;
44 self->b = rgb & 0x000000ff; 44 self->b = rgb & 0x000000ff;
45 eo_constructor(eo_super(obj, MY_CLASS));
46} 45}
47 46
48void 47void
diff --git a/src/examples/eolian_cxx/colourablesquare.c b/src/examples/eolian_cxx/colourablesquare.c
index f367c59..f67d3e2 100644
--- a/src/examples/eolian_cxx/colourablesquare.c
+++ b/src/examples/eolian_cxx/colourablesquare.c
@@ -35,7 +35,6 @@ _ns_colourablesquare_size_constructor(Eo *obj, ColourableSquare_Data *self, int
35 } 35 }
36 self->size = size; 36 self->size = size;
37 DBG("_ns_colourablesquare_constructor(%d)\n", size); 37 DBG("_ns_colourablesquare_constructor(%d)\n", size);
38 eo_constructor(eo_super(obj, MY_CLASS));
39} 38}
40 39
41static int 40static int
diff --git a/src/examples/eolian_cxx/colourablesquare_cxx.cc b/src/examples/eolian_cxx/colourablesquare_cxx.cc
index b4c92b8..ecaf757 100644
--- a/src/examples/eolian_cxx/colourablesquare_cxx.cc
+++ b/src/examples/eolian_cxx/colourablesquare_cxx.cc
@@ -25,7 +25,6 @@ _colourablesquare_size_constructor(Eo *obj, ColourableSquare_Data *self, int siz
25{ 25{
26 self->size = size; 26 self->size = size;
27 EINA_CXX_DOM_LOG_DBG(domain) << __func__ << " [ size = " << size << " ]" << std::endl; 27 EINA_CXX_DOM_LOG_DBG(domain) << __func__ << " [ size = " << size << " ]" << std::endl;
28 eo_constructor(eo_super(obj, MY_CLASS));
29} 28}
30 29
31int 30int
diff --git a/src/examples/eolian_cxx/eolian_cxx_simple_01.cc b/src/examples/eolian_cxx/eolian_cxx_simple_01.cc
index 0bf9642..eb093d9 100644
--- a/src/examples/eolian_cxx/eolian_cxx_simple_01.cc
+++ b/src/examples/eolian_cxx/eolian_cxx_simple_01.cc
@@ -18,15 +18,13 @@ main()
18 eina_log_domain_level_set("colourablesquare", EINA_LOG_LEVEL_DBG); 18 eina_log_domain_level_set("colourablesquare", EINA_LOG_LEVEL_DBG);
19 19
20 int r, g, b; 20 int r, g, b;
21 ::ns::Colourable obj1( 21 ::ns::Colourable obj1
22 obj1.rgb_24bits_constructor(0x123456) 22 ([&] { obj1.rgb_24bits_constructor(0x123456); });
23 );
24 obj1.colour_set(0xc0ffee); 23 obj1.colour_set(0xc0ffee);
25 obj1.composite_colour_get(&r, &g, &b); 24 obj1.composite_colour_get(r, g, b);
26 25
27 ::ns::ColourableSquare obj2( 26 ::ns::ColourableSquare obj2
28 obj2.size_constructor(10) 27 ([&] { obj2.size_constructor(10); });
29 );
30 obj2.composite_colour_set(r, g, b); 28 obj2.composite_colour_set(r, g, b);
31 obj2.size_set(11); 29 obj2.size_set(11);
32 assert(obj1.colour_get() == obj2.colour_get()); 30 assert(obj1.colour_get() == obj2.colour_get());
diff --git a/src/examples/eolian_cxx/ns_colourable.eo b/src/examples/eolian_cxx/ns_colourable.eo
index 90abc65..21af926 100644
--- a/src/examples/eolian_cxx/ns_colourable.eo
+++ b/src/examples/eolian_cxx/ns_colourable.eo
@@ -1,7 +1,6 @@
1class Ns.Colourable (Eo.Base) 1class Ns.Colourable (Eo.Base)
2{ 2{
3 [[Colourable class.]] 3 [[Colourable class.]]
4 legacy_prefix: legacy;
5 data: Colourable_Data; 4 data: Colourable_Data;
6 methods { 5 methods {
7 rgb_24bits_constructor { 6 rgb_24bits_constructor {
diff --git a/src/examples/eolian_cxx/ns_colourablesquare.eo b/src/examples/eolian_cxx/ns_colourablesquare.eo
index 70fb471..66fe8ae 100644
--- a/src/examples/eolian_cxx/ns_colourablesquare.eo
+++ b/src/examples/eolian_cxx/ns_colourablesquare.eo
@@ -1,6 +1,5 @@
1class Ns.ColourableSquare (Ns.Colourable) 1class Ns.ColourableSquare (Ns.Colourable)
2{ 2{
3 legacy_prefix: legacy;
4 data: ColourableSquare_Data; 3 data: ColourableSquare_Data;
5 methods { 4 methods {
6 @property size { 5 @property size {