2017-09-26 03:44:36 -07:00
|
|
|
/* To compile:
|
|
|
|
* g++ `pkg-config --cflags --libs elementary-cxx eo-cxx efl-cxx eina-cxx ecore-cxx evas-cxx edje-cxx` ./bg_cxx_example_02.cc -o bg_cxx_example_02
|
|
|
|
*
|
|
|
|
* To run:
|
|
|
|
* ./bg_cxx_example_02
|
|
|
|
*/
|
|
|
|
|
2014-12-16 13:04:43 -08:00
|
|
|
#include <Elementary.hh>
|
|
|
|
|
|
|
|
#include <sstream>
|
|
|
|
|
2017-11-12 18:43:04 -08:00
|
|
|
using efl::eo::instantiate;
|
2014-12-16 13:04:43 -08:00
|
|
|
|
2017-11-12 18:43:04 -08:00
|
|
|
efl::ui::Win win;
|
2017-09-11 11:12:30 -07:00
|
|
|
|
2017-11-12 18:43:04 -08:00
|
|
|
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™!
|
2017-09-26 03:44:36 -07:00
|
|
|
win.text_set("Bg Image");
|
2014-12-16 13:04:43 -08:00
|
|
|
win.autohide_set(true);
|
|
|
|
|
2017-09-26 03:44:36 -07:00
|
|
|
// FIXME: Part API needs some fixing to be nice in C++ :)
|
|
|
|
//efl::eo::downcast<efl::ui::win::Part>(win.part("background"))
|
|
|
|
// .file_set("performance/background.png", nullptr);
|
2014-12-16 13:04:43 -08:00
|
|
|
|
2017-09-26 03:44:36 -07:00
|
|
|
efl::ui::Bg bg(instantiate, win);
|
|
|
|
bg.scale_type_set(EFL_UI_IMAGE_SCALE_TYPE_FILL);
|
|
|
|
bg.file_set("performance/background.png", nullptr);
|
|
|
|
win.content_set(bg);
|
2014-12-16 13:04:43 -08:00
|
|
|
|
2017-11-12 18:43:04 -08:00
|
|
|
win.size_set({640, 400});
|
|
|
|
std::cout << "win " << win._eo_ptr() << std::endl;
|
|
|
|
win.delete_request_event_cb_add([](){ win = nullptr; efl_exit(0); });
|
2014-12-16 13:04:43 -08:00
|
|
|
}
|
2017-11-12 18:43:04 -08:00
|
|
|
EFL_MAIN()
|