[DEV] review interface (step 1)
This commit is contained in:
parent
2e4e1545ad
commit
6f68563d50
49
ewol/context/Application.cpp
Normal file
49
ewol/context/Application.cpp
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license APACHE v2.0 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <etk/types.h>
|
||||||
|
#include <ewol/context/Application.h>
|
||||||
|
#include <ewol/context/Context.h>
|
||||||
|
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
@ -13,39 +13,44 @@ namespace ewol {
|
|||||||
namespace context {
|
namespace context {
|
||||||
class Application {
|
class Application {
|
||||||
public:
|
public:
|
||||||
Application() {};
|
Application();
|
||||||
virtual ~Application() {};
|
virtual ~Application();
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief The application is created.
|
* @brief The application is created.
|
||||||
* @param[in] _context Current ewol context.
|
* @param[in] _context Current ewol context.
|
||||||
*/
|
*/
|
||||||
virtual void onCreate(ewol::Context& _context) {};
|
virtual void onCreate(ewol::Context& _context);
|
||||||
/**
|
/**
|
||||||
* @brief The application is started.
|
* @brief The application is started.
|
||||||
* @param[in] _context Current ewol context.
|
* @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).
|
* @brief The application is resumed (now visible).
|
||||||
* @param[in] _context Current ewol context.
|
* @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.
|
* @brief The application is Hide / not visible.
|
||||||
* @param[in] _context Current ewol context.
|
* @param[in] _context Current ewol context.
|
||||||
*/
|
*/
|
||||||
virtual void onPause(ewol::Context& _context) {};
|
virtual void onPause(ewol::Context& _context);
|
||||||
/**
|
/**
|
||||||
* @brief The application is stopped.
|
* @brief The application is stopped.
|
||||||
* @param[in] _context Current ewol context.
|
* @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.
|
* @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);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -201,7 +201,18 @@ void ewol::Context::onDestroy(gale::Context& _context) {
|
|||||||
m_objectManager.displayListObject();
|
m_objectManager.displayListObject();
|
||||||
// now All must be removed !!!
|
// now All must be removed !!!
|
||||||
m_objectManager.unInit();
|
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<ewol::context::Application> 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,
|
void ewol::Context::onPointer(enum gale::key::type _type,
|
||||||
@ -333,107 +344,10 @@ void ewol::Context::onPeriod(int64_t _time) {
|
|||||||
m_objectManager.timeCall(_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() {
|
void ewol::Context::resetIOEvent() {
|
||||||
m_input.newLayerSet();
|
m_input.newLayerSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::Context::setWindows(const ewol::widget::WindowsShared& _windows) {
|
void ewol::Context::setWindows(const ewol::widget::WindowsShared& _windows) {
|
||||||
EWOL_INFO("set New windows");
|
EWOL_INFO("set New windows");
|
||||||
// remove current focus :
|
// remove current focus :
|
||||||
@ -441,8 +355,12 @@ void ewol::Context::setWindows(const ewol::widget::WindowsShared& _windows) {
|
|||||||
m_widgetManager.focusRelease();
|
m_widgetManager.focusRelease();
|
||||||
// set the new pointer as windows system
|
// set the new pointer as windows system
|
||||||
m_windowsCurrent = _windows;
|
m_windowsCurrent = _windows;
|
||||||
// set the new default focus :
|
// set the new default focus:
|
||||||
m_widgetManager.focusSetDefault(_windows);
|
m_widgetManager.focusSetDefault(_windows);
|
||||||
|
// display the title of the Windows:
|
||||||
|
if (m_windowsCurrent != nullptr) {
|
||||||
|
setTitle(m_windowsCurrent->propertyTitle.get());
|
||||||
|
}
|
||||||
// request all the widget redrawing
|
// request all the widget redrawing
|
||||||
forceRedrawAll();
|
forceRedrawAll();
|
||||||
}
|
}
|
||||||
@ -463,56 +381,4 @@ void ewol::Context::forceRedrawAll() {
|
|||||||
m_windowsCurrent->setSize(vec2(size.x(), size.y()));
|
m_windowsCurrent->setSize(vec2(size.x(), size.y()));
|
||||||
m_windowsCurrent->onChangeSize();
|
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() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -64,33 +64,29 @@ namespace ewol {
|
|||||||
private:
|
private:
|
||||||
ewol::context::InputManager m_input;
|
ewol::context::InputManager m_input;
|
||||||
public: // herited function:
|
public: // herited function:
|
||||||
virtual void onCreate(gale::Context& _context);
|
void onCreate(gale::Context& _context) override;
|
||||||
virtual void onStart(gale::Context& _context);
|
void onStart(gale::Context& _context) override;
|
||||||
virtual void onResume(gale::Context& _context);
|
void onResume(gale::Context& _context) override;
|
||||||
virtual void onRegenerateDisplay(gale::Context& _context);
|
void onRegenerateDisplay(gale::Context& _context) override;
|
||||||
virtual void onDraw(gale::Context& _context);
|
void onDraw(gale::Context& _context) override;
|
||||||
virtual void onPause(gale::Context& _context);
|
void onPause(gale::Context& _context) override;
|
||||||
virtual void onStop(gale::Context& _context);
|
void onStop(gale::Context& _context) override;
|
||||||
virtual void onDestroy(gale::Context& _context);
|
void onDestroy(gale::Context& _context) override;
|
||||||
virtual void onPointer(enum gale::key::type _type,
|
void onKillDemand(gale::Context& _context) override;
|
||||||
int32_t _pointerID,
|
void onPointer(enum gale::key::type _type,
|
||||||
const vec2& _pos,
|
int32_t _pointerID,
|
||||||
gale::key::status _state);
|
const vec2& _pos,
|
||||||
virtual void onKeyboard(const gale::key::Special& _special,
|
gale::key::status _state) override;
|
||||||
enum gale::key::keyboard _type,
|
void onKeyboard(const gale::key::Special& _special,
|
||||||
char32_t _value,
|
enum gale::key::keyboard _type,
|
||||||
gale::key::status _state);
|
char32_t _value,
|
||||||
virtual void onClipboardEvent(enum gale::context::clipBoard::clipboardListe _clipboardId);
|
gale::key::status _state) override;
|
||||||
|
void onClipboardEvent(enum gale::context::clipBoard::clipboardListe _clipboardId) override;
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief reset event management for the IO like Input ou Mouse or keyborad
|
* @brief reset event management for the IO like Input ou Mouse or keyborad
|
||||||
*/
|
*/
|
||||||
void resetIOEvent();
|
void resetIOEvent();
|
||||||
/**
|
|
||||||
* @brief The application request that the Window will be killed
|
|
||||||
*/
|
|
||||||
virtual void stop();
|
|
||||||
private:
|
private:
|
||||||
ewol::widget::WindowsShared m_windowsCurrent; //!< curent displayed windows
|
ewol::widget::WindowsShared m_windowsCurrent; //!< curent displayed windows
|
||||||
public:
|
public:
|
||||||
@ -126,46 +122,7 @@ namespace ewol {
|
|||||||
* @brief This fonction un-lock the pointer properties to move in relative instead of absolute
|
* @brief This fonction un-lock the pointer properties to move in relative instead of absolute
|
||||||
*/
|
*/
|
||||||
void inputEventUnGrabPointer();
|
void inputEventUnGrabPointer();
|
||||||
// herited function:
|
void onResize(const ivec2& _size) override;
|
||||||
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
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief This is the only one things the User might done in his main();
|
* @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
|
* @param[in] _fileName Name of the image to load
|
||||||
*/
|
*/
|
||||||
void setInitImage(const std::string& _fileName);
|
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:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Request a display after call a resize
|
* @brief Request a display after call a resize
|
||||||
*/
|
*/
|
||||||
void requestUpdateSize();
|
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.
|
* @brief From everyware in the program, we can get the context inteface.
|
||||||
|
@ -63,22 +63,22 @@ void ewol::resource::FontFreeType::init(const std::string& _fontName) {
|
|||||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||||
ewol::resource::FontBase::init(_fontName);
|
ewol::resource::FontBase::init(_fontName);
|
||||||
etk::FSNode myfile(_fontName);
|
etk::FSNode myfile(_fontName);
|
||||||
if (false == myfile.exist()) {
|
if (myfile.exist() == false) {
|
||||||
EWOL_ERROR("File Does not exist : " << myfile);
|
EWOL_ERROR("File Does not exist : " << myfile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_FileSize = myfile.fileSize();
|
m_FileSize = myfile.fileSize();
|
||||||
if (0 == m_FileSize) {
|
if (m_FileSize == 0) {
|
||||||
EWOL_ERROR("This file is empty : " << myfile);
|
EWOL_ERROR("This file is empty : " << myfile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (false == myfile.fileOpenRead()) {
|
if (myfile.fileOpenRead() == false) {
|
||||||
EWOL_ERROR("Can not open the file : " << myfile);
|
EWOL_ERROR("Can not open the file : " << myfile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// allocate data
|
// allocate data
|
||||||
m_FileBuffer = new FT_Byte[m_FileSize];
|
m_FileBuffer = new FT_Byte[m_FileSize];
|
||||||
if (nullptr == m_FileBuffer) {
|
if (m_FileBuffer == nullptr) {
|
||||||
EWOL_ERROR("Error Memory allocation size=" << _fontName);
|
EWOL_ERROR("Error Memory allocation size=" << _fontName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ void ewol::resource::TexturedFont::init(const std::string& _fontName) {
|
|||||||
#if defined(__TARGET_OS__Android)
|
#if defined(__TARGET_OS__Android)
|
||||||
folderList.push_back("ROOT:system/fonts");
|
folderList.push_back("ROOT:system/fonts");
|
||||||
#elif defined(__TARGET_OS__Linux)
|
#elif defined(__TARGET_OS__Linux)
|
||||||
folderList.push_back("ROOT:usr/share/fonts/truetype");
|
folderList.push_back("ROOT:usr/share/fonts");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
std::string applicationBaseFont = ewol::getContext().getFontDefault().getFolder();
|
std::string applicationBaseFont = ewol::getContext().getFontDefault().getFolder();
|
||||||
|
70
ewol/tools/message.cpp
Normal file
70
ewol/tools/message.cpp
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license APACHE v2.0 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <etk/types.h>
|
||||||
|
#include <ewol/ewol.h>
|
||||||
|
#include <ewol/tools/message.h>
|
||||||
|
#include <ewol/context/Context.h>
|
||||||
|
#include <ewol/widget/Widget.h>
|
||||||
|
#include <ewol/widget/Windows.h>
|
||||||
|
#include <ewol/widget/Manager.h>
|
||||||
|
#include <ewol/widget/meta/StdPopUp.h>
|
||||||
|
|
||||||
|
#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("<bold>_T{Info}</bold>");
|
||||||
|
break;
|
||||||
|
case ewol::tools::message::type_warning:
|
||||||
|
tmpPopUp->propertyTitle.set("<bold><font color='orange'>_T{Warning}</font></bold>");
|
||||||
|
break;
|
||||||
|
case ewol::tools::message::type_error:
|
||||||
|
tmpPopUp->propertyTitle.set("<bold><font color='red'>_T{Error}</font></bold>");
|
||||||
|
break;
|
||||||
|
case ewol::tools::message::type_critical:
|
||||||
|
tmpPopUp->propertyTitle.set("<bold><font colorBg='red'>_T{Critical}</font></bold>");
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
55
ewol/tools/message.h
Normal file
55
ewol/tools/message.h
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license APACHE v2.0 (see license file)
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <etk/types.h>
|
||||||
|
#include <ewol/debug.h>
|
||||||
|
#include <ewol/widget/Widget.h>
|
||||||
|
#include <etk/Color.h>
|
||||||
|
#include <ewol/resource/ColorFile.h>
|
||||||
|
#include <list>
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -20,22 +20,22 @@
|
|||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "Windows"
|
#define __class__ "Windows"
|
||||||
|
|
||||||
//list of local events :
|
|
||||||
extern const char * const ewolEventWindowsHideKeyboard = "ewol Windows hideKeyboard";
|
|
||||||
|
|
||||||
|
|
||||||
ewol::widget::Windows::Windows() :
|
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) {
|
m_colorBg(-1) {
|
||||||
addObjectType("ewol::widget::Windows");
|
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);
|
propertyCanFocus.setDirectCheck(true);
|
||||||
//KeyboardShow(KEYBOARD_MODE_CODE);
|
//KeyboardShow(KEYBOARD_MODE_CODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ewol::widget::Windows::init() {
|
||||||
|
ewol::Widget::init();
|
||||||
|
onChangePropertyColor();
|
||||||
|
}
|
||||||
|
|
||||||
ewol::widget::Windows::~Windows() {
|
ewol::widget::Windows::~Windows() {
|
||||||
m_subWidget.reset();
|
m_subWidget.reset();
|
||||||
m_popUpWidgetList.clear();
|
m_popUpWidgetList.clear();
|
||||||
@ -107,7 +107,7 @@ void ewol::widget::Windows::sysDraw() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ewol::widget::Windows::onRegenerateDisplay() {
|
void ewol::widget::Windows::onRegenerateDisplay() {
|
||||||
if (nullptr != m_subWidget) {
|
if (m_subWidget != nullptr) {
|
||||||
m_subWidget->onRegenerateDisplay();
|
m_subWidget->onRegenerateDisplay();
|
||||||
}
|
}
|
||||||
for (auto &it : m_popUpWidgetList) {
|
for (auto &it : m_popUpWidgetList) {
|
||||||
@ -126,8 +126,8 @@ void ewol::widget::Windows::systemDraw(const ewol::DrawProperty& _displayProp) {
|
|||||||
#endif
|
#endif
|
||||||
// clear the screen with transparency ...
|
// clear the screen with transparency ...
|
||||||
etk::Color<float> colorBg(0.5, 0.5, 0.5, 0.5);
|
etk::Color<float> colorBg(0.5, 0.5, 0.5, 0.5);
|
||||||
if (m_colorProperty != nullptr) {
|
if (m_resourceColor != nullptr) {
|
||||||
colorBg = m_colorProperty->get(m_colorBg);
|
colorBg = m_resourceColor->get(m_colorBg);
|
||||||
}
|
}
|
||||||
gale::openGL::clearColor(colorBg);
|
gale::openGL::clearColor(colorBg);
|
||||||
gale::openGL::clear( gale::openGL::clearFlag_colorBuffer
|
gale::openGL::clear( gale::openGL::clearFlag_colorBuffer
|
||||||
@ -199,44 +199,20 @@ void ewol::widget::Windows::popUpWidgetPop() {
|
|||||||
m_popUpWidgetList.pop_back();
|
m_popUpWidgetList.pop_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::widget::Windows::setBackgroundColor(const etk::Color<float>& _color) {
|
void ewol::widget::Windows::onChangePropertyColor() {
|
||||||
if (m_backgroundColor != _color) {
|
m_resourceColor = ewol::resource::ColorFile::create(*propertyColorConfiguration);
|
||||||
m_backgroundColor = _color;
|
if (m_resourceColor != nullptr) {
|
||||||
markToRedraw();
|
m_colorBg = m_resourceColor->request("background");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::widget::Windows::setTitle(const std::string& _title) {
|
void ewol::widget::Windows::onChangePropertyTitle() {
|
||||||
// TODO : remove this ...
|
ewol::Context& context = getContext();
|
||||||
std::string title = _title;
|
if (context.getWindows() == shared_from_this()) {
|
||||||
getContext().setTitle(title);
|
context.setTitle(*propertyTitle);
|
||||||
}
|
} else {
|
||||||
|
EWOL_INFO("Set title is delayed ...");
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
switch(_type) {
|
|
||||||
case messageTypeInfo:
|
|
||||||
tmpPopUp->setTitle("<bold>Info</bold>");
|
|
||||||
break;
|
|
||||||
case messageTypeWarning:
|
|
||||||
tmpPopUp->setTitle("<bold><font color=\"orange\">Warning</font></bold>");
|
|
||||||
break;
|
|
||||||
case messageTypeError:
|
|
||||||
tmpPopUp->setTitle("<bold><font color=\"red\">Error</font></bold>");
|
|
||||||
break;
|
|
||||||
case messageTypeCritical:
|
|
||||||
tmpPopUp->setTitle("<bold><font colorBg=\"red\">Critical</font></bold>");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
tmpPopUp->setComment(_message);
|
|
||||||
tmpPopUp->addButton("close", true);
|
|
||||||
tmpPopUp->propertyCloseOutEvent.set(true);
|
|
||||||
popUpWidgetPush(tmpPopUp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::widget::Windows::requestDestroyFromChild(const ewol::ObjectShared& _child) {
|
void ewol::widget::Windows::requestDestroyFromChild(const ewol::ObjectShared& _child) {
|
||||||
@ -295,9 +271,4 @@ ewol::ObjectShared ewol::widget::Windows::getSubObjectNamed(const std::string& _
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::widget::Windows::sysOnKill() {
|
|
||||||
if (onKill() == true) {
|
|
||||||
getContext().stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -23,112 +23,64 @@ namespace ewol {
|
|||||||
* @brief Windows basic interface
|
* @brief Windows basic interface
|
||||||
*/
|
*/
|
||||||
class Windows : public ewol::Widget {
|
class Windows : public ewol::Widget {
|
||||||
|
public:
|
||||||
|
eproperty::Value<std::string> propertyColorConfiguration; //!< Configuration file of the windows theme
|
||||||
|
eproperty::Value<std::string> propertyTitle; //!< Current title of the windows
|
||||||
protected:
|
protected:
|
||||||
std::shared_ptr<ewol::resource::ColorFile> m_colorProperty; //!< theme color property
|
std::shared_ptr<ewol::resource::ColorFile> m_resourceColor; //!< theme color property (name of file in @ref propertyColorConfiguration)
|
||||||
int32_t m_colorBg; //!< Default background color of the windows
|
int32_t m_colorBg; //!< Default background color of the windows
|
||||||
protected:
|
protected:
|
||||||
Windows();
|
Windows();
|
||||||
|
void init() override;
|
||||||
public:
|
public:
|
||||||
virtual ~Windows();
|
virtual ~Windows();
|
||||||
// internal event at ewol system :
|
// internal event at ewol system:
|
||||||
public:
|
public:
|
||||||
void sysDraw();
|
void sysDraw();
|
||||||
void sysOnShow() {};
|
protected:
|
||||||
void sysOnHide() {};
|
ewol::WidgetShared m_subWidget; //!< main sub-widget of the Windows.
|
||||||
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<ewol::WidgetShared> m_popUpWidgetList;
|
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Set the main widget of the application.
|
||||||
|
* @param[in] _widget Widget to set in the windows.
|
||||||
|
*/
|
||||||
void setSubWidget(ewol::WidgetShared _widget);
|
void setSubWidget(ewol::WidgetShared _widget);
|
||||||
|
protected:
|
||||||
|
std::list<ewol::WidgetShared> 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);
|
void popUpWidgetPush(ewol::WidgetShared _widget);
|
||||||
|
/**
|
||||||
|
* @brief Remove the pop-up on top.
|
||||||
|
*/
|
||||||
void popUpWidgetPop();
|
void popUpWidgetPop();
|
||||||
|
/**
|
||||||
|
* @brief Get the number of pop-up
|
||||||
|
* @return Count of pop-up
|
||||||
|
*/
|
||||||
size_t popUpCount() {
|
size_t popUpCount() {
|
||||||
return m_popUpWidgetList.size();
|
return m_popUpWidgetList.size();
|
||||||
}
|
}
|
||||||
private:
|
|
||||||
etk::Color<float> m_backgroundColor; //!< reset color of the Main windows
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief get the background color.
|
|
||||||
* @return A reference on the color
|
|
||||||
*/
|
|
||||||
const etk::Color<float>& getBackgroundColor() {
|
|
||||||
return m_backgroundColor;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* @brief set the background color.
|
|
||||||
* @param[IN] the new requested color.
|
|
||||||
*/
|
|
||||||
void setBackgroundColor(const etk::Color<float>& _color);
|
|
||||||
protected:
|
protected:
|
||||||
void systemDraw(const ewol::DrawProperty& _displayProp) override;
|
void systemDraw(const ewol::DrawProperty& _displayProp) override;
|
||||||
public: // Derived function
|
public:
|
||||||
void onRegenerateDisplay() override;
|
void onRegenerateDisplay() override;
|
||||||
void onChangeSize() override;
|
void onChangeSize() override;
|
||||||
ewol::WidgetShared getWidgetAtPos(const vec2& _pos) override;
|
ewol::WidgetShared getWidgetAtPos(const vec2& _pos) override;
|
||||||
void requestDestroyFromChild(const ewol::ObjectShared& _child) override;
|
void requestDestroyFromChild(const ewol::ObjectShared& _child) override;
|
||||||
ewol::ObjectShared getSubObjectNamed(const std::string& _objectName) override;
|
ewol::ObjectShared getSubObjectNamed(const std::string& _objectName) override;
|
||||||
void setTitle(const std::string& _title);
|
protected:
|
||||||
public:
|
|
||||||
enum popUpMessageType {
|
|
||||||
messageTypeInfo, //!< information message pop-up
|
|
||||||
messageTypeWarning, //!< warning message pop-up
|
|
||||||
messageTypeError, //!< Error message pop-up
|
|
||||||
messageTypeCritical //!< Critical message pop-up
|
|
||||||
};
|
|
||||||
/**
|
/**
|
||||||
* @brief Create a simple pop-up message on the screen for application error.
|
* @brief Called when property change: Title
|
||||||
* @param[in] _type Type of the error.
|
|
||||||
* @param[in] _message message to display (decorated text)
|
|
||||||
*/
|
*/
|
||||||
virtual void createPopUpMessage(enum popUpMessageType _type, const std::string& _message);
|
virtual void onChangePropertyTitle();
|
||||||
/**
|
/**
|
||||||
* @brief Create a simple information message
|
* @brief Called when property change: Color configuration file
|
||||||
* @param[in] _message message to display (decorated text)
|
|
||||||
*/
|
*/
|
||||||
void displayInfoMessage(const std::string& _message) {
|
virtual void onChangePropertyColor();
|
||||||
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;
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,14 @@
|
|||||||
#define __class__ "ewol::StdPopUp"
|
#define __class__ "ewol::StdPopUp"
|
||||||
|
|
||||||
ewol::widget::StdPopUp::StdPopUp() :
|
ewol::widget::StdPopUp::StdPopUp() :
|
||||||
|
propertyTitle(this, "title",
|
||||||
|
"<bold>Message</bold>",
|
||||||
|
"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_title(nullptr),
|
||||||
m_comment(nullptr),
|
m_comment(nullptr),
|
||||||
m_subBar(nullptr) {
|
m_subBar(nullptr) {
|
||||||
@ -54,7 +62,7 @@ void ewol::widget::StdPopUp::init() {
|
|||||||
mySizerVert->subWidgetAdd(mySpacer);
|
mySizerVert->subWidgetAdd(mySpacer);
|
||||||
|
|
||||||
m_comment = ewol::widget::Label::create();
|
m_comment = ewol::widget::Label::create();
|
||||||
m_comment->propertyValue.set("No Label");
|
m_comment->propertyValue.set(*propertyComment);
|
||||||
m_comment->propertyExpand.set(bvec2(true,true));
|
m_comment->propertyExpand.set(bvec2(true,true));
|
||||||
mySizerVert->subWidgetAdd(m_comment);
|
mySizerVert->subWidgetAdd(m_comment);
|
||||||
|
|
||||||
@ -70,7 +78,7 @@ void ewol::widget::StdPopUp::init() {
|
|||||||
mySizerVert->subWidgetAdd(mySpacer);
|
mySizerVert->subWidgetAdd(mySpacer);
|
||||||
|
|
||||||
m_title = ewol::widget::Label::create();
|
m_title = ewol::widget::Label::create();
|
||||||
m_title->propertyValue.set("<bold>Message</bold>");
|
m_title->propertyValue.set(*propertyTitle);
|
||||||
m_title->propertyExpand.set(bvec2(true,false));
|
m_title->propertyExpand.set(bvec2(true,false));
|
||||||
m_title->propertyFill.set(bvec2(true,true));
|
m_title->propertyFill.set(bvec2(true,true));
|
||||||
mySizerVert->subWidgetAdd(m_title);
|
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) {
|
if (m_title == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_title->propertyValue.set(_text);
|
m_title->propertyValue.set(*propertyTitle);
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::widget::StdPopUp::setComment(const std::string& _text) {
|
void ewol::widget::StdPopUp::onChangePropertyComment() {
|
||||||
if (m_comment == nullptr) {
|
if (m_comment == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_comment->propertyValue.set(_text);
|
m_comment->propertyValue.set(*propertyComment);
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ namespace ewol {
|
|||||||
* | |
|
* | |
|
||||||
* | |
|
* | |
|
||||||
* | +-------------------+ |
|
* | +-------------------+ |
|
||||||
* | | Erreur: | |
|
* | | Title: | |
|
||||||
* | | | |
|
* | | | |
|
||||||
* | | Message to diplay | |
|
* | | Message to diplay | |
|
||||||
* | | to user | |
|
* | | to user | |
|
||||||
@ -42,7 +42,8 @@ namespace ewol {
|
|||||||
*/
|
*/
|
||||||
class StdPopUp : public ewol::widget::PopUp {
|
class StdPopUp : public ewol::widget::PopUp {
|
||||||
public: // properties:
|
public: // properties:
|
||||||
// TODO: ...
|
eproperty::Value<std::string> propertyTitle; //!< Title of the pop-up
|
||||||
|
eproperty::Value<std::string> propertyComment; //!< comment in the pop-up (can be decorated text)
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief std-pop-up constructor.
|
* @brief std-pop-up constructor.
|
||||||
@ -57,20 +58,15 @@ namespace ewol {
|
|||||||
virtual ~StdPopUp();
|
virtual ~StdPopUp();
|
||||||
protected:
|
protected:
|
||||||
ewol::widget::LabelShared m_title; //!< Title Label widget
|
ewol::widget::LabelShared m_title; //!< Title Label widget
|
||||||
public:
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the title string.
|
* @brief property callback when request a change of the title.
|
||||||
* @param[in] _text Decorated text to diplay in title.
|
|
||||||
*/
|
*/
|
||||||
void setTitle(const std::string& _text);
|
void onChangePropertyTitle();
|
||||||
protected:
|
|
||||||
ewol::widget::LabelShared m_comment; //!< Comment label widget
|
ewol::widget::LabelShared m_comment; //!< Comment label widget
|
||||||
public:
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the commentary string.
|
* @brief property callback when request a change of the Comment.
|
||||||
* @param[in] _text Decorated text to diplay in Comment.
|
|
||||||
*/
|
*/
|
||||||
void setComment(const std::string& _text);
|
void onChangePropertyComment();
|
||||||
protected:
|
protected:
|
||||||
ewol::widget::SizerShared m_subBar; //!< subwidget bar containing all the button.
|
ewol::widget::SizerShared m_subBar; //!< subwidget bar containing all the button.
|
||||||
public:
|
public:
|
||||||
@ -79,8 +75,8 @@ namespace ewol {
|
|||||||
* @param[in] _text Decorated text to diplay in button.
|
* @param[in] _text Decorated text to diplay in button.
|
||||||
*/
|
*/
|
||||||
ewol::widget::ButtonShared addButton(const std::string& _text, bool _autoExit=false);
|
ewol::widget::ButtonShared addButton(const std::string& _text, bool _autoExit=false);
|
||||||
public: // callback function
|
public:
|
||||||
void onCallBackButtonExit();
|
virtual void onCallBackButtonExit();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
4
lutinParseSubFolders.txt
Normal file
4
lutinParseSubFolders.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
sample/001_HelloWord
|
||||||
|
sample/0XX_CustomWidgets
|
||||||
|
sample/examplewallpaper
|
||||||
|
tools/visual_test
|
@ -79,6 +79,7 @@ def create(target, module_name):
|
|||||||
my_module.add_src_file([
|
my_module.add_src_file([
|
||||||
'ewol/context/ConfigFont.cpp',
|
'ewol/context/ConfigFont.cpp',
|
||||||
'ewol/context/Context.cpp',
|
'ewol/context/Context.cpp',
|
||||||
|
'ewol/context/Application.cpp',
|
||||||
'ewol/context/InputManager.cpp'
|
'ewol/context/InputManager.cpp'
|
||||||
])
|
])
|
||||||
my_module.add_header_file([
|
my_module.add_header_file([
|
||||||
@ -220,6 +221,14 @@ def create(target, module_name):
|
|||||||
'ewol/widget/Spin.h'
|
'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/square/*','theme/shape/square')
|
||||||
my_module.copy_path('data/theme/shape/round/*','theme/shape/round')
|
my_module.copy_path('data/theme/shape/round/*','theme/shape/round')
|
||||||
my_module.copy_path('data/theme/color/black/*','theme/color/black')
|
my_module.copy_path('data/theme/color/black/*','theme/color/black')
|
||||||
|
@ -20,9 +20,16 @@
|
|||||||
|
|
||||||
class MainApplication : public ewol::context::Application {
|
class MainApplication : public ewol::context::Application {
|
||||||
public:
|
public:
|
||||||
bool init(ewol::Context& _context, size_t _initId) {
|
void onCreate(ewol::Context& _context) override {
|
||||||
APPL_INFO("==> Init APPL (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ")");
|
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
|
// TODO : Remove this : Move if in the windows properties
|
||||||
_context.setSize(vec2(800, 600));
|
_context.setSize(vec2(800, 600));
|
||||||
|
|
||||||
@ -30,17 +37,21 @@ class MainApplication : public ewol::context::Application {
|
|||||||
_context.getFontDefault().setUseExternal(true);
|
_context.getFontDefault().setUseExternal(true);
|
||||||
_context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19);
|
_context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19);
|
||||||
|
|
||||||
std::shared_ptr<ewol::widget::Windows> basicWindows = appl::Windows::create();
|
ewol::widget::WindowsShared basicWindows = appl::Windows::create();
|
||||||
// create the specific windows
|
// create the specific windows
|
||||||
_context.setWindows(basicWindows);
|
_context.setWindows(basicWindows);
|
||||||
APPL_INFO("==> Init APPL (END)");
|
APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)");
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void unInit(ewol::Context& _context) {
|
void onStart(ewol::Context& _context) override {
|
||||||
APPL_INFO("==> Un-Init APPL (START)");
|
APPL_INFO("==> START ... " PROJECT_NAME " (BEGIN)");
|
||||||
// nothing to do ...
|
// 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)");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -16,16 +16,16 @@
|
|||||||
|
|
||||||
appl::Windows::Windows() {
|
appl::Windows::Windows() {
|
||||||
addObjectType("appl::Windows");
|
addObjectType("appl::Windows");
|
||||||
|
propertyTitle.setDirectCheck(std::string("sample ") + PROJECT_NAME);
|
||||||
}
|
}
|
||||||
void appl::Windows::init() {
|
void appl::Windows::init() {
|
||||||
ewol::widget::Windows::init();
|
ewol::widget::Windows::init();
|
||||||
setTitle("example 001_HelloWorld");
|
ewol::widget::LabelShared tmpWidget = ewol::widget::Label::create();
|
||||||
std::shared_ptr<ewol::widget::Label> tmpWidget = ewol::widget::Label::create();
|
|
||||||
if (tmpWidget == nullptr) {
|
if (tmpWidget == nullptr) {
|
||||||
APPL_ERROR("Can not allocate widget ==> display might be in error");
|
APPL_ERROR("Can not allocate widget ==> display might be in error");
|
||||||
} else {
|
} else {
|
||||||
tmpWidget->setLabel("Hello <font color=\"blue\">World</font>");
|
tmpWidget->propertyValue.set("Hello <font color='blue'>World</font>");
|
||||||
tmpWidget->setExpand(bvec2(true,true));
|
tmpWidget->propertyExpand.set(bvec2(true,true));
|
||||||
setSubWidget(tmpWidget);
|
setSubWidget(tmpWidget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,9 @@
|
|||||||
#include <ewol/widget/Windows.h>
|
#include <ewol/widget/Windows.h>
|
||||||
|
|
||||||
namespace appl {
|
namespace appl {
|
||||||
|
class Windows;
|
||||||
|
using WindowsShared = ememory::SharedPtr<appl::Windows>;
|
||||||
|
using WindowsWeak = ememory::WeakPtr<appl::Windows>;
|
||||||
class Windows : public ewol::widget::Windows {
|
class Windows : public ewol::widget::Windows {
|
||||||
protected:
|
protected:
|
||||||
Windows();
|
Windows();
|
||||||
|
@ -35,7 +35,9 @@ def create(target, module_name):
|
|||||||
])
|
])
|
||||||
my_module.add_module_depend(['ewol'])
|
my_module.add_module_depend(['ewol'])
|
||||||
my_module.compile_flags('c++', [
|
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__))
|
my_module.add_path(tools.get_current_path(__file__))
|
||||||
return my_module
|
return my_module
|
||||||
|
|
||||||
|
@ -21,9 +21,16 @@
|
|||||||
|
|
||||||
class MainApplication : public ewol::context::Application {
|
class MainApplication : public ewol::context::Application {
|
||||||
public:
|
public:
|
||||||
bool init(ewol::Context& _context, size_t _initId) {
|
void onCreate(ewol::Context& _context) override {
|
||||||
APPL_INFO("==> Init APPL (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ")");
|
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
|
// TODO : Remove this : Move if in the windows properties
|
||||||
_context.setSize(vec2(800, 600));
|
_context.setSize(vec2(800, 600));
|
||||||
|
|
||||||
@ -33,16 +40,21 @@ class MainApplication : public ewol::context::Application {
|
|||||||
|
|
||||||
appl::widget::VectorDisplay::createManagerWidget(_context.getWidgetManager());
|
appl::widget::VectorDisplay::createManagerWidget(_context.getWidgetManager());
|
||||||
|
|
||||||
std::shared_ptr<ewol::widget::Windows> basicWindows = appl::Windows::create();
|
ewol::widget::WindowsShared basicWindows = appl::Windows::create();
|
||||||
// create the specific windows
|
// create the specific windows
|
||||||
_context.setWindows(basicWindows);
|
_context.setWindows(basicWindows);
|
||||||
APPL_INFO("==> Init APPL (END)");
|
APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)");
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
void unInit(ewol::Context& _context) {
|
|
||||||
APPL_INFO("==> Un-Init APPL (START)");
|
void onStart(ewol::Context& _context) override {
|
||||||
// nothing to do...
|
APPL_INFO("==> START ... " PROJECT_NAME " (BEGIN)");
|
||||||
APPL_INFO("==> Un-Init APPL (END)");
|
// 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)");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21,12 +21,13 @@ static const char* const g_eventChangeValues = "appl-change-value";
|
|||||||
static const char* const g_eventAutoMode = "appl-change-auto";
|
static const char* const g_eventAutoMode = "appl-change-auto";
|
||||||
|
|
||||||
appl::Windows::Windows() :
|
appl::Windows::Windows() :
|
||||||
m_composer(NULL) {
|
m_composer(nullptr) {
|
||||||
addObjectType("appl::Windows");
|
addObjectType("appl::Windows");
|
||||||
|
propertyTitle.setDirectCheck(std::string("sample ") + PROJECT_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::Windows::init() {
|
void appl::Windows::init() {
|
||||||
setTitle("example 001_HelloWord");
|
ewol::widget::Windows::init();
|
||||||
std::string composition = std::string("");
|
std::string composition = std::string("");
|
||||||
composition += "<sizer mode='vert'>\n";
|
composition += "<sizer mode='vert'>\n";
|
||||||
composition += " <sizer mode='hori'>\n";
|
composition += " <sizer mode='hori'>\n";
|
||||||
@ -44,11 +45,12 @@ void appl::Windows::init() {
|
|||||||
composition += " <VectorDisplay name='displayer' expand='true' fill='true'/>\n";
|
composition += " <VectorDisplay name='displayer' expand='true' fill='true'/>\n";
|
||||||
composition += "</sizer>\n";
|
composition += "</sizer>\n";
|
||||||
|
|
||||||
m_composer = ewol::widget::Composer::create(ewol::widget::Composer::String, composition);
|
m_composer = ewol::widget::Composer::create();
|
||||||
if (m_composer == NULL) {
|
if (m_composer == nullptr) {
|
||||||
APPL_CRITICAL(" An error occured ... in the windows creatrion ...");
|
APPL_CRITICAL(" An error occured ... in the windows creatrion ...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
m_composer->loadFromString(composition);
|
||||||
setSubWidget(m_composer);
|
setSubWidget(m_composer);
|
||||||
subBind(ewol::widget::Button, "bt-change", signalPressed, shared_from_this(), &appl::Windows::onCallbackChangeValues);
|
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);
|
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));
|
tmp.push_back(etk::tool::frand(-1.0, 1.0));
|
||||||
}
|
}
|
||||||
std::shared_ptr<appl::widget::VectorDisplay> tmpDisp = std::dynamic_pointer_cast<appl::widget::VectorDisplay>(getSubObjectNamed("displayer"));
|
std::shared_ptr<appl::widget::VectorDisplay> tmpDisp = std::dynamic_pointer_cast<appl::widget::VectorDisplay>(getSubObjectNamed("displayer"));
|
||||||
if (tmpDisp != NULL) {
|
if (tmpDisp != nullptr) {
|
||||||
tmpDisp->setValue(tmp);
|
tmpDisp->setValue(tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::Windows::onCallbackAutoMode() {
|
void appl::Windows::onCallbackAutoMode() {
|
||||||
std::shared_ptr<appl::widget::VectorDisplay> tmpDisp = std::dynamic_pointer_cast<appl::widget::VectorDisplay>(getSubObjectNamed("displayer"));
|
std::shared_ptr<appl::widget::VectorDisplay> tmpDisp = std::dynamic_pointer_cast<appl::widget::VectorDisplay>(getSubObjectNamed("displayer"));
|
||||||
if (tmpDisp != NULL) {
|
if (tmpDisp != nullptr) {
|
||||||
tmpDisp->ToggleAuto();
|
tmpDisp->ToggleAuto();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,9 +11,12 @@
|
|||||||
#include <ewol/widget/Composer.h>
|
#include <ewol/widget/Composer.h>
|
||||||
|
|
||||||
namespace appl {
|
namespace appl {
|
||||||
|
class Windows;
|
||||||
|
using WindowsShared = ememory::SharedPtr<appl::Windows>;
|
||||||
|
using WindowsWeak = ememory::WeakPtr<appl::Windows>;
|
||||||
class Windows : public ewol::widget::Windows {
|
class Windows : public ewol::widget::Windows {
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<ewol::widget::Composer> m_composer;
|
ewol::widget::ComposerShared m_composer;
|
||||||
protected:
|
protected:
|
||||||
Windows();
|
Windows();
|
||||||
void init();
|
void init();
|
||||||
|
@ -36,7 +36,9 @@ def create(target, module_name):
|
|||||||
])
|
])
|
||||||
my_module.add_module_depend(['ewol'])
|
my_module.add_module_depend(['ewol'])
|
||||||
my_module.compile_flags('c++', [
|
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__))
|
my_module.add_path(tools.get_current_path(__file__))
|
||||||
return my_module
|
return my_module
|
||||||
|
|
||||||
|
@ -20,9 +20,16 @@
|
|||||||
|
|
||||||
class MainApplication : public ewol::context::Application {
|
class MainApplication : public ewol::context::Application {
|
||||||
public:
|
public:
|
||||||
bool init(ewol::Context& _context, size_t _initId) {
|
void onCreate(ewol::Context& _context) override {
|
||||||
APPL_INFO("==> Init APPL (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ")");
|
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
|
// TODO : Remove this : Move if in the windows properties
|
||||||
_context.setSize(vec2(800, 600));
|
_context.setSize(vec2(800, 600));
|
||||||
|
|
||||||
@ -30,17 +37,21 @@ class MainApplication : public ewol::context::Application {
|
|||||||
_context.getFontDefault().setUseExternal(true);
|
_context.getFontDefault().setUseExternal(true);
|
||||||
_context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19);
|
_context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19);
|
||||||
|
|
||||||
std::shared_ptr<ewol::widget::Windows> basicWindows = appl::Windows::create();
|
ewol::widget::WindowsShared basicWindows = appl::Windows::create();
|
||||||
// create the specific windows
|
// create the specific windows
|
||||||
_context.setWindows(basicWindows);
|
_context.setWindows(basicWindows);
|
||||||
APPL_INFO("==> Init APPL (END)");
|
APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)");
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void unInit(ewol::Context& _context) {
|
void onStart(ewol::Context& _context) override {
|
||||||
APPL_INFO(" == > Un-Init " PROJECT_NAME " (START)");
|
APPL_INFO("==> START ... " PROJECT_NAME " (BEGIN)");
|
||||||
// nothing to do ...
|
// 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)");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -18,12 +18,12 @@
|
|||||||
|
|
||||||
appl::WidgetDisplay::WidgetDisplay() {
|
appl::WidgetDisplay::WidgetDisplay() {
|
||||||
addObjectType("appl::WidgetDisplay");
|
addObjectType("appl::WidgetDisplay");
|
||||||
|
propertyCanFocus.setDirectCheck(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::WidgetDisplay::init() {
|
void appl::WidgetDisplay::init() {
|
||||||
ewol::Widget::init();
|
ewol::Widget::init();
|
||||||
m_compositing.setSource("DATA:SnowFlake.svg", ivec2(128,128));
|
m_compositing.setSource("DATA:SnowFlake.svg", ivec2(128,128));
|
||||||
setCanHaveFocus(true);
|
|
||||||
periodicCallEnable();
|
periodicCallEnable();
|
||||||
for (int32_t iii=0; iii<250 ; ++iii) {
|
for (int32_t iii=0; iii<250 ; ++iii) {
|
||||||
m_elements.push_back(appl::WidgetDisplay::Element());
|
m_elements.push_back(appl::WidgetDisplay::Element());
|
||||||
|
@ -7,11 +7,14 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <draw/Color.h>
|
#include <etk/Color.h>
|
||||||
#include <ewol/widget/Widget.h>
|
#include <ewol/widget/Widget.h>
|
||||||
#include <ewol/compositing/Image.h>
|
#include <ewol/compositing/Image.h>
|
||||||
|
|
||||||
namespace appl {
|
namespace appl {
|
||||||
|
class WidgetDisplay;
|
||||||
|
using WidgetDisplayShared = ememory::SharedPtr<appl::WidgetDisplay>;
|
||||||
|
using WidgetDisplayWeak = ememory::WeakPtr<appl::WidgetDisplay>;
|
||||||
class WidgetDisplay : public ewol::Widget {
|
class WidgetDisplay : public ewol::Widget {
|
||||||
private:
|
private:
|
||||||
class Element {
|
class Element {
|
||||||
|
@ -17,20 +17,19 @@
|
|||||||
|
|
||||||
appl::Windows::Windows() {
|
appl::Windows::Windows() {
|
||||||
addObjectType("appl::Windows");
|
addObjectType("appl::Windows");
|
||||||
|
propertyTitle.setDirectCheck(std::string("sample ") + PROJECT_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::Windows::init() {
|
void appl::Windows::init() {
|
||||||
ewol::widget::Windows::init();
|
ewol::widget::Windows::init();
|
||||||
setTitle("example Wallpaper");
|
appl::WidgetDisplayShared tmpWidget = appl::WidgetDisplay::create();
|
||||||
std::shared_ptr<appl::WidgetDisplay> tmpWidget = appl::WidgetDisplay::create();
|
|
||||||
if (tmpWidget == nullptr) {
|
if (tmpWidget == nullptr) {
|
||||||
APPL_ERROR("Can not allocate widget ==> display might be in error");
|
APPL_ERROR("Can not allocate widget ==> display might be in error");
|
||||||
} else {
|
} else {
|
||||||
setSubWidget(tmpWidget);
|
setSubWidget(tmpWidget);
|
||||||
tmpWidget->setExpand(bvec2(true,true));
|
tmpWidget->propertyExpand.set(bvec2(true,true));
|
||||||
tmpWidget->setFill(bvec2(true,true));
|
tmpWidget->propertyFill.set(bvec2(true,true));
|
||||||
}
|
}
|
||||||
setBackgroundColor(etk::Color<float>(0,0,0,0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
appl::Windows::~Windows() {
|
appl::Windows::~Windows() {
|
||||||
|
@ -11,6 +11,9 @@
|
|||||||
#include <ewol/widget/Windows.h>
|
#include <ewol/widget/Windows.h>
|
||||||
|
|
||||||
namespace appl {
|
namespace appl {
|
||||||
|
class Windows;
|
||||||
|
using WindowsShared = ememory::SharedPtr<appl::Windows>;
|
||||||
|
using WindowsWeak = ememory::WeakPtr<appl::Windows>;
|
||||||
class Windows : public ewol::widget::Windows {
|
class Windows : public ewol::widget::Windows {
|
||||||
protected:
|
protected:
|
||||||
Windows();
|
Windows();
|
||||||
|
@ -28,6 +28,9 @@ def get_compagny_name():
|
|||||||
def get_maintainer():
|
def get_maintainer():
|
||||||
return ["Mr DUPIN Edouard <yui.heero@gmail.com>"]
|
return ["Mr DUPIN Edouard <yui.heero@gmail.com>"]
|
||||||
|
|
||||||
|
def get_version():
|
||||||
|
return [0,1]
|
||||||
|
|
||||||
def create(target, module_name):
|
def create(target, module_name):
|
||||||
my_module = module.Module(__file__, module_name, get_type())
|
my_module = module.Module(__file__, module_name, get_type())
|
||||||
my_module.add_src_file([
|
my_module.add_src_file([
|
||||||
@ -38,14 +41,12 @@ def create(target, module_name):
|
|||||||
])
|
])
|
||||||
my_module.add_module_depend(['ewol'])
|
my_module.add_module_depend(['ewol'])
|
||||||
my_module.compile_flags('c++', [
|
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.copy_path('data/SnowFlake.svg','')
|
||||||
my_module.add_path(tools.get_current_path(__file__))
|
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 :
|
# set the package properties :
|
||||||
my_module.pkg_set("VERSION", versionID)
|
|
||||||
my_module.pkg_set("COMPAGNY_TYPE", get_compagny_type())
|
my_module.pkg_set("COMPAGNY_TYPE", get_compagny_type())
|
||||||
my_module.pkg_set("COMPAGNY_NAME", get_compagny_name())
|
my_module.pkg_set("COMPAGNY_NAME", get_compagny_name())
|
||||||
my_module.pkg_set("MAINTAINER", get_maintainer())
|
my_module.pkg_set("MAINTAINER", get_maintainer())
|
||||||
|
@ -19,10 +19,10 @@ namespace appl {
|
|||||||
protected:
|
protected:
|
||||||
Windows() {
|
Windows() {
|
||||||
addObjectType("appl::Windows");
|
addObjectType("appl::Windows");
|
||||||
|
propertyTitle.setDirectCheck("test set");
|
||||||
}
|
}
|
||||||
void init() {
|
void init() {
|
||||||
ewol::widget::Windows::init();
|
ewol::widget::Windows::init();
|
||||||
setTitle("test set");
|
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
DECLARE_FACTORY(Windows);
|
DECLARE_FACTORY(Windows);
|
||||||
|
@ -66,7 +66,7 @@ class MainApplication : public ewol::context::Application {
|
|||||||
_context.setWindows(basicWindows);
|
_context.setWindows(basicWindows);
|
||||||
if (basicWindows == nullptr) {
|
if (basicWindows == nullptr) {
|
||||||
APPL_ERROR("Can not allocate the basic windows");
|
APPL_ERROR("Can not allocate the basic windows");
|
||||||
_context.stop();
|
_context.exit(-1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ def get_sub_type():
|
|||||||
return "TOOL"
|
return "TOOL"
|
||||||
|
|
||||||
def get_desc():
|
def get_desc():
|
||||||
return "ewol test software (visual)"
|
return "ewol tools software (visual)"
|
||||||
|
|
||||||
def get_licence():
|
def get_licence():
|
||||||
return "APACHE-2"
|
return "APACHE-2"
|
||||||
@ -28,28 +28,28 @@ def create(target, module_name):
|
|||||||
my_module = module.Module(__file__, module_name, get_type())
|
my_module = module.Module(__file__, module_name, get_type())
|
||||||
# add the file to compile:
|
# add the file to compile:
|
||||||
my_module.add_src_file([
|
my_module.add_src_file([
|
||||||
'tools/visual_test/appl/debug.cpp',
|
'appl/debug.cpp',
|
||||||
'tools/visual_test/appl/init.cpp',
|
'appl/init.cpp',
|
||||||
'tools/visual_test/appl/MainWindows.cpp',
|
'appl/MainWindows.cpp',
|
||||||
'tools/visual_test/appl/TestDistanceField.cpp',
|
'appl/TestDistanceField.cpp',
|
||||||
'tools/visual_test/appl/widget/SizerColor.cpp'
|
'appl/widget/SizerColor.cpp'
|
||||||
])
|
])
|
||||||
|
|
||||||
my_module.add_module_depend(['ewol'])
|
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('data/icon.*','')
|
||||||
my_module.copy_path('tools/visual_test/data/cube.*','')
|
my_module.copy_path('data/cube.*','')
|
||||||
my_module.copy_path('tools/visual_test/data/grass.*','')
|
my_module.copy_path('data/grass.*','')
|
||||||
my_module.copy_path('tools/visual_test/data/stone*','')
|
my_module.copy_path('data/stone*','')
|
||||||
my_module.copy_path('tools/visual_test/data/sphere.png','')
|
my_module.copy_path('data/sphere.png','')
|
||||||
my_module.copy_path('tools/visual_test/data/sphere.obj','')
|
my_module.copy_path('data/sphere.obj','')
|
||||||
my_module.copy_path('tools/visual_test/data/gui.xml','')
|
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 :
|
# set the package properties :
|
Loading…
x
Reference in New Issue
Block a user