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.
This commit is contained in:
Jean-Philippe Andre 2017-11-13 11:43:04 +09:00
parent 258a214e0f
commit 1997e1b3d0
4 changed files with 16 additions and 18 deletions

View File

@ -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});

View File

@ -9,14 +9,15 @@
#include <sstream>
EAPI_MAIN int
elm_main (int argc EINA_UNUSED, char **args EINA_UNUSED)
using efl::eo::instantiate;
efl::ui::Win win;
EAPI_MAIN 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);
using efl::eo::instantiate;
efl::ui::Win win(instantiate);
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()

View File

@ -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);
}

View File

@ -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)