-#define EFL_EO_API_SUPPORT
-
#include <Elementary.hh>
+using efl::eo::instantiate;
+
EAPI_MAIN int
elm_main (int argc EINA_UNUSED, char **argv EINA_UNUSED)
{
- efl::ui::Win win;
- win.text_set("Bg Plain");
+ efl::ui::Win win(instantiate);
+ win.text_set("Window Background");
win.autohide_set(true);
+ win.size_set({320,320});
+ try {
+ auto bg = efl::eo::downcast<efl::ui::win::Part>(win.part("background"));
+ bg.color_set(139, 69, 19, 255);
+ } catch (std::exception const&e) {
+ std::cerr << "Failed to set bg color: " << e.what() << std::endl;
+ }
- win.eo_cxx::efl::Gfx::size_set({320,320});
- //win.size_set(320,320);
- win.visible_set(true);
+ // Clean exit
+ elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
+ efl::eolian::event_add(efl::ui::Win::delete_request_event, win,
+ std::bind([&](){ win = nullptr; }));
elm_run();
return 0;
#include <Elementary.hh>
-#include <sstream>
-
using efl::eo::instantiate;
-efl::ui::Win win;
+static efl::ui::Win win;
EAPI_MAIN void
-efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
+efl_main(void *data EINA_UNUSED, const Efl_Event *ev)
{
+ Efl_Loop_Arguments *args = static_cast<Efl_Loop_Arguments *>(ev->info);
+
win = efl::ui::Win(instantiate);
- ::efl_ref(win._eo_ptr()); // FIXME: Window is doing BAD THINGSā¢!
win.text_set("Bg Image");
win.autohide_set(true);
+ win.delete_request_event_cb_add([](){ win = nullptr; efl_exit(0); });
+
+ std::string path;
+ if (eina_array_count(args->argv) > 0)
+ path = static_cast<const char *>(eina_array_data_get(args->argv, 0));
+ else
+ path = "performance/background.png";
efl::ui::Bg bg(instantiate, win);
bg.scale_type_set(EFL_UI_IMAGE_SCALE_TYPE_FILL);
- bg.file_set("performance/background.png", nullptr);
+ bg.file_set(path, nullptr);
win.content_set(bg);
win.size_set({640, 400});
- std::cout << "win " << win._eo_ptr() << std::endl;
- win.delete_request_event_cb_add([](){ win = nullptr; efl_exit(0); });
}
EFL_MAIN()