From 6f68563d50143d4854d89873bff1501c1164cad3 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Wed, 16 Mar 2016 21:42:49 +0100 Subject: [PATCH] [DEV] review interface (step 1) --- ewol/context/Application.cpp | 49 +++++ ewol/context/Application.h | 23 ++- ewol/context/Context.cpp | 168 ++---------------- ewol/context/Context.h | 93 +++------- ewol/resource/FontFreeType.cpp | 8 +- ewol/resource/TexturedFont.cpp | 2 +- ewol/tools/message.cpp | 70 ++++++++ ewol/tools/message.h | 55 ++++++ ewol/widget/Windows.cpp | 73 +++----- ewol/widget/Windows.h | 112 ++++-------- ewol/widget/meta/StdPopUp.cpp | 20 ++- ewol/widget/meta/StdPopUp.h | 22 +-- lutinParseSubFolders.txt | 4 + lutin_ewol.py | 9 + sample/001_HelloWord/appl/Main.cpp | 29 ++- sample/001_HelloWord/appl/Windows.cpp | 8 +- sample/001_HelloWord/appl/Windows.h | 3 + sample/001_HelloWord/lutin_001_HelloWord.py | 4 +- sample/0XX_CustomWidgets/appl/Main.cpp | 32 ++-- sample/0XX_CustomWidgets/appl/Windows.cpp | 14 +- sample/0XX_CustomWidgets/appl/Windows.h | 5 +- .../lutin_0XX_customwidget.py | 4 +- sample/examplewallpaper/appl/Main.cpp | 29 ++- .../examplewallpaper/appl/WidgetDisplay.cpp | 2 +- sample/examplewallpaper/appl/WidgetDisplay.h | 5 +- sample/examplewallpaper/appl/Windows.cpp | 9 +- sample/examplewallpaper/appl/Windows.h | 3 + .../lutin_examplewallpaper.py | 9 +- test/testWindows.cpp | 2 +- tools/visual_test/appl/init.cpp | 2 +- .../lutin_ewol-tools-visual-test.py | 32 ++-- 31 files changed, 442 insertions(+), 458 deletions(-) create mode 100644 ewol/context/Application.cpp create mode 100644 ewol/tools/message.cpp create mode 100644 ewol/tools/message.h create mode 100644 lutinParseSubFolders.txt rename lutin_ewol-tools-visual-test.py => tools/visual_test/lutin_ewol-tools-visual-test.py (57%) diff --git a/ewol/context/Application.cpp b/ewol/context/Application.cpp new file mode 100644 index 00000000..d60a9e91 --- /dev/null +++ b/ewol/context/Application.cpp @@ -0,0 +1,49 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license APACHE v2.0 (see license file) + */ + +#include +#include +#include + + +ewol::context::Application::Application() { + +} + +ewol::context::Application::~Application() { + +} + +void ewol::context::Application::onCreate(ewol::Context& _context) { + +} + +void ewol::context::Application::onStart(ewol::Context& _context) { + +} + +void ewol::context::Application::onResume(ewol::Context& _context) { + +} + +void ewol::context::Application::onPause(ewol::Context& _context) { + +} + +void ewol::context::Application::onStop(ewol::Context& _context) { + +} + +void ewol::context::Application::onDestroy(ewol::Context& _context) { + +} + +void ewol::context::Application::onKillDemand(ewol::Context& _context) { + _context.exit(0); +} + diff --git a/ewol/context/Application.h b/ewol/context/Application.h index c6f6a974..06104035 100644 --- a/ewol/context/Application.h +++ b/ewol/context/Application.h @@ -13,39 +13,44 @@ namespace ewol { namespace context { class Application { public: - Application() {}; - virtual ~Application() {}; + Application(); + virtual ~Application(); public: /** * @brief The application is created. * @param[in] _context Current ewol context. */ - virtual void onCreate(ewol::Context& _context) {}; + virtual void onCreate(ewol::Context& _context); /** * @brief The application is started. * @param[in] _context Current ewol context. */ - virtual void onStart(ewol::Context& _context) {}; + virtual void onStart(ewol::Context& _context); /** * @brief The application is resumed (now visible). * @param[in] _context Current ewol context. */ - virtual void onResume(ewol::Context& _context) {}; + virtual void onResume(ewol::Context& _context); /** * @brief The application is Hide / not visible. * @param[in] _context Current ewol context. */ - virtual void onPause(ewol::Context& _context) {}; + virtual void onPause(ewol::Context& _context); /** * @brief The application is stopped. * @param[in] _context Current ewol context. */ - virtual void onStop(ewol::Context& _context) {}; + virtual void onStop(ewol::Context& _context); /** - * @brief The application is remoed (call destructor just adter it.). + * @brief The application is removed (call destructor just adter it.). * @param[in] _context Current ewol context. */ - virtual void onDestroy(ewol::Context& _context) {}; + virtual void onDestroy(ewol::Context& _context); + /** + * @brief The user request application removing. + * @param[in] _context Current ewol context. + */ + virtual void onKillDemand(ewol::Context& _context); }; }; }; diff --git a/ewol/context/Context.cpp b/ewol/context/Context.cpp index 6b615cb4..9fedb4af 100644 --- a/ewol/context/Context.cpp +++ b/ewol/context/Context.cpp @@ -201,7 +201,18 @@ void ewol::Context::onDestroy(gale::Context& _context) { m_objectManager.displayListObject(); // now All must be removed !!! m_objectManager.unInit(); - EWOL_INFO(" == > Ewol system destroy (END)"); + EWOL_INFO(" == > Ewol system destroy (END)"); +} + +void ewol::Context::onKillDemand(gale::Context& _context) { + EWOL_INFO(" == > User demand a destroy (BEGIN)"); + std::shared_ptr appl = m_application; + if (appl == nullptr) { + exit(0); + return; + } + appl->onKillDemand(*this); + EWOL_INFO(" == > User demand a destroy (END)"); } void ewol::Context::onPointer(enum gale::key::type _type, @@ -333,107 +344,10 @@ void ewol::Context::onPeriod(int64_t _time) { m_objectManager.timeCall(_time); } -#if 0 -bool ewol::Context::OS_Draw(bool _displayEveryTime) { - int64_t currentTime = ewol::getTime(); - // this is to prevent the multiple display at the a high frequency ... - m_previousDisplayTime = currentTime; - - // process the events - if (m_displayFps == true) { - m_FpsSystemEvent.tic(); - } - bool needRedraw = false; - //! Event management section ... - { - // set the curent interface : - processEvents(); - if (m_initStepId < m_application->getNbStepInit()) { - ewol::eSystemMessage *data = new ewol::eSystemMessage(); - if (data == nullptr) { - EWOL_ERROR("allocation error of message"); - } else { - data->TypeMessage = eSystemMessage::msgInit; - m_msgSystem.post(data); - } - } - // call all the widget that neded to do something periodicly - m_objectManager.timeCall(currentTime); - - if (m_displayFps == true) { - m_FpsSystemEvent.incrementCounter(); - m_FpsSystemEvent.toc(); - } - //! bool needRedraw = ewol::widgetManager::isDrawingNeeded(); - needRedraw = m_widgetManager.isDrawingNeeded(); - // release the curent interface : - } - bool hasDisplayDone = false; - //! drawing section : - { - // Lock openGl context: - gale::openGL::lock(); - if (m_displayFps == true) { - m_FpsSystemContext.tic(); - } - if (nullptr != m_windowsCurrent) { - if( true == needRedraw - || true == _displayEveryTime) { - m_resourceManager.updateContext(); - if (m_displayFps == true) { - m_FpsSystemContext.incrementCounter(); - } - } - } - if (m_displayFps == true) { - m_FpsSystemContext.toc(); - m_FpsSystem.tic(); - } - if (nullptr != m_windowsCurrent) { - if( true == needRedraw - || true == _displayEveryTime) { - m_FpsSystem.incrementCounter(); - m_windowsCurrent->sysDraw(); - hasDisplayDone = true; - } - } - if (m_displayFps == true) { - m_FpsSystem.toc(); - m_FpsFlush.tic(); - } - if (hasDisplayDone == true) { - if (m_displayFps == true) { - m_FpsFlush.incrementCounter(); - } - gale::openGL::flush(); - } - if (m_displayFps == true) { - m_FpsFlush.toc(); - } - // release open GL Context - gale::openGL::unLock(); - } - { - // set the curent interface : - // release open GL Context - gale::openGL::lock(); - // while The Gui is drawing in OpenGl, we do some not realTime things - m_resourceManager.updateContext(); - // release open GL Context - gale::openGL::unLock(); - m_objectManager.cleanInternalRemoved(); - m_resourceManager.cleanInternalRemoved(); - // release the curent interface : - } - return hasDisplayDone; -} -#endif - void ewol::Context::resetIOEvent() { m_input.newLayerSet(); } - void ewol::Context::setWindows(const ewol::widget::WindowsShared& _windows) { EWOL_INFO("set New windows"); // remove current focus : @@ -441,8 +355,12 @@ void ewol::Context::setWindows(const ewol::widget::WindowsShared& _windows) { m_widgetManager.focusRelease(); // set the new pointer as windows system m_windowsCurrent = _windows; - // set the new default focus : + // set the new default focus: m_widgetManager.focusSetDefault(_windows); + // display the title of the Windows: + if (m_windowsCurrent != nullptr) { + setTitle(m_windowsCurrent->propertyTitle.get()); + } // request all the widget redrawing forceRedrawAll(); } @@ -463,56 +381,4 @@ void ewol::Context::forceRedrawAll() { m_windowsCurrent->setSize(vec2(size.x(), size.y())); m_windowsCurrent->onChangeSize(); } -/* -void ewol::Context::OS_Stop() { - // set the curent interface : - EWOL_INFO("OS_Stop..."); - if (m_windowsCurrent != nullptr) { - m_windowsCurrent->sysOnKill(); - } - // release the curent interface : -} - -void ewol::Context::OS_Suspend() { - // set the curent interface : - EWOL_INFO("OS_Suspend..."); - m_previousDisplayTime = -1; - if (m_windowsCurrent != nullptr) { - m_windowsCurrent->onStateSuspend(); - } - // release the curent interface : -} - -void ewol::Context::OS_Resume() { - // set the curent interface : - EWOL_INFO("OS_Resume..."); - m_previousDisplayTime = ewol::getTime(); - m_objectManager.timeCallResume(m_previousDisplayTime); - if (m_windowsCurrent != nullptr) { - m_windowsCurrent->onStateResume(); - } - // release the curent interface : -} -void ewol::Context::OS_Foreground() { - // set the curent interface : - EWOL_INFO("OS_Foreground..."); - if (m_windowsCurrent != nullptr) { - m_windowsCurrent->onStateForeground(); - } - // release the curent interface : -} - -void ewol::Context::OS_Background() { - // set the curent interface : - EWOL_INFO("OS_Background..."); - if (m_windowsCurrent != nullptr) { - m_windowsCurrent->onStateBackground(); - } - // release the curent interface : -} -*/ - -void ewol::Context::stop() { - -} diff --git a/ewol/context/Context.h b/ewol/context/Context.h index 02268dd8..0c2f0cf4 100644 --- a/ewol/context/Context.h +++ b/ewol/context/Context.h @@ -64,33 +64,29 @@ namespace ewol { private: ewol::context::InputManager m_input; public: // herited function: - virtual void onCreate(gale::Context& _context); - virtual void onStart(gale::Context& _context); - virtual void onResume(gale::Context& _context); - virtual void onRegenerateDisplay(gale::Context& _context); - virtual void onDraw(gale::Context& _context); - virtual void onPause(gale::Context& _context); - virtual void onStop(gale::Context& _context); - virtual void onDestroy(gale::Context& _context); - virtual void onPointer(enum gale::key::type _type, - int32_t _pointerID, - const vec2& _pos, - gale::key::status _state); - virtual void onKeyboard(const gale::key::Special& _special, - enum gale::key::keyboard _type, - char32_t _value, - gale::key::status _state); - virtual void onClipboardEvent(enum gale::context::clipBoard::clipboardListe _clipboardId); - + void onCreate(gale::Context& _context) override; + void onStart(gale::Context& _context) override; + void onResume(gale::Context& _context) override; + void onRegenerateDisplay(gale::Context& _context) override; + void onDraw(gale::Context& _context) override; + void onPause(gale::Context& _context) override; + void onStop(gale::Context& _context) override; + void onDestroy(gale::Context& _context) override; + void onKillDemand(gale::Context& _context) override; + void onPointer(enum gale::key::type _type, + int32_t _pointerID, + const vec2& _pos, + gale::key::status _state) override; + void onKeyboard(const gale::key::Special& _special, + enum gale::key::keyboard _type, + char32_t _value, + gale::key::status _state) override; + void onClipboardEvent(enum gale::context::clipBoard::clipboardListe _clipboardId) override; public: /** * @brief reset event management for the IO like Input ou Mouse or keyborad */ void resetIOEvent(); - /** - * @brief The application request that the Window will be killed - */ - virtual void stop(); private: ewol::widget::WindowsShared m_windowsCurrent; //!< curent displayed windows public: @@ -126,46 +122,7 @@ namespace ewol { * @brief This fonction un-lock the pointer properties to move in relative instead of absolute */ void inputEventUnGrabPointer(); - // herited function: - virtual void onResize(const ivec2& _size); - #if 0 - /** - * @brief Inform the Gui that we want to have a copy of the clipboard - * @param[in] _clipboardID ID of the clipboard (STD/SELECTION) only apear here - */ - virtual void clipBoardGet(enum ewol::context::clipBoard::clipboardListe _clipboardID); - /** - * @brief Inform the Gui that we are the new owner of the clipboard - * @param[in] _clipboardID ID of the clipboard (STD/SELECTION) only apear here - */ - virtual void clipBoardSet(enum ewol::context::clipBoard::clipboardListe _clipboardID); - /** - * @brief Call by the OS when a clipboard arrive to US (previously requested by a widget) - * @param[in] Id of the clipboard - */ - void OS_ClipBoardArrive(enum ewol::context::clipBoard::clipboardListe _clipboardID); - #endif - - #if 0 - /** - * @brief force the screen orientation (availlable on portable elements ... - * @param[in] _orientation Selected orientation. - */ - virtual void forceOrientation(enum ewol::orientation _orientation) { }; - /** - * @brief get all the event from the X system - * @param[in] _isGrabbed "true" if all the event will be get, false if we want only ours. - * @param[in] _forcedPosition the position where the mouse might be reset at every events ... - */ - virtual void grabPointerEvents(bool _isGrabbed, const vec2& _forcedPosition) { }; - - /** - * @brief get the curent time in micro-second - * @note : must be implemented in all system OS implementation - * @return The curent time of the process - */ - static int64_t getTime(); - #endif + void onResize(const ivec2& _size) override; public: /** * @brief This is the only one things the User might done in his main(); @@ -189,22 +146,12 @@ namespace ewol { * @param[in] _fileName Name of the image to load */ void setInitImage(const std::string& _fileName); - protected: - # if 0 - /** - * @brief HARDWARE keyboard event from the system - * @param[in] _key event type - * @param[in] _status Up or down status - * @return Keep the event or not - */ - virtual bool systemKeyboradEvent(enum gale:key::keyboardSystem _key, bool _down); - #endif public: /** * @brief Request a display after call a resize */ void requestUpdateSize(); - virtual void onPeriod(int64_t _time); + void onPeriod(int64_t _time) override; }; /** * @brief From everyware in the program, we can get the context inteface. diff --git a/ewol/resource/FontFreeType.cpp b/ewol/resource/FontFreeType.cpp index ab47f3ea..79419d3e 100644 --- a/ewol/resource/FontFreeType.cpp +++ b/ewol/resource/FontFreeType.cpp @@ -63,22 +63,22 @@ void ewol::resource::FontFreeType::init(const std::string& _fontName) { std::unique_lock lock(m_mutex); ewol::resource::FontBase::init(_fontName); etk::FSNode myfile(_fontName); - if (false == myfile.exist()) { + if (myfile.exist() == false) { EWOL_ERROR("File Does not exist : " << myfile); return; } m_FileSize = myfile.fileSize(); - if (0 == m_FileSize) { + if (m_FileSize == 0) { EWOL_ERROR("This file is empty : " << myfile); return; } - if (false == myfile.fileOpenRead()) { + if (myfile.fileOpenRead() == false) { EWOL_ERROR("Can not open the file : " << myfile); return; } // allocate data m_FileBuffer = new FT_Byte[m_FileSize]; - if (nullptr == m_FileBuffer) { + if (m_FileBuffer == nullptr) { EWOL_ERROR("Error Memory allocation size=" << _fontName); return; } diff --git a/ewol/resource/TexturedFont.cpp b/ewol/resource/TexturedFont.cpp index 5b836af2..742f9a07 100644 --- a/ewol/resource/TexturedFont.cpp +++ b/ewol/resource/TexturedFont.cpp @@ -99,7 +99,7 @@ void ewol::resource::TexturedFont::init(const std::string& _fontName) { #if defined(__TARGET_OS__Android) folderList.push_back("ROOT:system/fonts"); #elif defined(__TARGET_OS__Linux) - folderList.push_back("ROOT:usr/share/fonts/truetype"); + folderList.push_back("ROOT:usr/share/fonts"); #endif } std::string applicationBaseFont = ewol::getContext().getFontDefault().getFolder(); diff --git a/ewol/tools/message.cpp b/ewol/tools/message.cpp new file mode 100644 index 00000000..797c33d4 --- /dev/null +++ b/ewol/tools/message.cpp @@ -0,0 +1,70 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license APACHE v2.0 (see license file) + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#undef __class__ +#define __class__ "tools::message" + +void ewol::tools::message::create(enum ewol::tools::message::type _type, const std::string& _message) { + ewol::widget::StdPopUpShared tmpPopUp = widget::StdPopUp::create(); + if (tmpPopUp == nullptr) { + EWOL_ERROR("Can not create a simple pop-up"); + return; + } + switch(_type) { + case ewol::tools::message::type_info: + tmpPopUp->propertyTitle.set("_T{Info}"); + break; + case ewol::tools::message::type_warning: + tmpPopUp->propertyTitle.set("_T{Warning}"); + break; + case ewol::tools::message::type_error: + tmpPopUp->propertyTitle.set("_T{Error}"); + break; + case ewol::tools::message::type_critical: + tmpPopUp->propertyTitle.set("_T{Critical}"); + break; + } + tmpPopUp->propertyComment.set(_message); + tmpPopUp->addButton("_T{close}", true); + tmpPopUp->propertyCloseOutEvent.set(true); + // get windows: + ewol::Context& context = ewol::getContext(); + ewol::widget::WindowsShared windows = context.getWindows(); + if (windows == nullptr) { + EWOL_ERROR("can not get the current windows ... ==> can not display message : " << _message); + return; + } + windows->popUpWidgetPush(tmpPopUp); +} + +void ewol::tools::message::displayInfo(const std::string& _message) { + ewol::tools::message::create(ewol::tools::message::type_info, _message); +} + +void ewol::tools::message::displayWarning(const std::string& _message) { + ewol::tools::message::create(ewol::tools::message::type_warning, _message); +} + +void ewol::tools::message::displayError(const std::string& _message) { + ewol::tools::message::create(ewol::tools::message::type_error, _message); +} + +void ewol::tools::message::displayCritical(const std::string& _message) { + ewol::tools::message::create(ewol::tools::message::type_critical, _message); +} + + diff --git a/ewol/tools/message.h b/ewol/tools/message.h new file mode 100644 index 00000000..7842b74a --- /dev/null +++ b/ewol/tools/message.h @@ -0,0 +1,55 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license APACHE v2.0 (see license file) + */ +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace ewol { + namespace tools { + namespace message { + enum type { + type_info, //!< information message pop-up + type_warning, //!< warning message pop-up + type_error, //!< Error message pop-up + type_critical //!< Critical message pop-up + }; + /** + * @brief Create a simple pop-up message on the screen for application error. + * @param[in] _type Type of the error. + * @param[in] _message message to display (decorated text) + */ + void create(enum ewol::tools::message::type _type, const std::string& _message); + /** + * @brief Create a simple information message + * @param[in] _message message to display (decorated text) + */ + void displayInfo(const std::string& _message); + /** + * @brief Create a simple warning message + * @param[in] _message message to display (decorated text) + */ + void displayWarning(const std::string& _message); + /** + * @brief Create a simple error message + * @param[in] _message message to display (decorated text) + */ + void displayError(const std::string& _message); + /** + * @brief Create a simple critical message + * @param[in] _message message to display (decorated text) + */ + void displayCritical(const std::string& _message); + } + } +} + diff --git a/ewol/widget/Windows.cpp b/ewol/widget/Windows.cpp index 7361b749..444e9cc0 100644 --- a/ewol/widget/Windows.cpp +++ b/ewol/widget/Windows.cpp @@ -20,22 +20,22 @@ #undef __class__ #define __class__ "Windows" -//list of local events : -extern const char * const ewolEventWindowsHideKeyboard = "ewol Windows hideKeyboard"; - - ewol::widget::Windows::Windows() : - m_colorProperty(nullptr), + propertyColorConfiguration(this, "file-color", "{ewol}THEME:COLOR:Windows.json", "color file link on the theme", &ewol::widget::Windows::onChangePropertyColor), + propertyTitle(this, "title", "No title", "Title of the windows", &ewol::widget::Windows::onChangePropertyTitle), + m_resourceColor(nullptr), m_colorBg(-1) { addObjectType("ewol::widget::Windows"); - m_colorProperty = ewol::resource::ColorFile::create("{ewol}THEME:COLOR:Windows.json"); - if (m_colorProperty != nullptr) { - m_colorBg = m_colorProperty->request("background"); - } propertyCanFocus.setDirectCheck(true); //KeyboardShow(KEYBOARD_MODE_CODE); } + +void ewol::widget::Windows::init() { + ewol::Widget::init(); + onChangePropertyColor(); +} + ewol::widget::Windows::~Windows() { m_subWidget.reset(); m_popUpWidgetList.clear(); @@ -107,7 +107,7 @@ void ewol::widget::Windows::sysDraw() { } void ewol::widget::Windows::onRegenerateDisplay() { - if (nullptr != m_subWidget) { + if (m_subWidget != nullptr) { m_subWidget->onRegenerateDisplay(); } for (auto &it : m_popUpWidgetList) { @@ -126,8 +126,8 @@ void ewol::widget::Windows::systemDraw(const ewol::DrawProperty& _displayProp) { #endif // clear the screen with transparency ... etk::Color colorBg(0.5, 0.5, 0.5, 0.5); - if (m_colorProperty != nullptr) { - colorBg = m_colorProperty->get(m_colorBg); + if (m_resourceColor != nullptr) { + colorBg = m_resourceColor->get(m_colorBg); } gale::openGL::clearColor(colorBg); gale::openGL::clear( gale::openGL::clearFlag_colorBuffer @@ -199,44 +199,20 @@ void ewol::widget::Windows::popUpWidgetPop() { m_popUpWidgetList.pop_back(); } -void ewol::widget::Windows::setBackgroundColor(const etk::Color& _color) { - if (m_backgroundColor != _color) { - m_backgroundColor = _color; - markToRedraw(); +void ewol::widget::Windows::onChangePropertyColor() { + m_resourceColor = ewol::resource::ColorFile::create(*propertyColorConfiguration); + if (m_resourceColor != nullptr) { + m_colorBg = m_resourceColor->request("background"); } } -void ewol::widget::Windows::setTitle(const std::string& _title) { - // TODO : remove this ... - std::string title = _title; - getContext().setTitle(title); -} - - -void ewol::widget::Windows::createPopUpMessage(enum popUpMessageType _type, const std::string& _message) { - ewol::widget::StdPopUpShared tmpPopUp = widget::StdPopUp::create(); - if (tmpPopUp == nullptr) { - EWOL_ERROR("Can not create a simple pop-up"); - return; +void ewol::widget::Windows::onChangePropertyTitle() { + ewol::Context& context = getContext(); + if (context.getWindows() == shared_from_this()) { + context.setTitle(*propertyTitle); + } else { + EWOL_INFO("Set title is delayed ..."); } - switch(_type) { - case messageTypeInfo: - tmpPopUp->setTitle("Info"); - break; - case messageTypeWarning: - tmpPopUp->setTitle("Warning"); - break; - case messageTypeError: - tmpPopUp->setTitle("Error"); - break; - case messageTypeCritical: - tmpPopUp->setTitle("Critical"); - break; - } - tmpPopUp->setComment(_message); - tmpPopUp->addButton("close", true); - tmpPopUp->propertyCloseOutEvent.set(true); - popUpWidgetPush(tmpPopUp); } void ewol::widget::Windows::requestDestroyFromChild(const ewol::ObjectShared& _child) { @@ -295,9 +271,4 @@ ewol::ObjectShared ewol::widget::Windows::getSubObjectNamed(const std::string& _ return nullptr; } -void ewol::widget::Windows::sysOnKill() { - if (onKill() == true) { - getContext().stop(); - } -} diff --git a/ewol/widget/Windows.h b/ewol/widget/Windows.h index b068a43d..efa447be 100644 --- a/ewol/widget/Windows.h +++ b/ewol/widget/Windows.h @@ -23,112 +23,64 @@ namespace ewol { * @brief Windows basic interface */ class Windows : public ewol::Widget { + public: + eproperty::Value propertyColorConfiguration; //!< Configuration file of the windows theme + eproperty::Value propertyTitle; //!< Current title of the windows protected: - std::shared_ptr m_colorProperty; //!< theme color property + std::shared_ptr m_resourceColor; //!< theme color property (name of file in @ref propertyColorConfiguration) int32_t m_colorBg; //!< Default background color of the windows protected: Windows(); + void init() override; public: virtual ~Windows(); - // internal event at ewol system : + // internal event at ewol system: public: void sysDraw(); - void sysOnShow() {}; - void sysOnHide() {}; - void sysOnKill(); - public: - virtual void onShow() { }; - virtual void onHide() { }; - virtual bool onKill() { - // TODO : Check this in speck for android ... - return false; - }; - virtual void onReduce() { }; - virtual void onStateBackground() {}; - virtual void onStateForeground() {}; - virtual void onStateSuspend() {}; - virtual void onStateResume() {}; - private: - ewol::WidgetShared m_subWidget; - std::list m_popUpWidgetList; + protected: + ewol::WidgetShared m_subWidget; //!< main sub-widget of the Windows. public: + /** + * @brief Set the main widget of the application. + * @param[in] _widget Widget to set in the windows. + */ void setSubWidget(ewol::WidgetShared _widget); + protected: + std::list m_popUpWidgetList; //!< List of pop-up displayed + public: + /** + * @brief Add a pop-up on the Windows. + * @param[in] _widget Widget to set on top of the pop-up. + */ void popUpWidgetPush(ewol::WidgetShared _widget); + /** + * @brief Remove the pop-up on top. + */ void popUpWidgetPop(); + /** + * @brief Get the number of pop-up + * @return Count of pop-up + */ size_t popUpCount() { return m_popUpWidgetList.size(); } - private: - etk::Color m_backgroundColor; //!< reset color of the Main windows - public: - /** - * @brief get the background color. - * @return A reference on the color - */ - const etk::Color& getBackgroundColor() { - return m_backgroundColor; - }; - /** - * @brief set the background color. - * @param[IN] the new requested color. - */ - void setBackgroundColor(const etk::Color& _color); protected: void systemDraw(const ewol::DrawProperty& _displayProp) override; - public: // Derived function + public: void onRegenerateDisplay() override; void onChangeSize() override; ewol::WidgetShared getWidgetAtPos(const vec2& _pos) override; void requestDestroyFromChild(const ewol::ObjectShared& _child) override; ewol::ObjectShared getSubObjectNamed(const std::string& _objectName) override; - void setTitle(const std::string& _title); - public: - enum popUpMessageType { - messageTypeInfo, //!< information message pop-up - messageTypeWarning, //!< warning message pop-up - messageTypeError, //!< Error message pop-up - messageTypeCritical //!< Critical message pop-up - }; + protected: /** - * @brief Create a simple pop-up message on the screen for application error. - * @param[in] _type Type of the error. - * @param[in] _message message to display (decorated text) + * @brief Called when property change: Title */ - virtual void createPopUpMessage(enum popUpMessageType _type, const std::string& _message); + virtual void onChangePropertyTitle(); /** - * @brief Create a simple information message - * @param[in] _message message to display (decorated text) + * @brief Called when property change: Color configuration file */ - void displayInfoMessage(const std::string& _message) { - createPopUpMessage(messageTypeInfo, _message); - } - /** - * @brief Create a simple warning message - * @param[in] _message message to display (decorated text) - */ - void displayWarningMessage(const std::string& _message) { - createPopUpMessage(messageTypeWarning, _message); - } - /** - * @brief Create a simple error message - * @param[in] _message message to display (decorated text) - */ - void displayErrorMessage(const std::string& _message) { - createPopUpMessage(messageTypeError, _message); - } - /** - * @brief Create a simple critical message - * @param[in] _message message to display (decorated text) - */ - void displayCriticalMessage(const std::string& _message) { - createPopUpMessage(messageTypeCritical, _message); - } - - /* TODO : - virtual bool onEventHardwareInput(const gale::key::keyboardSystem& _event, bool _down) { - return false; - }; - */ + virtual void onChangePropertyColor(); }; } } diff --git a/ewol/widget/meta/StdPopUp.cpp b/ewol/widget/meta/StdPopUp.cpp index 1e89ee42..576560fb 100644 --- a/ewol/widget/meta/StdPopUp.cpp +++ b/ewol/widget/meta/StdPopUp.cpp @@ -17,6 +17,14 @@ #define __class__ "ewol::StdPopUp" ewol::widget::StdPopUp::StdPopUp() : + propertyTitle(this, "title", + "Message", + "Title of the pop-up", + &ewol::widget::StdPopUp::onChangePropertyTitle), + propertyComment(this, "comment", + "No Label", + "Comment of the pop-up", + &ewol::widget::StdPopUp::onChangePropertyComment), m_title(nullptr), m_comment(nullptr), m_subBar(nullptr) { @@ -54,7 +62,7 @@ void ewol::widget::StdPopUp::init() { mySizerVert->subWidgetAdd(mySpacer); m_comment = ewol::widget::Label::create(); - m_comment->propertyValue.set("No Label"); + m_comment->propertyValue.set(*propertyComment); m_comment->propertyExpand.set(bvec2(true,true)); mySizerVert->subWidgetAdd(m_comment); @@ -70,7 +78,7 @@ void ewol::widget::StdPopUp::init() { mySizerVert->subWidgetAdd(mySpacer); m_title = ewol::widget::Label::create(); - m_title->propertyValue.set("Message"); + m_title->propertyValue.set(*propertyTitle); m_title->propertyExpand.set(bvec2(true,false)); m_title->propertyFill.set(bvec2(true,true)); mySizerVert->subWidgetAdd(m_title); @@ -80,19 +88,19 @@ ewol::widget::StdPopUp::~StdPopUp() { } -void ewol::widget::StdPopUp::setTitle(const std::string& _text) { +void ewol::widget::StdPopUp::onChangePropertyTitle() { if (m_title == nullptr) { return; } - m_title->propertyValue.set(_text); + m_title->propertyValue.set(*propertyTitle); markToRedraw(); } -void ewol::widget::StdPopUp::setComment(const std::string& _text) { +void ewol::widget::StdPopUp::onChangePropertyComment() { if (m_comment == nullptr) { return; } - m_comment->propertyValue.set(_text); + m_comment->propertyValue.set(*propertyComment); markToRedraw(); } diff --git a/ewol/widget/meta/StdPopUp.h b/ewol/widget/meta/StdPopUp.h index f98e8873..5dccf1d5 100644 --- a/ewol/widget/meta/StdPopUp.h +++ b/ewol/widget/meta/StdPopUp.h @@ -27,7 +27,7 @@ namespace ewol { * | | * | | * | +-------------------+ | - * | | Erreur: | | + * | | Title: | | * | | | | * | | Message to diplay | | * | | to user | | @@ -42,7 +42,8 @@ namespace ewol { */ class StdPopUp : public ewol::widget::PopUp { public: // properties: - // TODO: ... + eproperty::Value propertyTitle; //!< Title of the pop-up + eproperty::Value propertyComment; //!< comment in the pop-up (can be decorated text) protected: /** * @brief std-pop-up constructor. @@ -57,20 +58,15 @@ namespace ewol { virtual ~StdPopUp(); protected: ewol::widget::LabelShared m_title; //!< Title Label widget - public: /** - * @brief Set the title string. - * @param[in] _text Decorated text to diplay in title. + * @brief property callback when request a change of the title. */ - void setTitle(const std::string& _text); - protected: + void onChangePropertyTitle(); ewol::widget::LabelShared m_comment; //!< Comment label widget - public: /** - * @brief Set the commentary string. - * @param[in] _text Decorated text to diplay in Comment. + * @brief property callback when request a change of the Comment. */ - void setComment(const std::string& _text); + void onChangePropertyComment(); protected: ewol::widget::SizerShared m_subBar; //!< subwidget bar containing all the button. public: @@ -79,8 +75,8 @@ namespace ewol { * @param[in] _text Decorated text to diplay in button. */ ewol::widget::ButtonShared addButton(const std::string& _text, bool _autoExit=false); - public: // callback function - void onCallBackButtonExit(); + public: + virtual void onCallBackButtonExit(); }; } } diff --git a/lutinParseSubFolders.txt b/lutinParseSubFolders.txt new file mode 100644 index 00000000..cf0d154a --- /dev/null +++ b/lutinParseSubFolders.txt @@ -0,0 +1,4 @@ +sample/001_HelloWord +sample/0XX_CustomWidgets +sample/examplewallpaper +tools/visual_test \ No newline at end of file diff --git a/lutin_ewol.py b/lutin_ewol.py index 2dafbee4..1af5e3e8 100644 --- a/lutin_ewol.py +++ b/lutin_ewol.py @@ -79,6 +79,7 @@ def create(target, module_name): my_module.add_src_file([ 'ewol/context/ConfigFont.cpp', 'ewol/context/Context.cpp', + 'ewol/context/Application.cpp', 'ewol/context/InputManager.cpp' ]) my_module.add_header_file([ @@ -220,6 +221,14 @@ def create(target, module_name): 'ewol/widget/Spin.h' ]) + # tools: + my_module.add_src_file([ + 'ewol/tools/message.cpp' + ]) + my_module.add_header_file([ + 'ewol/tools/message.h' + ]) + my_module.copy_path('data/theme/shape/square/*','theme/shape/square') my_module.copy_path('data/theme/shape/round/*','theme/shape/round') my_module.copy_path('data/theme/color/black/*','theme/color/black') diff --git a/sample/001_HelloWord/appl/Main.cpp b/sample/001_HelloWord/appl/Main.cpp index cad4b1ae..80c15006 100644 --- a/sample/001_HelloWord/appl/Main.cpp +++ b/sample/001_HelloWord/appl/Main.cpp @@ -20,9 +20,16 @@ class MainApplication : public ewol::context::Application { public: - bool init(ewol::Context& _context, size_t _initId) { - APPL_INFO("==> Init APPL (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ")"); - + void onCreate(ewol::Context& _context) override { + APPL_INFO(" == > CREATE ... " << PROJECT_NAME << " v" << APPL_VERSION << " (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ") (BEGIN)"); + for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) { + std::string tmpppp = _context.getCmd().get(iii); + if ( tmpppp == "-h" + || tmpppp == "--help") { + APPL_INFO(" -h/--help display this help" ); + exit(0); + } + } // TODO : Remove this : Move if in the windows properties _context.setSize(vec2(800, 600)); @@ -30,17 +37,21 @@ class MainApplication : public ewol::context::Application { _context.getFontDefault().setUseExternal(true); _context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19); - std::shared_ptr basicWindows = appl::Windows::create(); + ewol::widget::WindowsShared basicWindows = appl::Windows::create(); // create the specific windows _context.setWindows(basicWindows); - APPL_INFO("==> Init APPL (END)"); - return true; + APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)"); } - void unInit(ewol::Context& _context) { - APPL_INFO("==> Un-Init APPL (START)"); + void onStart(ewol::Context& _context) override { + APPL_INFO("==> START ... " PROJECT_NAME " (BEGIN)"); // nothing to do ... - APPL_INFO("==> Un-Init APPL (END)"); + APPL_INFO("==> START ... " PROJECT_NAME " (END)"); + } + void onStop(ewol::Context& _context) override { + APPL_INFO("==> STOP ... " PROJECT_NAME " (START)"); + // nothing to do ... + APPL_INFO("==> STOP ... " PROJECT_NAME " (END)"); } }; diff --git a/sample/001_HelloWord/appl/Windows.cpp b/sample/001_HelloWord/appl/Windows.cpp index 5c9c8ea2..2ad6f945 100644 --- a/sample/001_HelloWord/appl/Windows.cpp +++ b/sample/001_HelloWord/appl/Windows.cpp @@ -16,16 +16,16 @@ appl::Windows::Windows() { addObjectType("appl::Windows"); + propertyTitle.setDirectCheck(std::string("sample ") + PROJECT_NAME); } void appl::Windows::init() { ewol::widget::Windows::init(); - setTitle("example 001_HelloWorld"); - std::shared_ptr tmpWidget = ewol::widget::Label::create(); + ewol::widget::LabelShared tmpWidget = ewol::widget::Label::create(); if (tmpWidget == nullptr) { APPL_ERROR("Can not allocate widget ==> display might be in error"); } else { - tmpWidget->setLabel("Hello World"); - tmpWidget->setExpand(bvec2(true,true)); + tmpWidget->propertyValue.set("Hello World"); + tmpWidget->propertyExpand.set(bvec2(true,true)); setSubWidget(tmpWidget); } } diff --git a/sample/001_HelloWord/appl/Windows.h b/sample/001_HelloWord/appl/Windows.h index ecb5cebe..66241cc5 100644 --- a/sample/001_HelloWord/appl/Windows.h +++ b/sample/001_HelloWord/appl/Windows.h @@ -10,6 +10,9 @@ #include namespace appl { + class Windows; + using WindowsShared = ememory::SharedPtr; + using WindowsWeak = ememory::WeakPtr; class Windows : public ewol::widget::Windows { protected: Windows(); diff --git a/sample/001_HelloWord/lutin_001_HelloWord.py b/sample/001_HelloWord/lutin_001_HelloWord.py index a6235d72..1405c248 100644 --- a/sample/001_HelloWord/lutin_001_HelloWord.py +++ b/sample/001_HelloWord/lutin_001_HelloWord.py @@ -35,7 +35,9 @@ def create(target, module_name): ]) my_module.add_module_depend(['ewol']) my_module.compile_flags('c++', [ - "-DPROJECT_NAME=\"\\\""+my_module.name+"\\\"\""]) + "-DPROJECT_NAME=\"\\\""+my_module.name+"\\\"\"", + "-DAPPL_VERSION=\"\\\"" + tools.version_to_string(get_version()) + "\\\"\"" + ]) my_module.add_path(tools.get_current_path(__file__)) return my_module diff --git a/sample/0XX_CustomWidgets/appl/Main.cpp b/sample/0XX_CustomWidgets/appl/Main.cpp index c0431920..5870eb4b 100644 --- a/sample/0XX_CustomWidgets/appl/Main.cpp +++ b/sample/0XX_CustomWidgets/appl/Main.cpp @@ -21,9 +21,16 @@ class MainApplication : public ewol::context::Application { public: - bool init(ewol::Context& _context, size_t _initId) { - APPL_INFO("==> Init APPL (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ")"); - + void onCreate(ewol::Context& _context) override { + APPL_INFO(" == > CREATE ... " << PROJECT_NAME << " v" << APPL_VERSION << " (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ") (BEGIN)"); + for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) { + std::string tmpppp = _context.getCmd().get(iii); + if ( tmpppp == "-h" + || tmpppp == "--help") { + APPL_INFO(" -h/--help display this help" ); + exit(0); + } + } // TODO : Remove this : Move if in the windows properties _context.setSize(vec2(800, 600)); @@ -33,16 +40,21 @@ class MainApplication : public ewol::context::Application { appl::widget::VectorDisplay::createManagerWidget(_context.getWidgetManager()); - std::shared_ptr basicWindows = appl::Windows::create(); + ewol::widget::WindowsShared basicWindows = appl::Windows::create(); // create the specific windows _context.setWindows(basicWindows); - APPL_INFO("==> Init APPL (END)"); - return true; + APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)"); } - void unInit(ewol::Context& _context) { - APPL_INFO("==> Un-Init APPL (START)"); - // nothing to do... - APPL_INFO("==> Un-Init APPL (END)"); + + void onStart(ewol::Context& _context) override { + APPL_INFO("==> START ... " PROJECT_NAME " (BEGIN)"); + // nothing to do ... + APPL_INFO("==> START ... " PROJECT_NAME " (END)"); + } + void onStop(ewol::Context& _context) override { + APPL_INFO("==> STOP ... " PROJECT_NAME " (START)"); + // nothing to do ... + APPL_INFO("==> STOP ... " PROJECT_NAME " (END)"); } }; diff --git a/sample/0XX_CustomWidgets/appl/Windows.cpp b/sample/0XX_CustomWidgets/appl/Windows.cpp index f17d1c44..c91a25dc 100644 --- a/sample/0XX_CustomWidgets/appl/Windows.cpp +++ b/sample/0XX_CustomWidgets/appl/Windows.cpp @@ -21,12 +21,13 @@ static const char* const g_eventChangeValues = "appl-change-value"; static const char* const g_eventAutoMode = "appl-change-auto"; appl::Windows::Windows() : - m_composer(NULL) { + m_composer(nullptr) { addObjectType("appl::Windows"); + propertyTitle.setDirectCheck(std::string("sample ") + PROJECT_NAME); } void appl::Windows::init() { - setTitle("example 001_HelloWord"); + ewol::widget::Windows::init(); std::string composition = std::string(""); composition += "\n"; composition += " \n"; @@ -44,11 +45,12 @@ void appl::Windows::init() { composition += " \n"; composition += "\n"; - m_composer = ewol::widget::Composer::create(ewol::widget::Composer::String, composition); - if (m_composer == NULL) { + m_composer = ewol::widget::Composer::create(); + if (m_composer == nullptr) { APPL_CRITICAL(" An error occured ... in the windows creatrion ..."); return; } + m_composer->loadFromString(composition); setSubWidget(m_composer); subBind(ewol::widget::Button, "bt-change", signalPressed, shared_from_this(), &appl::Windows::onCallbackChangeValues); subBind(ewol::widget::Button, "bt-auto", signalPressed, shared_from_this(), &appl::Windows::onCallbackAutoMode); @@ -60,14 +62,14 @@ void appl::Windows::onCallbackChangeValues() { tmp.push_back(etk::tool::frand(-1.0, 1.0)); } std::shared_ptr tmpDisp = std::dynamic_pointer_cast(getSubObjectNamed("displayer")); - if (tmpDisp != NULL) { + if (tmpDisp != nullptr) { tmpDisp->setValue(tmp); } } void appl::Windows::onCallbackAutoMode() { std::shared_ptr tmpDisp = std::dynamic_pointer_cast(getSubObjectNamed("displayer")); - if (tmpDisp != NULL) { + if (tmpDisp != nullptr) { tmpDisp->ToggleAuto(); } } diff --git a/sample/0XX_CustomWidgets/appl/Windows.h b/sample/0XX_CustomWidgets/appl/Windows.h index c4806ee2..daf6b551 100644 --- a/sample/0XX_CustomWidgets/appl/Windows.h +++ b/sample/0XX_CustomWidgets/appl/Windows.h @@ -11,9 +11,12 @@ #include namespace appl { + class Windows; + using WindowsShared = ememory::SharedPtr; + using WindowsWeak = ememory::WeakPtr; class Windows : public ewol::widget::Windows { private: - std::shared_ptr m_composer; + ewol::widget::ComposerShared m_composer; protected: Windows(); void init(); diff --git a/sample/0XX_CustomWidgets/lutin_0XX_customwidget.py b/sample/0XX_CustomWidgets/lutin_0XX_customwidget.py index 994e0b61..026e6f13 100644 --- a/sample/0XX_CustomWidgets/lutin_0XX_customwidget.py +++ b/sample/0XX_CustomWidgets/lutin_0XX_customwidget.py @@ -36,7 +36,9 @@ def create(target, module_name): ]) my_module.add_module_depend(['ewol']) my_module.compile_flags('c++', [ - "-DPROJECT_NAME=\"\\\""+my_module.name+"\\\"\""]) + "-DPROJECT_NAME=\"\\\""+my_module.name+"\\\"\"", + "-DAPPL_VERSION=\"\\\"" + tools.version_to_string(get_version()) + "\\\"\"" + ]) my_module.add_path(tools.get_current_path(__file__)) return my_module diff --git a/sample/examplewallpaper/appl/Main.cpp b/sample/examplewallpaper/appl/Main.cpp index 7a339065..3e335b70 100644 --- a/sample/examplewallpaper/appl/Main.cpp +++ b/sample/examplewallpaper/appl/Main.cpp @@ -20,9 +20,16 @@ class MainApplication : public ewol::context::Application { public: - bool init(ewol::Context& _context, size_t _initId) { - APPL_INFO("==> Init APPL (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ")"); - + void onCreate(ewol::Context& _context) override { + APPL_INFO(" == > CREATE ... " << PROJECT_NAME << " v" << APPL_VERSION << " (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ") (BEGIN)"); + for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) { + std::string tmpppp = _context.getCmd().get(iii); + if ( tmpppp == "-h" + || tmpppp == "--help") { + APPL_INFO(" -h/--help display this help" ); + exit(0); + } + } // TODO : Remove this : Move if in the windows properties _context.setSize(vec2(800, 600)); @@ -30,17 +37,21 @@ class MainApplication : public ewol::context::Application { _context.getFontDefault().setUseExternal(true); _context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19); - std::shared_ptr basicWindows = appl::Windows::create(); + ewol::widget::WindowsShared basicWindows = appl::Windows::create(); // create the specific windows _context.setWindows(basicWindows); - APPL_INFO("==> Init APPL (END)"); - return true; + APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)"); } - void unInit(ewol::Context& _context) { - APPL_INFO(" == > Un-Init " PROJECT_NAME " (START)"); + void onStart(ewol::Context& _context) override { + APPL_INFO("==> START ... " PROJECT_NAME " (BEGIN)"); // nothing to do ... - APPL_INFO(" == > Un-Init " PROJECT_NAME " (END)"); + APPL_INFO("==> START ... " PROJECT_NAME " (END)"); + } + void onStop(ewol::Context& _context) override { + APPL_INFO("==> STOP ... " PROJECT_NAME " (START)"); + // nothing to do ... + APPL_INFO("==> STOP ... " PROJECT_NAME " (END)"); } }; diff --git a/sample/examplewallpaper/appl/WidgetDisplay.cpp b/sample/examplewallpaper/appl/WidgetDisplay.cpp index df508a02..b930b9fa 100644 --- a/sample/examplewallpaper/appl/WidgetDisplay.cpp +++ b/sample/examplewallpaper/appl/WidgetDisplay.cpp @@ -18,12 +18,12 @@ appl::WidgetDisplay::WidgetDisplay() { addObjectType("appl::WidgetDisplay"); + propertyCanFocus.setDirectCheck(true); } void appl::WidgetDisplay::init() { ewol::Widget::init(); m_compositing.setSource("DATA:SnowFlake.svg", ivec2(128,128)); - setCanHaveFocus(true); periodicCallEnable(); for (int32_t iii=0; iii<250 ; ++iii) { m_elements.push_back(appl::WidgetDisplay::Element()); diff --git a/sample/examplewallpaper/appl/WidgetDisplay.h b/sample/examplewallpaper/appl/WidgetDisplay.h index 567ae7c1..ed1f6b30 100644 --- a/sample/examplewallpaper/appl/WidgetDisplay.h +++ b/sample/examplewallpaper/appl/WidgetDisplay.h @@ -7,11 +7,14 @@ */ #pragma once -#include +#include #include #include namespace appl { + class WidgetDisplay; + using WidgetDisplayShared = ememory::SharedPtr; + using WidgetDisplayWeak = ememory::WeakPtr; class WidgetDisplay : public ewol::Widget { private: class Element { diff --git a/sample/examplewallpaper/appl/Windows.cpp b/sample/examplewallpaper/appl/Windows.cpp index 55a381fd..b01179be 100644 --- a/sample/examplewallpaper/appl/Windows.cpp +++ b/sample/examplewallpaper/appl/Windows.cpp @@ -17,20 +17,19 @@ appl::Windows::Windows() { addObjectType("appl::Windows"); + propertyTitle.setDirectCheck(std::string("sample ") + PROJECT_NAME); } void appl::Windows::init() { ewol::widget::Windows::init(); - setTitle("example Wallpaper"); - std::shared_ptr tmpWidget = appl::WidgetDisplay::create(); + appl::WidgetDisplayShared tmpWidget = appl::WidgetDisplay::create(); if (tmpWidget == nullptr) { APPL_ERROR("Can not allocate widget ==> display might be in error"); } else { setSubWidget(tmpWidget); - tmpWidget->setExpand(bvec2(true,true)); - tmpWidget->setFill(bvec2(true,true)); + tmpWidget->propertyExpand.set(bvec2(true,true)); + tmpWidget->propertyFill.set(bvec2(true,true)); } - setBackgroundColor(etk::Color(0,0,0,0)); } appl::Windows::~Windows() { diff --git a/sample/examplewallpaper/appl/Windows.h b/sample/examplewallpaper/appl/Windows.h index ad78f5ba..804f4a79 100644 --- a/sample/examplewallpaper/appl/Windows.h +++ b/sample/examplewallpaper/appl/Windows.h @@ -11,6 +11,9 @@ #include namespace appl { + class Windows; + using WindowsShared = ememory::SharedPtr; + using WindowsWeak = ememory::WeakPtr; class Windows : public ewol::widget::Windows { protected: Windows(); diff --git a/sample/examplewallpaper/lutin_examplewallpaper.py b/sample/examplewallpaper/lutin_examplewallpaper.py index 4ef6926a..637118f0 100644 --- a/sample/examplewallpaper/lutin_examplewallpaper.py +++ b/sample/examplewallpaper/lutin_examplewallpaper.py @@ -28,6 +28,9 @@ def get_compagny_name(): def get_maintainer(): return ["Mr DUPIN Edouard "] +def get_version(): + return [0,1] + def create(target, module_name): my_module = module.Module(__file__, module_name, get_type()) my_module.add_src_file([ @@ -38,14 +41,12 @@ def create(target, module_name): ]) my_module.add_module_depend(['ewol']) my_module.compile_flags('c++', [ - "-DPROJECT_NAME=\"\\\""+my_module.name+"\\\"\"" + "-DPROJECT_NAME=\"\\\""+my_module.name+"\\\"\"", + "-DAPPL_VERSION=\"\\\"" + tools.version_to_string(get_version()) + "\\\"\"" ]) my_module.copy_path('data/SnowFlake.svg','') my_module.add_path(tools.get_current_path(__file__)) - now = datetime.datetime.now() - versionID=str(now.year-2013)+"."+str(now.month)+"."+str(now.day) # set the package properties : - my_module.pkg_set("VERSION", versionID) my_module.pkg_set("COMPAGNY_TYPE", get_compagny_type()) my_module.pkg_set("COMPAGNY_NAME", get_compagny_name()) my_module.pkg_set("MAINTAINER", get_maintainer()) diff --git a/test/testWindows.cpp b/test/testWindows.cpp index 7bf62fa5..0069cb12 100644 --- a/test/testWindows.cpp +++ b/test/testWindows.cpp @@ -19,10 +19,10 @@ namespace appl { protected: Windows() { addObjectType("appl::Windows"); + propertyTitle.setDirectCheck("test set"); } void init() { ewol::widget::Windows::init(); - setTitle("test set"); } public: DECLARE_FACTORY(Windows); diff --git a/tools/visual_test/appl/init.cpp b/tools/visual_test/appl/init.cpp index 12325f2f..a08eadc5 100644 --- a/tools/visual_test/appl/init.cpp +++ b/tools/visual_test/appl/init.cpp @@ -66,7 +66,7 @@ class MainApplication : public ewol::context::Application { _context.setWindows(basicWindows); if (basicWindows == nullptr) { APPL_ERROR("Can not allocate the basic windows"); - _context.stop(); + _context.exit(-1); return; } diff --git a/lutin_ewol-tools-visual-test.py b/tools/visual_test/lutin_ewol-tools-visual-test.py similarity index 57% rename from lutin_ewol-tools-visual-test.py rename to tools/visual_test/lutin_ewol-tools-visual-test.py index ebaf1c32..bea8d16d 100755 --- a/lutin_ewol-tools-visual-test.py +++ b/tools/visual_test/lutin_ewol-tools-visual-test.py @@ -10,7 +10,7 @@ def get_sub_type(): return "TOOL" def get_desc(): - return "ewol test software (visual)" + return "ewol tools software (visual)" def get_licence(): return "APACHE-2" @@ -28,28 +28,28 @@ def create(target, module_name): my_module = module.Module(__file__, module_name, get_type()) # add the file to compile: my_module.add_src_file([ - 'tools/visual_test/appl/debug.cpp', - 'tools/visual_test/appl/init.cpp', - 'tools/visual_test/appl/MainWindows.cpp', - 'tools/visual_test/appl/TestDistanceField.cpp', - 'tools/visual_test/appl/widget/SizerColor.cpp' + 'appl/debug.cpp', + 'appl/init.cpp', + 'appl/MainWindows.cpp', + 'appl/TestDistanceField.cpp', + 'appl/widget/SizerColor.cpp' ]) my_module.add_module_depend(['ewol']) - my_module.copy_file('tools/visual_test/data/icon.png','icon.png') + my_module.copy_file('data/icon.png','icon.png') - my_module.copy_path('tools/visual_test/data/icon.*','') - my_module.copy_path('tools/visual_test/data/cube.*','') - my_module.copy_path('tools/visual_test/data/grass.*','') - my_module.copy_path('tools/visual_test/data/stone*','') - my_module.copy_path('tools/visual_test/data/sphere.png','') - my_module.copy_path('tools/visual_test/data/sphere.obj','') - my_module.copy_path('tools/visual_test/data/gui.xml','') + my_module.copy_path('data/icon.*','') + my_module.copy_path('data/cube.*','') + my_module.copy_path('data/grass.*','') + my_module.copy_path('data/stone*','') + my_module.copy_path('data/sphere.png','') + my_module.copy_path('data/sphere.obj','') + my_module.copy_path('data/gui.xml','') - my_module.add_path(os.path.join(tools.get_current_path(__file__), "tools/visual_test/")) + my_module.add_path(tools.get_current_path(__file__)) - my_module.copy_path("tools/visual_test/data/FreeSerif*","fonts/") + my_module.copy_path("data/FreeSerif*","fonts/") """ # set the package properties :