jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=1997e1b3d02f4ff6869775d855bcb80ea89233fc
commit 1997e1b3d02f4ff6869775d855bcb80ea89233fc Author: Jean-Philippe Andre <[email protected]> Date: Mon Nov 13 11:43:04 2017 +0900 cxx: Some code style in examples Use the common form Class a(instantiate); instead of auto a = Class(instantiate); Also modify bg example to not use an policy. --- src/examples/elementary/bg_cxx_example_01.cc | 6 ++---- src/examples/elementary/bg_cxx_example_02.cc | 22 +++++++++++----------- src/examples/elementary/box_cxx_example_02.cc | 2 +- src/examples/elementary/calendar_cxx_example_02.cc | 2 +- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/examples/elementary/bg_cxx_example_01.cc b/src/examples/elementary/bg_cxx_example_01.cc index 290ee57a3f..8fcb78c0ea 100644 --- a/src/examples/elementary/bg_cxx_example_01.cc +++ b/src/examples/elementary/bg_cxx_example_01.cc @@ -5,10 +5,8 @@ EAPI_MAIN int elm_main (int argc EINA_UNUSED, char **argv EINA_UNUSED) { - elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); - - ::efl::ui::Win win; - // win.title_set("Bg Plain"); + efl::ui::Win win; + win.text_set("Bg Plain"); win.autohide_set(true); win.eo_cxx::efl::Gfx::size_set({320,320}); diff --git a/src/examples/elementary/bg_cxx_example_02.cc b/src/examples/elementary/bg_cxx_example_02.cc index 1cc3f7251b..34016b6c9c 100644 --- a/src/examples/elementary/bg_cxx_example_02.cc +++ b/src/examples/elementary/bg_cxx_example_02.cc @@ -9,14 +9,15 @@ #include <sstream> -EAPI_MAIN int -elm_main (int argc EINA_UNUSED, char **args EINA_UNUSED) -{ - elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); +using efl::eo::instantiate; - using efl::eo::instantiate; +efl::ui::Win win; - efl::ui::Win win(instantiate); +EAPI_MAIN void +efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) +{ + instantiate(win); + ::efl_ref(win._eo_ptr()); // FIXME: Window is doing BAD THINGS™! win.text_set("Bg Image"); win.autohide_set(true); @@ -29,9 +30,8 @@ elm_main (int argc EINA_UNUSED, char **args EINA_UNUSED) bg.file_set("performance/background.png", nullptr); win.content_set(bg); - win.eo_cxx::efl::Gfx::size_set({640, 400}); - - elm_run(); - return 0; + win.size_set({640, 400}); + std::cout << "win " << win._eo_ptr() << std::endl; + win.delete_request_event_cb_add([](){ win = nullptr; efl_exit(0); }); } -ELM_MAIN() +EFL_MAIN() diff --git a/src/examples/elementary/box_cxx_example_02.cc b/src/examples/elementary/box_cxx_example_02.cc index 1c0bf81b06..e89007fdec 100644 --- a/src/examples/elementary/box_cxx_example_02.cc +++ b/src/examples/elementary/box_cxx_example_02.cc @@ -18,7 +18,7 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) for (int i = 0; i < 5; i++) { - auto bt = efl::ui::Button(instantiate, win); + efl::ui::Button bt(instantiate, win); bt.text_set("Button " + std::to_string(i)); box.pack_end(bt); } diff --git a/src/examples/elementary/calendar_cxx_example_02.cc b/src/examples/elementary/calendar_cxx_example_02.cc index cec2342be4..5e4683baf6 100644 --- a/src/examples/elementary/calendar_cxx_example_02.cc +++ b/src/examples/elementary/calendar_cxx_example_02.cc @@ -30,7 +30,7 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) win.text_set("Calendar Layout Formatting Example"); win.autohide_set(true); - auto cal = efl::ui::Calendar(instantiate, win); + efl::ui::Calendar cal(instantiate, win); win.content_set(cal); // FIXME: Function cb doesn't work (C++ variant) --
