summaryrefslogtreecommitdiff
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
parent4f98b549159811d2f649a9e3eca6bbe20bc86740 (diff)
downloadefl-778c5afb3f29fe0763d875d31f6411b24cbb997d.tar.gz
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.
-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 \
genlist_example_03.c \
genlist_example_04.c \
genlist_example_05.c \
-glview_example_01.c \
hover_example_01.c \
hoversel_example_01.c \
icon_example_01.c \
@@ -179,6 +178,9 @@ if HAVE_CXX11
SRCS += \
bg_cxx_example_01.cc \
bg_cxx_example_02.cc \
+box_cxx_example_02.cc \
+button_cxx_example_00.cc \
+button_cxx_example_01.cc \
calendar_cxx_example_01.cc \
calendar_cxx_example_02.cc \
calendar_cxx_example_03.cc \
@@ -186,27 +188,15 @@ calendar_cxx_example_04.cc \
calendar_cxx_example_05.cc \
clock_cxx_example.cc \
icon_cxx_example_01.cc \
-button_cxx_example_00.cc
-endif
-#table_cxx_example_02.cc \
-table_cxx_example_01.cc \
-spinner_cxx_example.cc \
-slider_cxx_example.cc \
-radio_cxx_example_01.cc \
-popup_cxx_example_01.cc \
menu_cxx_example_01.cc \
-location_cxx_example_01.cc \
-hoversel_cxx_example_01.cc \
-glview_cxx_example_01.cc \
-calendar_cxx_example_05.cc \
-calendar_cxx_example_04.cc \
-calendar_cxx_example_03.cc \
-calendar_cxx_example_02.cc \
-calendar_cxx_example_01.cc \
-button_cxx_example_01.cc \
-box_cxx_example_02.cc \
-bg_cxx_example_02.cc \
-bg_cxx_example_01.cc
+radio_cxx_example_01.cc \
+slider_cxx_example.cc \
+spinner_cxx_example.cc \
+table_cxx_example_01.cc \
+table_cxx_example_02.cc \
+toolbar_cxx_example_01.cc \
+$(NULL)
+endif
EDCS = \
twitter_example_01.edc \
@@ -305,7 +295,6 @@ genlist_example_02 \
genlist_example_03 \
genlist_example_04 \
genlist_example_05 \
-glview_example_01 \
hover_example_01 \
hoversel_example_01 \
icon_example_01 \
@@ -402,6 +391,9 @@ if HAVE_CXX11
examples_PROGRAMS += \
bg_cxx_example_01 \
bg_cxx_example_02 \
+box_cxx_example_02 \
+button_cxx_example_00 \
+button_cxx_example_01 \
calendar_cxx_example_01 \
calendar_cxx_example_02 \
calendar_cxx_example_03 \
@@ -409,31 +401,14 @@ calendar_cxx_example_04 \
calendar_cxx_example_05 \
clock_cxx_example \
icon_cxx_example_01 \
+menu_cxx_example_01 \
+radio_cxx_example_01 \
+slider_cxx_example \
+spinner_cxx_example \
+table_cxx_example_01 \
+table_cxx_example_02 \
toolbar_cxx_example_01 \
-button_cxx_example_00
-# examples_PROGRAMS += \
-# table_cxx_example_02 \
-# table_cxx_example_01 \
-# spinner_cxx_example \
-# slider_cxx_example \
-# radio_cxx_example_01 \
-# popup_cxx_example_01 \
-# menu_cxx_example_01 \
-# location_cxx_example_01 \
-# icon_cxx_example_01 \
-# hoversel_cxx_example_01 \
-# glview_cxx_example_01 \
-# clock_cxx_example \
-# calendar_cxx_example_05 \
-# calendar_cxx_example_04 \
-# calendar_cxx_example_03 \
-# calendar_cxx_example_02 \
-# calendar_cxx_example_01 \
-# button_cxx_example_01 \
-# button_cxx_example_00 \
-# box_cxx_example_02 \
-# bg_cxx_example_02 \
-# bg_cxx_example_01
+$(NULL)
endif
efl_thread_1_SOURCES = efl_thread_1.c
@@ -442,39 +417,25 @@ efl_thread_3_SOURCES = efl_thread_3.c
efl_thread_4_SOURCES = efl_thread_4.c
if HAVE_CXX11
-icon_cxx_example_01_SOURCES = icon_cxx_example_01.cc
-clock_cxx_example_SOURCES = clock_cxx_example.cc
-calendar_cxx_example_05_SOURCES = calendar_cxx_example_05.cc
-calendar_cxx_example_04_SOURCES = calendar_cxx_example_04.cc
-calendar_cxx_example_03_SOURCES = calendar_cxx_example_03.cc
-calendar_cxx_example_02_SOURCES = calendar_cxx_example_02.cc
-calendar_cxx_example_01_SOURCES = calendar_cxx_example_01.cc
-bg_cxx_example_02_SOURCES = bg_cxx_example_02.cc
bg_cxx_example_01_SOURCES = bg_cxx_example_01.cc
+bg_cxx_example_02_SOURCES = bg_cxx_example_02.cc
+box_cxx_example_02_SOURCES = box_cxx_example_02.cc
button_cxx_example_00_SOURCES = button_cxx_example_00.cc
+button_cxx_example_01_SOURCES = button_cxx_example_01.cc
+calendar_cxx_example_01_SOURCES = calendar_cxx_example_01.cc
+calendar_cxx_example_02_SOURCES = calendar_cxx_example_02.cc
+calendar_cxx_example_03_SOURCES = calendar_cxx_example_03.cc
+calendar_cxx_example_04_SOURCES = calendar_cxx_example_04.cc
+calendar_cxx_example_05_SOURCES = calendar_cxx_example_05.cc
+clock_cxx_example_SOURCES = clock_cxx_example.cc
+icon_cxx_example_01_SOURCES = icon_cxx_example_01.cc
+menu_cxx_example_01_SOURCES = menu_cxx_example_01.cc
+radio_cxx_example_01_SOURCES = radio_cxx_example_01.cc
+slider_cxx_example_SOURCES = slider_cxx_example.cc
+spinner_cxx_example_SOURCES = spinner_cxx_example.cc
+table_cxx_example_01_SOURCES = table_cxx_example_01.cc
+table_cxx_example_02_SOURCES = table_cxx_example_02.cc
toolbar_cxx_example_01_SOURCES = toolbar_cxx_example_01.cc
-# table_cxx_example_02_SOURCES = table_cxx_example_02.cc
-# table_cxx_example_01_SOURCES = table_cxx_example_01.cc
-# spinner_cxx_example_SOURCES = spinner_cxx_example.cc
-# slider_cxx_example_SOURCES = slider_cxx_example.cc
-# radio_cxx_example_01_SOURCES = radio_cxx_example_01.cc
-# popup_cxx_example_01_SOURCES = popup_cxx_example_01.cc
-# menu_cxx_example_01_SOURCES = menu_cxx_example_01.cc
-# location_cxx_example_01_SOURCES = location_cxx_example_01.cc
-# icon_cxx_example_01_SOURCES = icon_cxx_example_01.cc
-# hoversel_cxx_example_01_SOURCES = hoversel_cxx_example_01.cc
-# glview_cxx_example_01_SOURCES = glview_cxx_example_01.cc
-# clock_cxx_example_SOURCES = clock_cxx_example.cc
-# calendar_cxx_example_05_SOURCES = calendar_cxx_example_05.cc
-# calendar_cxx_example_04_SOURCES = calendar_cxx_example_04.cc
-# calendar_cxx_example_03_SOURCES = calendar_cxx_example_03.cc
-# calendar_cxx_example_02_SOURCES = calendar_cxx_example_02.cc
-# calendar_cxx_example_01_SOURCES = calendar_cxx_example_01.cc
-# button_cxx_example_01_SOURCES = button_cxx_example_01.cc
-# button_cxx_example_00_SOURCES = button_cxx_example_00.cc
-# box_cxx_example_02_SOURCES = box_cxx_example_02.cc
-# bg_cxx_example_02_SOURCES = bg_cxx_example_02.cc
-# bg_cxx_example_01_SOURCES = bg_cxx_example_01.cc
endif
# 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
if HAVE_CXX11
SCREENSHOTS += \
+ bg_cxx_example_01:bg_cxx_example_01.png:0.0 \
bg_cxx_example_02:bg_cxx_example_02.png:0.0 \
box_cxx_example_02:box_cxx_example_02.png:1.3 \
button_cxx_example_00:button_cxx_example_00.png:0.0 \
@@ -575,17 +537,16 @@ SCREENSHOTS += \
calendar_cxx_example_04:calendar_cxx_example_04.png:0.0 \
calendar_cxx_example_05:calendar_cxx_example_05.png:0.0 \
clock_cxx_example:clock_cxx_example.png:0.5 \
- datetime_cxx_example:datetime_cxx_example.png:0.0 \
- hoversel_cxx_example_01:hoversel_cxx_example_01.png:0.0 \
icon_cxx_example_01:icon_cxx_example_01.png:0.0 \
menu_cxx_example_01:menu_cxx_example_01.png:0.5 \
- popup_cxx_example_01:popup_cxx_example_01.png:1.0 \
popup_cxx_example_01:popup_cxx_example_01_a.png:6.0 \
radio_cxx_example_01:radio_cxx_example_01.png:0.0 \
slider_cxx_example:slider_cxx_example.png:0.0 \
spinner_cxx_example:spinner_cxx_example.png:0.0 \
table_cxx_example_01:table_cxx_example_01.png:0.0 \
- table_cxx_example_02:table_cxx_example_02.png:0.0
+ table_cxx_example_02:table_cxx_example_02.png:0.0 \
+ toolbar_cxx_example_01:toolbar_cxx_example_01.png:0.0 \
+$(NULL)
endif
HTML_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)
{
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
- auto win = efl::ui::Win(instantiate);
+ efl::ui::Win win(instantiate);
win.text_set("Simple Box Example");
win.autohide_set(true);
- auto box = efl::ui::Box(instantiate, win);
+ efl::ui::Box box(instantiate, win);
win.content_set(box);
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)
{
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
- auto win = efl::ui::Win(instantiate);
+ efl::ui::Win win(instantiate);
win.text_set("Button Example");
win.autohide_set(true);
- auto box = efl::ui::Box(instantiate, win);
+ efl::ui::Box box(instantiate, win);
win.content_set(box);
- auto bt = efl::ui::Button(instantiate, win);
+ efl::ui::Button bt(instantiate, win);
bt.text_set("Hello world!");
box.pack(bt);
- auto wbt = bt._get_wref();
- auto cb = std::bind([wbt]() {
+ auto wbt(bt._get_wref());
+ auto cb(std::bind([wbt]() {
std::cout << wbt->text_get() << std::endl;
- });
+ }));
efl::eolian::event_add(efl::ui::Clickable::clicked_event, bt, cb);
- auto bt2 = efl::ui::Button(instantiate, win);
+ efl::ui::Button bt2(instantiate, win);
bt2.text_set("Click to quit");
box.pack(bt2);
- auto wwin = win._get_wref();
- auto cb2 = std::bind([wwin]() {
+ auto wwin(win._get_wref());
+ auto cb2(std::bind([wwin]() {
::efl_del(wwin->_eo_ptr()); // FIXME: No proper C++ API to delete win
- });
+ }));
efl::eolian::event_add(efl::ui::Clickable::clicked_event, bt2, cb2);
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 @@
+// 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
+
+#define EFL_CXX_WREF_EASY
#include <Elementary.hh>
-EAPI_MAIN int
-elm_main(int argc, char *argv[])
+using efl::eo::instantiate;
+
+efl::Gfx icon_still(nullptr);
+
+static void
+efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
{
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
- ::elm::win_standard win;
- win.title_set("Button example");
+ efl::ui::Win win(instantiate);
+ win.text_set("Button example");
win.autohide_set(true);
- ::evas::object icon_still(nullptr);
- ::elm::button mid(efl::eo::parent = win);
- ::elm::button up(efl::eo::parent = win);
- ::elm::button down(efl::eo::parent = win);
- ::elm::button left(efl::eo::parent = win);
- ::elm::button right(efl::eo::parent = win);
-
- ::elm::box box(efl::eo::parent = win);
- box.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- win.resize_object_add(box);
- box.visible_set(true);
-
- ::elm::box box_initial(efl::eo::parent = win);
- box_initial.horizontal_set(true);
- box_initial.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0);
+ efl::ui::Button mid(instantiate, win);
+ efl::ui::Button up(instantiate, win);
+ efl::ui::Button down(instantiate, win);
+ efl::ui::Button left(instantiate, win);
+ efl::ui::Button right(instantiate, win);
+
+ efl::ui::Box box(instantiate, win);
+ win.content_set(box);
+
+ efl::ui::Box box_initial(instantiate, win);
+ box_initial.direction_set(EFL_UI_DIR_HORIZONTAL);
+ box_initial.hint_weight_set(EFL_GFX_SIZE_HINT_EXPAND, 0.0);
box.pack_end(box_initial);
- box_initial.visible_set(true);
- ::elm::button btn(efl::eo::parent = win);
- btn.text_set("elm.text", "Initial: 0.0");
+ efl::ui::Button btn(instantiate, win);
+ btn.text_set("Initial: 0.0");
box_initial.pack_end(btn);
- btn.visible_set(true);
-
- auto btn_options = std::bind([&] (evas::clickable_interface ci)
- {
- ::elm::button b(eo_ref(ci._eo_ptr()));
- std::string::size_type ptr;
- efl::eina::optional<std::string> lbl = b.text_get("elm.text");
-
- ptr = lbl->find(":");
- ptr += 2;
- double t = std::stod(lbl->substr(ptr));
-
- if (lbl->compare(0,7,"Initial") == 0)
- {
- up.autorepeat_initial_timeout_set(t);
- down.autorepeat_initial_timeout_set(t);
- left.autorepeat_initial_timeout_set(t);
- right.autorepeat_initial_timeout_set(t);
- }
- else if (lbl->compare(0,3,"Gap") == 0)
- {
- up.autorepeat_gap_timeout_set(t);
- down.autorepeat_gap_timeout_set(t);
- left.autorepeat_gap_timeout_set(t);
- right.autorepeat_gap_timeout_set(t);
- }
- }, std::placeholders::_1);
-
- btn.callback_clicked_add(btn_options);
-
- ::elm::button btn2(efl::eo::parent = win);
- btn2.text_set("elm.text", "Initial: 1.0");
+
+ auto wup = up._get_wref();
+ auto wdown = up._get_wref();
+ auto wleft = up._get_wref();
+ auto wright = up._get_wref();
+ auto btn_options = std::bind(
+ [wup, wdown, wleft, wright] (efl::ui::Button &button)
+ {
+ efl::ui::Button b(efl::eo::downcast<efl::ui::Button>(button));
+ efl::eina::optional<std::string> lbl = b.text_get();
+ std::string::size_type ptr;
+
+ ptr = lbl->find(":");
+ ptr += 2;
+ double t = std::stod(lbl->substr(ptr));
+
+ if (lbl->compare(0,7,"Initial") == 0)
+ {
+ wup->autorepeat_initial_timeout_set(t);
+ wdown->autorepeat_initial_timeout_set(t);
+ wleft->autorepeat_initial_timeout_set(t);
+ wright->autorepeat_initial_timeout_set(t);
+ }
+ else if (lbl->compare(0,3,"Gap") == 0)
+ {
+ wup->autorepeat_gap_timeout_set(t);
+ wdown->autorepeat_gap_timeout_set(t);
+ wleft->autorepeat_gap_timeout_set(t);
+ wright->autorepeat_gap_timeout_set(t);
+ }
+ }, std::placeholders::_1);
+ efl::eolian::event_add(efl::ui::Clickable::clicked_event, btn, btn_options);
+
+ efl::ui::Button btn2(instantiate, win);
+ btn2.text_set("Initial: 1.0");
box_initial.pack_end(btn2);
- btn2.visible_set(true);
- btn2.callback_clicked_add(btn_options);
+ efl::eolian::event_add(efl::ui::Clickable::clicked_event, btn2, btn_options);
- ::elm::button btn3(efl::eo::parent = win);
- btn3.text_set("elm.text", "Initial: 5.0");
+ efl::ui::Button btn3(instantiate, win);
+ btn3.text_set("Initial: 5.0");
box_initial.pack_end(btn3);
- btn3.visible_set(true);
- btn3.callback_clicked_add(btn_options);
+ efl::eolian::event_add(efl::ui::Clickable::clicked_event, btn3, btn_options);
- ::elm::box box_gap(efl::eo::parent = win);
- box_gap.horizontal_set(true);
- box_gap.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0);
+ efl::ui::Box box_gap(instantiate, win);
+ box_gap.direction_set(EFL_UI_DIR_HORIZONTAL);
+ box_gap.hint_weight_set(EFL_GFX_SIZE_HINT_EXPAND, 0.0);
box.pack_end(box_gap);
- box_gap.visible_set(true);
- ::elm::button btn4(efl::eo::parent = win);
- btn4.text_set("elm.text", "Gap: 0.1");
+ efl::ui::Button btn4(instantiate, win);
+ btn4.text_set("Gap: 0.1");
box_gap.pack_end(btn4);
- btn4.visible_set(true);
- btn4.callback_clicked_add(btn_options);
+ efl::eolian::event_add(efl::ui::Clickable::clicked_event, btn4, btn_options);
- ::elm::button btn5(efl::eo::parent = win);
- btn5.text_set("elm.text", "Gap: 0.5");
+ efl::ui::Button btn5(instantiate, win);
+ btn5.text_set("Gap: 0.5");
box_gap.pack_end(btn5);
- btn5.visible_set(true);
- btn5.callback_clicked_add(btn_options);
+ efl::eolian::event_add(efl::ui::Clickable::clicked_event, btn5, btn_options);
- ::elm::button btn6(efl::eo::parent = win);
- btn6.text_set("elm.text", "Gap: 1.0");
+ efl::ui::Button btn6(instantiate, win);
+ btn6.text_set("Gap: 1.0");
box_gap.pack_end(btn6);
- btn6.visible_set(true);
- btn6.callback_clicked_add(btn_options);
+ efl::eolian::event_add(efl::ui::Clickable::clicked_event, btn6, btn_options);
- up.autorepeat_set(true);
+ up.autorepeat_enabled_set(true);
up.autorepeat_initial_timeout_set(1.0);
up.autorepeat_gap_timeout_set(0.5);
- up.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0);
- up.size_hint_align_set(EVAS_HINT_FILL, 0.0);
+ up.hint_weight_set(EFL_GFX_SIZE_HINT_EXPAND, 0.0);
+ up.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.0);
box.pack_end(up);
- up.visible_set(true);
-
- auto btn_cursors_move = std::bind([&] (evas::clickable_interface ci2)
- {
- ::elm::button button = efl::eo::downcast<elm::button>(ci2);
- double ax, ay;
-
- if (!icon_still)
- {
- ::elm::icon obj(efl::eo::parent = mid);
- efl::eina::optional<evas::object> icon_still_p = mid.content_unset("icon");
- if(icon_still_p)
- {
- icon_still = *icon_still_p;
- icon_still.visible_set(false);
- }
- obj.standard_set("chat");
- mid.content_set("icon", obj);
- }
-
- mid.size_hint_align_get(&ax, &ay);
- if (button == up)
- {
- ay -= 0.05;
- if (ay < 0.0)
- ay = 0.0;
- }
- else if (button == down)
- {
- ay += 0.05;
- if (ay > 1.0)
- ay = 1.0;
- }
- else if (button == left)
- {
- ax -= 0.05;
- if (ax < 0.0)
- ax = 0.0;
- }
- else if (button == right)
- {
- ax += 0.05;
- if (ax > 1.0)
- ax = 1.0;
- }
- mid.size_hint_align_set(ax, ay);
- }, std::placeholders::_1);
-
- up.callback_repeated_add(btn_cursors_move);
-
- auto btn_cursors_release = std::bind([&] ()
- {
- if (icon_still)
- {
- mid.content_set("icon", icon_still);
- icon_still = evas::object(nullptr);
- }
- });
-
- up.callback_unpressed_add(btn_cursors_release);
-
- ::elm::icon icon_up(efl::eo::parent = win);
- icon_up.standard_set("arrow_up");
- up.content_set("icon", icon_up);
-
- ::elm::box box_inferior(efl::eo::parent = win);
- box_inferior.horizontal_set(true);
- box_inferior.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- box_inferior.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ auto wmid = mid._get_wref();
+ auto btn_cursors_move = std::bind(
+ [wmid, wup, wdown, wleft, wright] (efl::ui::Button &button)
+ {
+ efl::ui::Button b(efl::eo::downcast<efl::ui::Button>(button));
+ auto pmid = wmid.lock();
+ double ax, ay;
+
+ if (!pmid) return;
+
+ auto cmid = pmid.get();
+ if (!icon_still)
+ {
+ efl::ui::Image obj(instantiate, cmid);
+ efl::eina::optional<efl::Gfx> icon_still_p = cmid.content_unset();
+ if (icon_still_p)
+ {
+ icon_still = *icon_still_p;
+ icon_still.visible_set(false);
+ }
+ obj.icon_set("chat");
+ cmid.content_set(obj);
+ }
+
+ cmid.hint_align_get(ax, ay);
+ if (b == wup)
+ {
+ ay -= 0.05;
+ if (ay < 0.0)
+ ay = 0.0;
+ }
+ else if (b == wdown)
+ {
+ ay += 0.05;
+ if (ay > 1.0)
+ ay = 1.0;
+ }
+ else if (b == wleft)
+ {
+ ax -= 0.05;
+ if (ax < 0.0)
+ ax = 0.0;
+ }
+ else if (b == wright)
+ {
+ ax += 0.05;
+ if (ax > 1.0)
+ ax = 1.0;
+ }
+ cmid.hint_align_set(ax, ay);
+ }, std::placeholders::_1);
+ efl::eolian::event_add(efl::ui::Clickable::repeated_event, up, btn_cursors_move);
+
+ auto btn_cursors_release = std::bind(
+ [wmid] ()
+ {
+ if (icon_still)
+ {
+ wmid->content_set(icon_still);
+ icon_still = nullptr;
+ }
+ });
+ efl::eolian::event_add(efl::ui::Clickable::unpressed_event, up, btn_cursors_release);
+
+ efl::ui::Image icon_up(instantiate, win);
+ icon_up.icon_set("arrow_up");
+ up.content_set(icon_up);
+
+ efl::ui::Box box_inferior(instantiate, win);
+ box_inferior.direction_set(EFL_UI_DIR_HORIZONTAL);
box.pack_end(box_inferior);
box_inferior.visible_set(true);
- left.autorepeat_set(true);
+ left.autorepeat_enabled_set(true);
left.autorepeat_initial_timeout_set(1.0);
left.autorepeat_gap_timeout_set(0.5);
- left.size_hint_weight_set(0.0, EVAS_HINT_EXPAND);
- left.size_hint_align_set(0.0, EVAS_HINT_FILL);
+ left.hint_weight_set(0.0, EFL_GFX_SIZE_HINT_EXPAND);
+ left.hint_align_set(0.0, EFL_GFX_SIZE_HINT_FILL);
box_inferior.pack_end(left);
- left.visible_set(true);
- left.callback_repeated_add(btn_cursors_move);
- left.callback_unpressed_add(btn_cursors_release);
+ efl::eolian::event_add(efl::ui::Clickable::repeated_event, left, btn_cursors_move);
+ efl::eolian::event_add(efl::ui::Clickable::unpressed_event, left, btn_cursors_release);
- ::elm::icon icon_left(efl::eo::parent = win);
- icon_left.standard_set("arrow_left");
- left.content_set("icon", icon_left);
+ efl::ui::Image icon_left(instantiate, win);
+ icon_left.icon_set("arrow_left");
+ left.content_set(icon_left);
- mid.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
box_inferior.pack_end(mid);
- mid.visible_set(true);
- ::elm::icon icon_mid(efl::eo::parent = win);
- icon_mid.standard_set("close");
- mid.content_set("icon", icon_mid);
+ efl::ui::Image icon_mid(instantiate, win);
+ icon_mid.icon_set("close");
+ mid.content_set(icon_mid);
- right.autorepeat_set(true);
+ right.autorepeat_enabled_set(true);
right.autorepeat_initial_timeout_set(1.0);
right.autorepeat_gap_timeout_set(0.5);
- right.size_hint_weight_set(0.0, EVAS_HINT_EXPAND);
- right.size_hint_align_set(0.0, EVAS_HINT_FILL);
+ right.hint_weight_set(0.0, EFL_GFX_SIZE_HINT_EXPAND);
+ right.hint_align_set(0.0, EFL_GFX_SIZE_HINT_FILL);
box_inferior.pack_end(right);
- right.visible_set(true);
- right.callback_repeated_add(btn_cursors_move);
- right.callback_unpressed_add(btn_cursors_release);
+ efl::eolian::event_add(efl::ui::Clickable::repeated_event, right, btn_cursors_move);
+ efl::eolian::event_add(efl::ui::Clickable::unpressed_event, right, btn_cursors_release);
- ::elm::icon icon_right(efl::eo::parent = win);
- icon_right.standard_set("arrow_right");
- right.content_set("icon", icon_right);
+ efl::ui::Image icon_right(instantiate, win);
+ icon_right.icon_set("arrow_right");
+ right.content_set(icon_right);
- down.autorepeat_set(true);
+ down.autorepeat_enabled_set(true);
down.autorepeat_initial_timeout_set(1.0);
down.autorepeat_gap_timeout_set(0.5);
- down.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0);
- down.size_hint_align_set(EVAS_HINT_FILL, 0.0);
+ down.hint_weight_set(EFL_GFX_SIZE_HINT_EXPAND, 0.0);
+ down.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.0);
box.pack_end(down);
- down.visible_set(true);
- down.callback_repeated_add(btn_cursors_move);
- down.callback_unpressed_add(btn_cursors_release);
-
- ::elm::icon icon_down(efl::eo::parent = win);
- icon_down.standard_set("arrow_down");
- down.content_set("icon", icon_down);
+ efl::eolian::event_add(efl::ui::Clickable::repeated_event, down, btn_cursors_move);
+ efl::eolian::event_add(efl::ui::Clickable::unpressed_event, down, btn_cursors_release);
- win.size_set(300, 320);
- win.visible_set(true);
+ efl::ui::Image icon_down(instantiate, win);
+ icon_down.icon_set("arrow_down");
+ down.content_set(icon_down);
- elm_run();
- return 0;
+ win.size_set({300, 320});
}
-ELM_MAIN()
+EFL_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 @@
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#include "elementary_config.h"
-#endif
-
#include <Elementary.hh>
using efl::eo::instantiate;
@@ -12,11 +7,11 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
{
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
- auto win = efl::ui::Win(instantiate);
+ efl::ui::Win win(instantiate);
win.text_set("Calendar Creation Example");
win.autohide_set(true);
- auto cal = efl::ui::Calendar(instantiate, win);
+ efl::ui::Calendar cal(instantiate, win);
win.content_set(cal);
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 @@
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#include "elementary_config.h"
-#endif
-
-#include <Efl.hh>
#include <Elementary.hh>
using 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 @@
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#include "elementary_config.h"
-#endif
-
#include <Elementary.hh>
using efl::eo::instantiate;
@@ -17,11 +12,11 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
min.tm_year = 2020 - 1900;
max.tm_year = 2022 - 1900;
- auto win = efl::ui::Win(instantiate);
+ efl::ui::Win win(instantiate);
win.text_set("Calendar Min/Max Year Example");
win.autohide_set(true);
- auto cal = efl::ui::Calendar(instantiate, win);
+ efl::ui::Calendar cal(instantiate, win);
win.content_set(cal);
cal.date_min_set(min);
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 @@
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#include "elementary_config.h"
-#endif
+#include <Elementary.hh>
#warning This example can't be implemented with EO APIs... FIXME
-#include <Elementary.hh>
-
using efl::eo::instantiate;
#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 @@
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#include "elementary_config.h"
-#endif
+#include <Elementary.hh>
#warning This example can't be implemented with EO APIs... FIXME
-#include <Elementary.hh>
-
EAPI_MAIN int
elm_main (int argc EINA_UNUSED, char **argv EINA_UNUSED)
{
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 @@
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#include "elementary_config.h"
-#endif
-
#include <Elementary.hh>
using 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 @@
-#include <Elementary.hh>
-
-#include <Evas_GL.h>
-#include <stdio.h>
-
-typedef struct _GLData GLData;
-
-struct _GLData
-{
- Evas_GL_API *glapi;
- GLuint program;
- GLuint vtx_shader;
- GLuint fgmt_shader;
- GLuint vbo;
- int initialized : 1;
-};
-
-static float red = 1.0;
-
-static GLuint
-load_shader(GLData *gld, GLenum type, const char *shader_src )
-{
- Evas_GL_API *gl = gld->glapi;
- GLuint shader;
- GLint compiled;
-
- shader = gl->glCreateShader(type);
- if (shader==0)
- return 0;
-
- gl->glShaderSource(shader, 1, &shader_src, NULL);
- gl->glCompileShader(shader);
- gl->glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
-
- if (!compiled)
- {
- GLint info_len = 0;
- gl->glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &info_len);
- if (info_len > 1)
- {
- char* info_log = new char[sizeof(char) * info_len];
-
- gl->glGetShaderInfoLog(shader, info_len, NULL, info_log);
- printf("Error compiling shader:\n%s\n======\n%s\n======\n", info_log, shader_src );
- delete [] info_log;
- }
- gl->glDeleteShader(shader);
- return 0;
- }
-
- return shader;
-}
-
-static int
-init_shaders(GLData *gld)
-{
- Evas_GL_API *gl = gld->glapi;
-
- GLbyte vShaderStr[] =
- "attribute vec4 vPosition; \n"
- "void main() \n"
- "{ \n"
- " gl_Position = vPosition; \n"
- "} \n";
-
- GLbyte fShaderStr[] =
- "#ifdef GL_ES \n"
- "precision mediump float; \n"
- "#endif \n"
- "void main() \n"
- "{ \n"
- " gl_FragColor = vec4 ( 1.0, 0.0, 0.0, 1.0 );\n"
- "} \n";
-
- GLint linked;
-
- gld->vtx_shader = load_shader(gld, GL_VERTEX_SHADER, (const char*)vShaderStr);
- gld->fgmt_shader = load_shader(gld, GL_FRAGMENT_SHADER, (const char*)fShaderStr);
-
- gld->program = gl->glCreateProgram( );
- if (gld->program==0)
- return 0;
-
- gl->glAttachShader(gld->program, gld->vtx_shader);
- gl->glAttachShader(gld->program, gld->fgmt_shader);
-
- gl->glBindAttribLocation(gld->program, 0, "vPosition");
- gl->glLinkProgram(gld->program);
- gl->glGetProgramiv(gld->program, GL_LINK_STATUS, &linked);
-
- if (!linked)
- {
- GLint info_len = 0;
- gl->glGetProgramiv(gld->program, GL_INFO_LOG_LENGTH, &info_len);
- if (info_len > 1)
- {
- char* info_log = new char[sizeof(char) * info_len];
-
- gl->glGetProgramInfoLog(gld->program, info_len, NULL, info_log);
- printf("Error linking program:\n%s\n", info_log);
- delete [] info_log;
- }
- gl->glDeleteProgram(gld->program);
- return 0;
- }
- return 1;
-}
-
-static void
-_init_gl(Evas_Object *obj)
-{
- GLData *gld = static_cast<GLData*>(evas_object_data_get(obj, "gld"));
- assert(gld != 0);
- ::elm::glview glv(eo_ref(obj));
- Evas_GL_API *gl = glv.gl_api_get();
- GLfloat vVertices[] = {
- 0.0f, 0.5f, 0.0f,
- -0.5f, -0.5f, 0.0f,
- 0.5f, -0.5f, 0.0f };
-
- if (!init_shaders(gld))
- {
- std::cout << "Error Initializing Shaders" << std::endl;
- return;
- }
-
- gl->glGenBuffers(1, &gld->vbo);
- gl->glBindBuffer(GL_ARRAY_BUFFER, gld->vbo);
- gl->glBufferData(GL_ARRAY_BUFFER, 3 * 3 * 4, vVertices, GL_STATIC_DRAW);
-
-}
-
-static void
-_del_gl(Evas_Object *obj)
-{
- GLData *gld = static_cast<GLData*>(evas_object_data_get(obj, "gld"));
- if (!gld)
- {
- std::cout << "Unable to get GLData. " << std::endl;
- return;
- }
- ::elm::glview glv(eo_ref(obj));
- Evas_GL_API *gl = glv.gl_api_get();
-
- gl->glDeleteShader(gld->vtx_shader);
- gl->glDeleteShader(gld->fgmt_shader);
- gl->glDeleteProgram(gld->program);
- gl->glDeleteBuffers(1, &gld->vbo);
-
- evas_object_data_del(obj, "..gld");
- free(gld);
-}
-
-static void
-_resize_gl(Evas_Object *obj)
-{
- int w, h;
- ::elm::glview glv(eo_ref(obj));
- Evas_GL_API *gl = glv.gl_api_get();
-
- glv.size_get(&w, &h);
-
- gl->glViewport(0, 0, w, h);
-}
-
-static void
-_draw_gl(Evas_Object *obj)
-{
- GLData *gld = static_cast<GLData*>(evas_object_data_get(obj, "gld"));
- ::elm::glview glv(eo_ref(obj));
- Evas_GL_API *gl = glv.gl_api_get();
-
- if (!gld) return;
- int w, h;
-
- glv.size_get(&w, &h);
-
- gl->glViewport(0, 0, w, h);
- gl->glClearColor(red,0.8,0.3,1);
- gl->glClear(GL_COLOR_BUFFER_BIT);
-
- gl->glEnable(GL_BLEND);
-
- gl->glUseProgram(gld->program);
-
- gl->glBindBuffer(GL_ARRAY_BUFFER, gld->vbo);
- gl->glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
- gl->glEnableVertexAttribArray(0);
-
- gl->glDrawArrays(GL_TRIANGLES, 0, 3);
-
- gl->glFinish();
-
- red -= 0.1;
- if (red < 0.0) red = 1.0;
-}
-
-static Eina_Bool
-_anim(void* data)
-{
- static_cast<elm::glview*>(data)->changed_set();
-
- return EINA_TRUE;
-}
-
-EAPI_MAIN int
-elm_main (int argc, char *argv[])
-{
- GLData *gld = NULL;
-
- if (!(gld = static_cast<GLData*>(calloc(1, sizeof(GLData))))) return 1;
-
- elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
-
- ::elm::win win(elm_win_util_standard_add("glview simple", "GLView Simple"));
- win.autohide_set(true);
-
- ::elm::box bx(efl::eo::parent = win);
- bx.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- win.resize_object_add(bx);
- bx.visible_set(true);
-
- ::elm::glview gl(efl::eo::parent = win,
- gl.version_constructor(EVAS_GL_GLES_2_X));
- gld->glapi = gl.gl_api_get();
- gl.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- gl.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
-
- int gl_mode = ELM_GLVIEW_ALPHA | ELM_GLVIEW_DEPTH;
- gl.mode_set(static_cast<Elm_GLView_Mode>(gl_mode));
- gl.resize_policy_set(ELM_GLVIEW_RESIZE_POLICY_RECREATE);
- gl.render_policy_set(ELM_GLVIEW_RENDER_POLICY_ON_DEMAND);
- gl.init_func_set(_init_gl);
- gl.del_func_set(_del_gl);
- gl.resize_func_set(_resize_gl);
- gl.render_func_set(_draw_gl);
-
- bx.pack_end(gl);
- gl.visible_set(true);
-
- gl.object::focus_set(true);
-
- Ecore_Animator *ani = ecore_animator_add(_anim, &gl);
-
- evas_object_data_set(gl._eo_ptr(), "ani", ani);
- evas_object_data_set(gl._eo_ptr(), "gld", gld);
- gl.object::callback_del_add(std::bind([&] () { ecore_animator_del(ani); }));
-
- ::elm::button bt(efl::eo::parent = win);
- bt.text_set(nullptr, "OK");
- bt.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
- bt.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0);
- bx.pack_end(bt);
- bt.visible_set(true);
- bt.callback_clicked_add(std::bind([] () { elm_exit(); }));
-
- win.size_set(320, 480);
- win.visible_set(true);
-
- elm_run();
- return 0;
-}
-ELM_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 @@
-#include <Elementary.hh>
-#include <Eina.hh>
-#include <Evas.hh>
-
-static void _print_items(void *data, Evas_Object *obj, void *event_info);
-static void _free(void *data, Evas_Object *obj, void *event_info);
-
-EAPI_MAIN int
-elm_main (int argc, char *argv[])
-{
- efl::eina::eina_init eina_init;
-
- elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
-
- ::elm::win::Standard win;
- win.title_set("Hoversel");
- win.autohide_set(true);
-
- ::evas::Rectangle rect(efl::eo::parent = win);
- rect.color_set(255, 0, 0, 255);
- rect.visible_set(true);
-
- ::elm::hoversel hoversel(efl::eo::parent = win);
- hoversel.horizontal_set(false);
- hoversel.part_text_set("elm.text", "Add an item to Hoversel");
- hoversel.part_content_set(nullptr, rect);
-
- hoversel.item_add("Print items", nullptr, ELM_ICON_NONE, &_print_items, NULL);
- hoversel.item_add( "Option 2", "home", ELM_ICON_STANDARD, NULL,NULL);
-
- auto add_item = std::bind([] (::elm::hoversel obj)
- {
- static int num = 0;
- char *str = new char[sizeof(char) * 10];
-
- snprintf(str, 10, "item %d", ++num);
-
- elm::widget_item hoversel_item = obj.item_add(str, nullptr, ELM_ICON_NONE, NULL, str);
- elm_object_item_del_cb_set(hoversel_item._eo_ptr(), &_free);
- }, std::placeholders::_1);
-
- hoversel.callback_clicked_add(add_item);
-
- hoversel.size_set(180, 30);
- hoversel.position_set( 10, 10);
- hoversel.visible_set(true);
-
- ::elm::button btn(efl::eo::parent = win);
- btn.text_set("elm.text", "Clear all Items");
-
- auto clear_btn_clicked = std::bind([&] () { hoversel.clear(); });
-
- btn.callback_clicked_add(clear_btn_clicked);
- btn.size_set(180, 30);
- btn.position_set(10, 50);
- btn.visible_set(true);
-
- win.size_set(200, 300);
- win.visible_set(true);
-
- elm_run();
-
- return 0;
-}
-ELM_MAIN()
-
-static void
-_print_items(void *data, Evas_Object *obj, void *event_info)
-{
- efl::eina::range_list<const elm::hoversel_item> items(elm_hoversel_items_get(obj));
-
- for (auto i : items)
- try
- {
- std::cout << i.part_text_get(nullptr) << std::endl;
- }
- catch (std::logic_error const&) {}
-}
-
-static void
-_free(void *data, Evas_Object *obj, void *event_info)
-{
- delete[] static_cast<char *>(data);
-}
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 @@
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#include "elementary_config.h"
-#endif
-
#include <Elementary.hh>
EAPI_MAIN int
@@ -30,13 +25,8 @@ elm_main (int argc EINA_UNUSED, char **argv EINA_UNUSED)
//icon.smooth_set(false);
//icon.fill_outside_set(true);
- // icon.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- //win.resize_object_add(icon);
- icon.eo_cxx::efl::Gfx::size_set({320,320});
- icon.visible_set(true);
-
- win.eo_cxx::efl::Gfx::size_set({320, 320});
- win.visible_set(true);
+ win.content_set(icon);
+ win.size_set({320, 320});
elm_run();
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 @@
-#include <Elementary.hh>
-
-#ifdef ELM_ELOCATION
-#include <Elocation.h>
-#endif
-
-#ifdef ELM_ELOCATION
-static void
-_print_position(Elocation_Position *position, ::elm::label label)
-{
- char buffer[1024];
-
- if (!position) return;
- snprintf(buffer, sizeof(buffer),
- "<b>GeoClue position reply with data from timestamp</b> %i<br/>"
- "<b>Latitude:</b> %f<br/>"
- "<b>Longitude:</b> %f<br/>"
- "<b>Altitude:</b> %f<br/>"
- "<b>Accuracy level:</b> %i<br/>"
- "<b>Accuracy horizontal:</b> %f<br/>"
- "<b>Accuracy vertical:</b> %f",
- position->timestamp, position->latitude, position->longitude,
- position->altitude, position->accur->level,
- position->accur->horizontal, position->accur->vertical);
- label.text_set("elm.text", buffer);
-}
-
-static Eina_Bool
-_position_changed(void *data, int ev_type, void *event)
-{
- Elocation_Position *position;
-
- position = static_cast<Elocation_Position*>(event);
- _print_position(position, *static_cast<::elm::label*>(data));
- return ECORE_CALLBACK_DONE;
-}
-#endif
-
-EAPI_MAIN int
-elm_main(int argc, char *argv[])
-{
-#ifdef ELM_ELOCATION
- Elocation_Address *address;
- Elocation_Position *position;
-#endif
-
- if (elm_need_elocation() == false)
- return -1;
-
- elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
-
- ::elm::win win(elm_win_util_standard_add("elocation", "Elocation example"));
- win.autohide_set(true);
-
- ::elm::label label(efl::eo::parent = win);
- label.line_wrap_set(ELM_WRAP_CHAR);
- label.text_set("elm.text", "Getting location ...");
- label.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0);
- label.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
- label.slide_mode_set(ELM_LABEL_SLIDE_MODE_ALWAYS);
- label.size_set(600, 480);
- label.visible_set(true);
-
-#ifdef ELM_ELOCATION
- address = elocation_address_new();
- position = elocation_position_new();
-
- ecore_event_handler_add(ELOCATION_EVENT_POSITION, _position_changed, &label);
-
- elocation_position_get(position);
- _print_position(position, label);
-#endif
-
- win.size_set(600, 480);
- win.visible_set(true);
-
- elm_run();
- return 0;
-}
-ELM_MAIN()
-
-
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 @@
#include <Elementary.hh>
-#include <Eina.hh>
-#include <Evas.hh>
+
+#warning This example can't be implemented with EO APIs... FIXME
EAPI_MAIN int
-elm_main (int argc, char *argv[])
+elm_main (int argc EINA_UNUSED, char *argv[] EINA_UNUSED)
{
efl::eina::eina_init eina_init;
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
- ::elm::win_standard win;
- win.title_set("Menu");
+ efl::ui::Win win(efl::eo::instantiate);
+ win.text_set("Menu Example");
win.autohide_set(true);
+#if 0
evas::rectangle rect(efl::eo::parent = win);
win.resize_object_add(rect);
rect.size_hint_min_set(0, 0);
@@ -60,8 +61,8 @@ elm_main (int argc, char *argv[])
rect.callback_mouse_down_add( show );
menu.visible_set(true);
- win.size_set(250, 350);
- win.visible_set(true);
+#endif
+ win.size_set({250, 350});
elm_run();
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 @@
-#include <Elementary.hh>
-
-EAPI_MAIN int
-elm_main(int argc, char **argv)
-{
- elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
-
- ::elm::win_standard win;
- win.title_set("Popup");
- win.autohide_set(true);
-
- ::elm::popup popup(efl::eo::parent = win);
- popup.timeout_set(3.0);
- popup.text_set(nullptr, "Title");
- popup.visible_set(true);
-
- auto popup_hide = std::bind ( [&] ()
- {
- popup.visible_set(false);
- });
-
- popup.callback_timeout_add(popup_hide);
- popup.callback_block_clicked_add(popup_hide);
- win.size_set(480, 800);
- win.visible_set(true);
-
- elm_run();
- return 0;
-}
-ELM_MAIN()
-
-
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 @@
+// 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
+
+#define EFL_CXX_WREF_EASY
#include <Elementary.hh>
+#include <iostream>
+
+using efl::eo::instantiate;
-EAPI_MAIN int
-elm_main (int argc, char *argv[])
+static void
+efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
{
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
- static int val = 1;
-
- ::elm::win_standard win;
- win.title_set("Radio");
+ efl::ui::Win win(instantiate);
+ win.text_set("Radio Example");
win.autohide_set(true);
- ::efl::ui::Box bx(efl::eo::parent = win);
- bx.horizontal_set(true);
- bx.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- win.resize_object_add(bx);
- bx.visible_set(true);
+ efl::ui::Box bx(instantiate, win);
+ bx.direction_set(EFL_UI_DIR_HORIZONTAL);
+ win.content_set(bx);
- ::elm::radio radio(efl::eo::parent = win);
- ::elm::radio group(efl::eo::parent = win);
- group = radio;
- radio.text_set("elm.text", "Radio 1");
+ efl::ui::Radio radio(instantiate, win);
+ efl::ui::Radio group = radio;
+ radio.text_set("Radio 1");
radio.state_value_set(1);
- radio.value_pointer_set(&val);
- ::elm::icon ic(efl::eo::parent = win);
- ic.standard_set("home");
- radio.content_set("icon", ic);
- bx.pack_end(radio);
- radio.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- radio.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
- radio.visible_set(true);
- auto cb_val = std::bind([] () { std::cout << "val is now: " << val << std::endl; });
+ efl::ui::Image ic(instantiate, win);
+ ic.icon_set("home");
+ radio.content_set(ic);
+ bx.pack_end(radio);
- radio.callback_changed_add(cb_val);
+ auto cb_val = std::bind([] (efl::ui::Radio &obj)
+ { std::cout << "val is now: " << obj.value_get() << std::endl; },
+ std::placeholders::_1);
+ efl::eolian::event_add(efl::ui::Radio::changed_event, radio, cb_val);
- ::elm::radio radio2(efl::eo::parent = win);
- radio2.text_set("elm.text", "Radio 2");
+ efl::ui::Radio radio2(instantiate, win);
+ radio2.text_set("Radio 2");
radio2.state_value_set(2);
- radio2.value_pointer_set(&val);
radio2.group_add(group);
- ::elm::icon ic2(efl::eo::parent = win);
- ic2.standard_set("file");
- radio2.content_set("icon", ic2);
+
+ efl::ui::Image ic2(instantiate, win);
+ ic2.icon_set("file");
+ radio2.content_set(ic2);
bx.pack_end(radio2);
- radio2.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- radio2.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
- radio2.visible_set(true);
- radio2.callback_changed_add(cb_val);
+ efl::eolian::event_add(efl::ui::Radio::changed_event, radio2, cb_val);
- ::elm::radio radio3(efl::eo::parent = win);
- radio3.text_set("elm.text", "Radio 3");
+ efl::ui::Radio radio3(instantiate, win);
+ radio3.text_set("Radio 3");
radio3.state_value_set(3);
- radio3.value_pointer_set(&val);
radio3.group_add(group);
bx.pack_end(radio3);
- radio3.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- radio3.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
- radio3.visible_set(true);
- radio3.callback_changed_add(cb_val);
+ efl::eolian::event_add(efl::ui::Radio::changed_event, radio3, cb_val);
- ::elm::radio radio4(efl::eo::parent = win);
- radio4.text_set("elm.text", "Radio 4");
+ efl::ui::Radio radio4(instantiate, win);
+ radio4.text_set("Radio 4");
radio4.state_value_set(4);
- radio4.value_pointer_set(&val);
radio4.group_add(group);
bx.pack_end(radio4);
- radio4.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- radio4.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
- radio4.visible_set(true);
- radio4.callback_changed_add(cb_val);
-
- win.visible_set(true);
-
- elm_run();
- return 0;
+ efl::eolian::event_add(efl::ui::Radio::changed_event, radio4, cb_val);
}
-ELM_MAIN()
+EFL_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 @@
+// 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
+
#include <Elementary.hh>
-EAPI_MAIN int
-elm_main (int argc, char *argv[])
+using efl::eo::instantiate;
+
+static void
+efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
{
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
- ::elm::win win(elm_win_util_standard_add("slider", "Slider Example"));
+ efl::ui::Win win(instantiate);
+ win.text_set("Slider example");
win.autohide_set(true);
- ::elm::box bx(efl::eo::parent = win);
- bx.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- win.resize_object_add(bx);
- bx.visible_set(true);
+ efl::ui::Box bx(instantiate, win);
+ win.content_set(bx);
- ::elm::slider sl(efl::eo::parent = win);
- sl.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- sl.size_hint_align_set(EVAS_HINT_FILL, 0.5);
+ efl::ui::Slider sl(instantiate, win);
+ sl.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5);
bx.pack_end(sl);
- sl.visible_set(true);
-
- ::elm::slider sl2(efl::eo::parent = win);
- sl2.text_set("elm.text", "Counter");
- ::elm::icon ic(efl::eo::parent = win);
- ic.standard_set("home");
- ic.resizable_set(false, false);
- sl2.content_set("icon", ic);
-
- ::elm::icon ic2(efl::eo::parent = win);
- ic2.standard_set("folder");
- ic2.resizable_set(false, false);
- sl2.content_set("end", ic2);
-
- sl2.size_hint_align_set(EVAS_HINT_FILL, 0.5);
- sl2.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ efl::ui::Slider sl2(instantiate, win);
+ sl2.text_set("Counter");
+ efl::ui::Image ic(instantiate, win);
+ ic.icon_set("home");
+ ic.scalable_set(false, false);
+ sl2.content_set(ic);
+
+ efl::ui::Image ic2(instantiate, win);
+ ic2.icon_set("folder");
+ ic2.scalable_set(false, false);
+ efl::eo::downcast<efl::Container>(sl2.part("end")).content_set(ic2);
+
+ sl2.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5);
bx.pack_end(sl2);
- sl2.visible_set(true);
- ::elm::slider sl3(efl::eo::parent = win);
- sl3.value_set(1);
- sl3.hint_min_set(220, 0);
- sl3.size_hint_align_set(EVAS_HINT_FILL, 0.5);
- sl3.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ efl::ui::Slider sl3(instantiate, win);
+ sl3.range_value_set(1);
+ sl3.hint_min_set({220, 0});
+ sl3.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5);
bx.pack_end(sl3);
- sl3.visible_set(true);
- ::elm::slider sl4(efl::eo::parent = win);
- sl4.unit_format_set("%1.0f units");
- sl4.min_max_set(0, 100);
- sl4.size_hint_align_set(EVAS_HINT_FILL, 0.5);
- sl4.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ efl::ui::Slider sl4(instantiate, win);
+ sl4.format_string_set("%1.0f units");
+ sl4.range_min_max_set(0, 100);
+ sl4.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5);
bx.pack_end(sl4);
- sl4.visible_set(true);
- ::elm::slider sl5(efl::eo::parent = win);
+ efl::ui::Slider sl5(instantiate, win);
sl5.indicator_format_set("%1.2f");
- sl5.inverted_set(true);
- sl5.size_hint_align_set(EVAS_HINT_FILL, 0.5);
- sl5.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ sl4.direction_set(EFL_UI_DIR_UP);
+ sl5.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5);
bx.pack_end(sl5);
- sl5.visible_set(true);
- ::elm::slider sl6(efl::eo::parent = win);
- sl6.horizontal_set(false);
+ efl::ui::Slider sl6(instantiate, win);
+ sl4.direction_set(EFL_UI_DIR_HORIZONTAL);
- auto indicator_format = [] (double val) {
- char *indicator = new char[32];
- snprintf(indicator, 32, "%1.2f u", val);
- return indicator;
- };
+// FIXME
+// auto indicator_format = [] (double val) {
+// char *indicator = new char[32];
+// snprintf(indicator, 32, "%1.2f u", val);
+// return indicator;
+// };
+// auto indicator_free = [] (char *obj) {delete obj;} ;
+// sl6.indicator_format_function_set(indicator_format, indicator_free);
- auto indicator_free = [] (char *obj) {delete obj;} ;
-
- sl6.indicator_format_function_set(indicator_format, indicator_free);
-
- sl6.size_hint_align_set(0.5, EVAS_HINT_FILL);
- sl6.size_hint_weight_set(0, EVAS_HINT_EXPAND);
+ sl6.hint_align_set(0.5, EFL_GFX_SIZE_HINT_FILL);
+ sl6.hint_weight_set(0, EFL_GFX_SIZE_HINT_EXPAND);
bx.pack_end(sl6);
- sl6.visible_set(true);
- ::elm::slider sl7(efl::eo::parent = win);
- sl7.unit_format_set("%1.3f units");
- sl7.indicator_format_function_set(indicator_format, indicator_free);
- sl7.size_hint_align_set(EVAS_HINT_FILL, 0.5);
- sl7.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ efl::ui::Slider sl7(instantiate, win);
+ sl7.format_string_set("%1.3f units");
+// sl7.indicator_format_function_set(indicator_format, indicator_free);
+ sl7.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5);
bx.pack_end(sl7);
- sl7.visible_set(true);
-
- auto changed = std::bind ( [] (::elm::slider obj)
- {
- double val = obj.value_get();
- std::cout << "Changed to " << val << std::endl;
- } , std::placeholders::_1 );
-
- auto delay = std::bind ( [] (::elm::slider obj)
- {
- double val = obj.value_get();
- std::cout << "Delay changed to " << val << std::endl;
- } , std::placeholders::_1 );
- sl7.callback_changed_add(changed);
- sl7.callback_delay_changed_add(delay);
+ auto changed = std::bind ( [] (efl::ui::Slider obj)
+ { std::cout << "Changed to " << obj.range_value_get() << std::endl; }
+ , std::placeholders::_1);
- win.visible_set(true);
+ auto delay = std::bind ( [] (efl::ui::Slider obj)
+ { std::cout << "Delay changed to " << obj.range_value_get() << std::endl; }
+ , std::placeholders::_1);
- elm_run();
- return 0;
+ efl::eolian::event_add(sl7.changed_event, sl7, changed);
+ efl::eolian::event_add(sl7.delay_changed_event, sl7, delay);
}
-ELM_MAIN()
+EFL_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 @@
+// 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
+
+#define ELM_WIDGET_PROTECTED
+
#include <Elementary.hh>
+#include <iostream>
+
+#warning This example is using legacy elm_spinner
-EAPI_MAIN int
-elm_main (int argc, char *argv[])
+using efl::eo::instantiate;
+
+static void
+efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
{
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
- ::elm::win win(elm_win_util_standard_add("spinner", "Spinner Example"));
+ efl::ui::Win win(instantiate);
+ win.text_set("Spinner Example");
win.autohide_set(true);
- ::elm::box bx(efl::eo::parent = win);
- bx.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- win.resize_object_add(bx);
- bx.visible_set(true);
+ efl::ui::Box bx(instantiate, win);
+ win.content_set(bx);
- ::elm::spinner sp(efl::eo::parent = win);
- sp.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- sp.size_hint_align_set(EVAS_HINT_FILL, 0.5);
+ elm::Spinner sp(instantiate, win);
+ sp.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5);
bx.pack_end(sp);
- sp.visible_set(true);
- ::elm::spinner sp2(efl::eo::parent = win);
+ elm::Spinner sp2(instantiate, win);
sp2.label_format_set("Percentage %%%1.2f something");
- sp2.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- sp2.size_hint_align_set(EVAS_HINT_FILL, 0.5);
+ sp2.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5);
bx.pack_end(sp2);
- sp2.visible_set(true);
- ::elm::spinner sp3(efl::eo::parent = win);
+ elm::Spinner sp3(instantiate, win);
sp3.label_format_set("%1.1f units");
sp3.step_set(1.5);
sp3.wrap_set(true);
sp3.min_max_set(-50.0, 250.0);
- sp3.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- sp3.size_hint_align_set(EVAS_HINT_FILL, 0.5);
+ sp3.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5);
bx.pack_end(sp3);
- sp3.visible_set(true);
- ::elm::spinner sp4(efl::eo::parent = win);
+ elm::Spinner sp4(instantiate, win);
sp4.style_set("vertical");
sp4.interval_set(0.2);
- sp4.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- sp4.size_hint_align_set(EVAS_HINT_FILL, 0.5);
+ sp4.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5);
bx.pack_end(sp4);
- sp4.visible_set(true);
- ::elm::spinner sp5(efl::eo::parent = win);
+ elm::Spinner sp5(instantiate, win);
sp5.editable_set(false);
- sp5.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- sp5.size_hint_align_set(EVAS_HINT_FILL, 0.5);
+ sp5.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5);
bx.pack_end(sp5);
- sp5.visible_set(true);
- ::elm::spinner sp6(efl::eo::parent = win);
+ elm::Spinner sp6(instantiate, win);
sp6.editable_set(false);
sp6.min_max_set(1, 12);
sp6.special_value_add(1, "January");
@@ -66,30 +64,22 @@ elm_main (int argc, char *argv[])
sp6.special_value_add(10, "October");
sp6.special_value_add(11, "November");
sp6.special_value_add(12, "December");
- sp6.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- sp6.size_hint_align_set(EVAS_HINT_FILL, 0.5);
+ sp6.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5);
bx.pack_end(sp6);
- sp6.visible_set(true);
- ::elm::spinner sp7(efl::eo::parent = win);
- sp7.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- sp7.size_hint_align_set(EVAS_HINT_FILL, 0.5);
+ elm::Spinner sp7(instantiate, win);
+ sp7.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5);
bx.pack_end(sp7);
- sp7.visible_set(true);
sp7.editable_set(true);
- auto changed = std::bind([&] () { std::cout << "Value changed to " << sp7.value_get() << std::endl; });
-
- sp7.callback_changed_add( changed );
+ auto changed = std::bind([] (elm::Spinner &spinner)
+ { std::cout << "Value changed to " << spinner.value_get() << std::endl; },
+ std::placeholders::_1);
+ efl::eolian::event_add(elm::Spinner::changed_event, sp7, changed);
- auto delay = std::bind([&] () {std::cout << "Value delay changed to " << sp7.value_get() << std::endl;});
-
- sp7.callback_delay_changed_add( delay );
-
- win.visible_set(true);
-
- elm_run();
- return 0;
+ auto delay = std::bind([] (elm::Spinner &spinner)
+ { std::cout << "Value changed to " << spinner.value_get() << "" << std::endl; },
+ std::placeholders::_1);
+ efl::eolian::event_add(elm::Spinner::delay_changed_event, sp7, delay);
}
-ELM_MAIN()
-
+EFL_MAIN()
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 @@
+// 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
#include <Elementary.hh>
-EAPI_MAIN int
-elm_main (int argc, char *argv[])
+using efl::eo::instantiate;
+
+static void
+efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
{
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
- ::elm::win win(elm_win_util_standard_add("table", "Table"));
+ efl::ui::Win win(instantiate);
+ win.text_set("Table example");
win.autohide_set(true);
- ::elm::table table(efl::eo::parent = win);
- win.resize_object_add(table);
- table.visible_set(true);
- table.padding_set(5, 5);
- table.homogeneous_set(true);
-
- ::elm::label label(efl::eo::parent = win);
- label.text_set(nullptr, "label 0");
- label.visible_set(true);
- table.pack(label, 0, 0, 1, 1);
+ efl::ui::Grid table(instantiate, win);
+ win.content_set(table);
+ table.pack_padding_set(5, 5, true);
+// FIXME
+// table.homogeneous_set(true);
- ::elm::label label1(efl::eo::parent = win);
- label1.text_set(nullptr, "label 1");
- label1.visible_set(true);
- table.pack(label1, 1, 0, 1, 1);
+ efl::ui::Text label(instantiate, win);
+ label.text_set("label 0");
+ table.pack_grid(label, 0, 0, 1, 1);
- ::elm::label label2(efl::eo::parent = win);
- label2.text_set(nullptr, "label 2");
- label2.visible_set(true);
- table.pack(label2, 0, 1, 1, 1);
+ efl::ui::Text label1(instantiate, win);
+ label1.text_set("label 1");
+ table.pack_grid(label1, 1, 0, 1, 1);
- ::elm::label label3(efl::eo::parent = win);
- label3.text_set(nullptr, "label 3");
- label3.visible_set(true);
- table.pack(label3, 1, 1, 1, 1);
+ efl::ui::Text label2(instantiate, win);
+ label2.text_set("label 2");
+ table.pack_grid(label2, 0, 1, 1, 1);
- win.visible_set(true);
-
- elm_run();
- return 0;
+ efl::ui::Text label3(instantiate, win);
+ label3.text_set("label 3");
+ table.pack_grid(label3, 1, 1, 1, 1);
}
-ELM_MAIN()
-
+EFL_MAIN()
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 @@
-#include <Elementary.hh>
+// 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
+
#include <Evas.hh>
+#include <Elementary.hh>
+
+using efl::eo::instantiate;
-EAPI_MAIN int
-elm_main (int argc, char *argv[])
+static void
+efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
{
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
- ::elm::win win(elm_win_util_standard_add("table", "Table"));
+ efl::ui::Win win(instantiate);
+ win.text_set("Table example");
win.autohide_set(true);
- ::elm::table table(efl::eo::parent = win);
- win.resize_object_add(table);
- table.visible_set(true);
- table.homogeneous_set(false);
-
- evas::rectangle rect(efl::eo::parent = win);
- rect.color_set( 255, 0, 0, 255);
- rect.size_hint_min_set( 100, 50);
- rect.visible_set(true);
- table.pack(rect, 0, 0, 2, 1);
-
- evas::rectangle rect2(efl::eo::parent = win);
- rect2.color_set( 0, 255, 0, 255);
- rect2.size_hint_min_set(50, 100);
- rect2.visible_set(true);
- table.pack(rect2, 0, 1, 1, 2);
-
- evas::rectangle rect3(efl::eo::parent = win);
- rect3.color_set( 0, 0, 255, 255);
- rect3.size_hint_min_set(50, 50);
- rect3.visible_set(true);
- table.pack(rect3, 1, 1, 1, 1);
-
- evas::rectangle rect4(efl::eo::parent = win);
- rect4.color_set( 255, 255, 0, 255);
- rect4.size_hint_min_set(50, 50);
- rect4.visible_set(true);
- table.pack(rect4, 1, 2, 1, 1);
-
- win.visible_set(true);
-
- elm_run();
- return 0;
+ efl::ui::Grid table(instantiate, win);
+ win.content_set(table);
+ table.pack_padding_set(5, 5, true);
+
+ efl::canvas::Rectangle rect(instantiate, win);
+ rect.color_set(255, 0, 0, 255);
+ rect.hint_min_set({100, 50});
+ table.pack_grid(rect, 0, 0, 2, 1);
+
+ efl::canvas::Rectangle rect2(instantiate, win);
+ rect2.color_set(0, 255, 0, 255);
+ rect2.hint_min_set({50, 100});
+ table.pack_grid(rect2, 0, 1, 1, 2);
+
+ efl::canvas::Rectangle rect3(instantiate, win);
+ rect3.color_set(0, 0, 255, 255);
+ rect3.hint_min_set({50, 50});
+ table.pack_grid(rect3, 1, 1, 1, 1);
+
+ efl::canvas::Rectangle rect4(instantiate, win);
+ rect4.color_set(255, 255, 0, 255);
+ rect4.hint_min_set({50, 50});
+ table.pack_grid(rect4, 1, 2, 1, 1);
}
-ELM_MAIN()
+EFL_MAIN()