From: Jean-Philippe Andre Date: Mon, 13 Nov 2017 02:43:04 +0000 (+0900) Subject: cxx: Some code style in examples X-Git-Tag: submit/sandbox/upgrade/efl120/20180319.053334~1378 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1997e1b3d02f4ff6869775d855bcb80ea89233fc;p=platform%2Fupstream%2Fefl.git 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. --- diff --git a/src/examples/elementary/bg_cxx_example_01.cc b/src/examples/elementary/bg_cxx_example_01.cc index 290ee57..8fcb78c 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 1cc3f72..34016b6 100644 --- a/src/examples/elementary/bg_cxx_example_02.cc +++ b/src/examples/elementary/bg_cxx_example_02.cc @@ -9,14 +9,15 @@ #include -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 1c0bf81..e89007f 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 cec2342..5e4683b 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)