diff --git a/test/Main.cpp b/test/Main.cpp index 08b8cef..9c15b9a 100644 --- a/test/Main.cpp +++ b/test/Main.cpp @@ -29,7 +29,7 @@ class MainApplication : public ewol::context::Application { _context.getFontDefault().setUseExternal(false); _context.getFontDefault().set("FreeSerif", 30); - ewol::object::Shared basicWindows = ewol::object::makeShared(new appl::Windows()); + std::shared_ptr basicWindows = appl::Windows::create(); // create the specific windows _context.setWindows(basicWindows); APPL_INFO("==> Init APPL (END)"); diff --git a/test/Windows.cpp b/test/Windows.cpp index d83dc24..126d862 100644 --- a/test/Windows.cpp +++ b/test/Windows.cpp @@ -24,8 +24,11 @@ static const char* const g_eventPlay1 = "appl-play-1"; static const char* const g_eventPlay2 = "appl-play-2"; -appl::Windows::Windows() : - m_composer(NULL) { +appl::Windows::Windows() { + addObjectType("appl::Windows"); +} + +void appl::Windows::init() { setTitle("example 001_HelloWord"); std::string composition = std::string(""); composition += "\n"; @@ -44,14 +47,14 @@ appl::Windows::Windows() : composition += " \n"; composition += "\n"; - m_composer = new ewol::widget::Composer(ewol::widget::Composer::String, composition); + m_composer = ewol::widget::Composer::create(ewol::widget::Composer::String, composition); if (m_composer == NULL) { APPL_CRITICAL(" An error occured ... in the windows creatrion ..."); return; } setSubWidget(m_composer); - m_composer->registerOnEventNameWidget(this, "bt-play1", "pressed", g_eventPlay1); - m_composer->registerOnEventNameWidget(this, "bt-play2", "pressed", g_eventPlay2); + m_composer->registerOnEventNameWidget(shared_from_this(), "bt-play1", "pressed", g_eventPlay1); + m_composer->registerOnEventNameWidget(shared_from_this(), "bt-play2", "pressed", g_eventPlay2); } eaudiofx::Processing* process = NULL; diff --git a/test/Windows.h b/test/Windows.h index 6691dcc..0bbe533 100644 --- a/test/Windows.h +++ b/test/Windows.h @@ -15,9 +15,12 @@ namespace appl { class Windows : public ewol::widget::Windows { private: - ewol::widget::Composer* m_composer; - public: + std::shared_ptr m_composer; + protected: Windows(); + void init(); + public: + DECLARE_FACTORY(Windows); public: // herited functions virtual void onReceiveMessage(const ewol::object::Message& _msg); };