From 87f4cb08e6de47bf2c3f548381d90713518afb25 Mon Sep 17 00:00:00 2001 From: Edouard Dupin Date: Mon, 27 Feb 2012 18:17:05 +0100 Subject: [PATCH] Rework of EWOL (Step 1) --- Sources/libewol/ewol/EObject.cpp | 3 + Sources/libewol/ewol/EObject.h | 2 +- Sources/libewol/ewol/EObjectManager.cpp | 150 ++++++++++++++ Sources/libewol/ewol/EObjectManager.h | 44 ++++ .../libewol/ewol/EObjectMessageMulticast.cpp | 116 +++++++++++ ...eMultiCast.h => EObjectMessageMulticast.h} | 18 +- Sources/libewol/ewol/ShortCutManager.cpp | 4 +- Sources/libewol/ewol/Widget.cpp | 82 ++------ Sources/libewol/ewol/Widget.h | 56 ++--- Sources/libewol/ewol/WidgetManager.cpp | 191 ++---------------- Sources/libewol/ewol/WidgetManager.h | 17 +- .../libewol/ewol/WidgetMessageMultiCast.cpp | 110 ---------- Sources/libewol/ewol/Windows.cpp | 48 ++--- Sources/libewol/ewol/Windows.h | 1 - Sources/libewol/ewol/base/MainThread.cpp | 2 - Sources/libewol/ewol/base/gui.cpp | 13 +- Sources/libewol/ewol/ewol.h | 1 - Sources/libewol/ewol/widget/Button.cpp | 4 +- Sources/libewol/ewol/widget/CheckBox.cpp | 5 +- Sources/libewol/ewol/widget/ContextMenu.cpp | 18 ++ Sources/libewol/ewol/widget/Entry.cpp | 4 +- Sources/libewol/ewol/widget/Label.cpp | 2 +- Sources/libewol/ewol/widget/Menu.cpp | 30 ++- Sources/libewol/ewol/widget/Menu.h | 6 +- Sources/libewol/ewol/widget/PopUp.cpp | 31 ++- Sources/libewol/ewol/widget/SizerHori.cpp | 21 +- Sources/libewol/ewol/widget/SizerVert.cpp | 20 +- .../libewol/ewol/widgetMeta/FileChooser.cpp | 27 ++- Sources/libewol/ewol/widgetMeta/Keyboard.cpp | 19 +- Sources/libewol/ewol/widgetMeta/StdPopUp.h | 23 +-- Sources/libewol/file.mk | 3 +- 31 files changed, 557 insertions(+), 514 deletions(-) create mode 100644 Sources/libewol/ewol/EObjectManager.cpp create mode 100644 Sources/libewol/ewol/EObjectManager.h create mode 100644 Sources/libewol/ewol/EObjectMessageMulticast.cpp rename Sources/libewol/ewol/{WidgetMessageMultiCast.h => EObjectMessageMulticast.h} (63%) delete mode 100644 Sources/libewol/ewol/WidgetMessageMultiCast.cpp diff --git a/Sources/libewol/ewol/EObject.cpp b/Sources/libewol/ewol/EObject.cpp index e3a5b2b4..b6d827f0 100644 --- a/Sources/libewol/ewol/EObject.cpp +++ b/Sources/libewol/ewol/EObject.cpp @@ -23,6 +23,7 @@ */ #include +#include #include /** @@ -34,6 +35,7 @@ ewol::EObject::EObject(void) // note this is nearly atomic ... (but it is enough) m_uniqueId = ss_globalUniqueId++; EWOL_DEBUG("new EObject : [" << m_uniqueId << "]"); + ewol::EObjectManager::Add(this); } /** @@ -41,6 +43,7 @@ ewol::EObject::EObject(void) */ ewol::EObject::~EObject(void) { + ewol::EObjectManager::Rm(this); EWOL_DEBUG("delete EObject : [" << m_uniqueId << "]"); for (int32_t iii=0; iii + +#undef __class__ +#define __class__ "ewol::EObjectManager" + +static bool IsInit = false; + +// internal element of the widget manager : +static etk::VectorType m_eObjectList; // all widget allocated ==> all time increment ... never removed ... +static etk::VectorType m_eObjectDeletedList; // all widget allocated + + +void ewol::EObjectManager::Init(void) +{ + EWOL_DEBUG("==> Init EObject-Manager"); + // Can create mlemory leak ... ==> but not predictable comportement otherwise ... + // TODO : Check if we can do sotthing better + m_eObjectDeletedList.Clear(); + m_eObjectList.Clear(); + IsInit = true; +} + +void ewol::EObjectManager::UnInit(void) +{ + EWOL_DEBUG("==> Un-Init EObject-Manager"); + + ewol::EObjectManager::RemoveAllMark(); + + EWOL_INFO(" Remove missing user widget"); + while(0 this control the mutex Lock + ewol::EObjectManager::RemoveAllMark(); + + IsInit = false; +} + +void ewol::EObjectManager::Add(ewol::EObject* object) +{ + // TODO : Chek if not existed before ... + if (NULL != object) { + m_eObjectList.PushBack(object); + } else { + EWOL_ERROR("try to add an inexistant EObject in manager"); + } +} + +void ewol::EObjectManager::Rm(ewol::EObject* object) +{ + if (NULL == object) { + EWOL_ERROR("Try to remove (NULL) EObject"); + return; + } + for (int32_t iii=0; iiiOnObjectRemove(object); + } + } +} + + +void ewol::EObjectManager::MarkToRemoved(ewol::EObject* object) +{ + if (object == NULL) { + EWOL_WARNING("try to remove a NULL Pointer on the EObject manager"); + return; + } + int32_t findId = -1; + // check if the widget is not destroy : + for(int32_t iii=0; iii m_tmpList = m_eObjectDeletedList; + // direct delete of the current list ... + for(int32_t iii=0; iii +#include +#include + +namespace ewol { + namespace EObjectManager { + void Init( void); + void UnInit( void); + void Add( ewol::EObject* object); + void Rm( ewol::EObject* object); + void MarkToRemoved(ewol::EObject* object); + void RemoveAllMark(void); + }; +}; + +#endif + diff --git a/Sources/libewol/ewol/EObjectMessageMulticast.cpp b/Sources/libewol/ewol/EObjectMessageMulticast.cpp new file mode 100644 index 00000000..31991bda --- /dev/null +++ b/Sources/libewol/ewol/EObjectMessageMulticast.cpp @@ -0,0 +1,116 @@ +/** + ******************************************************************************* + * @file ewol/WidgetMessageMultiCast.cpp + * @brief basic ewol Widget Message Multi-cast (Sources) + * @author Edouard DUPIN + * @date 31/01/2012 + * @par Project + * ewol + * + * @par Copyright + * Copyright 2011 Edouard DUPIN, all right reserved + * + * This software is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY. + * + * Licence summary : + * You can modify and redistribute the sources code and binaries. + * You can send me the bug-fix + * + * Term of the licence in in the file licence.txt. + * + ******************************************************************************* + */ + +#include +#include + +#undef __class__ +#define __class__ "ewol::EObjectMessageMultiCast" + +extern "C" { + typedef struct { + const char* message; + ewol::EObject* object; + } messageList_ts; +}; + + +// internal element of the widget manager : +static etk::VectorType m_messageList; // all widget allocated ==> all time increment ... never removed ... + + +void ewol::EObjectMessageMultiCast::Init(void) +{ + EWOL_INFO("EObject message Multi-Cast"); +} + + +void ewol::EObjectMessageMultiCast::UnInit(void) +{ + EWOL_INFO("EObject message Multi-Cast"); + m_messageList.Clear(); +} + + +void ewol::EObjectMessageMultiCast::Add(ewol::EObject* object, const char* const message) +{ + if (NULL == object) { + EWOL_ERROR("Add with NULL object"); + return; + } + if (NULL == message) { + EWOL_ERROR("Add with NULL Message"); + return; + } + messageList_ts tmpMessage; + tmpMessage.object = object; + tmpMessage.message = message; + m_messageList.PushBack(tmpMessage); + EWOL_DEBUG("SendMulticast ADD listener :" << object->GetId() << " on \"" << message << "\"" ); +} + + +void ewol::EObjectMessageMultiCast::Rm(ewol::EObject* object) +{ + if (NULL == object) { + EWOL_ERROR("Rm with NULL object"); + return; + } + // send the message at all registered widget ... + for (int32_t iii=m_messageList.Size(); iii>=0; iii--) { + if(m_messageList[iii].object == object) { + EWOL_DEBUG("SendMulticast RM listener :" << object->GetId()); + m_messageList[iii].message = NULL; + m_messageList[iii].object = NULL; + m_messageList.Erase(iii); + } + } +} + +void ewol::EObjectMessageMultiCast::Send(ewol::EObject* object, const char* const message, int32_t data) +{ + etk::UString tmpData(data); + Send(object, message, tmpData); +} + + + +void ewol::EObjectMessageMultiCast::Send(ewol::EObject* object, const char* const message, etk::UString& data) +{ + EWOL_DEBUG("SendMulticast message \"" << message << "\" data=\"" << data << "\" to :"); + + // send the message at all registered widget ... + for (int32_t iii=0; iii + #define NB_BOUBLE_BUFFER (2) namespace ewol { @@ -46,6 +48,7 @@ namespace ewol { EVENT_INPUT_TYPE_UP, EVENT_INPUT_TYPE_ENTER, EVENT_INPUT_TYPE_LEAVE, + EVENT_INPUT_TYPE_ABORT, // SPecial event generate when an upper classes get an event ... (TBD) } eventInputType_te; typedef enum { @@ -93,13 +96,6 @@ namespace ewol { char* GetCharTypeMoveEvent(eventKbMoveType_te type); - - typedef struct { - const char * generateEventId; //!< event generate ID (to be unique it was pointer on the string name) - int32_t widgetCall; //!< unique ID of the widget - const char * generateEventIdExtern; //!< External generated event ID (to be unique it was pointer on the string name) - } eventExtern_ts; - typedef struct { coord2D_ts abs; coord2D_ts local; @@ -109,19 +105,12 @@ namespace ewol { - class Widget { + class Widget : public EObject { public: Widget(void); + // TODO : Set this in private if possible ... virtual ~Widget(void); - int32_t GetWidgetId(void); - private: - ewol::Widget * m_parrent; //!< parrent of the current widget (if NULL ==> this is the main node(root)) - public: - void SetParrent(ewol::Widget * newParrent) { m_parrent = newParrent; }; - void UnlinkParrent(void) { if (NULL != m_parrent) { m_parrent->removedChild(this); m_parrent=NULL; } }; - virtual void removedChild(ewol::Widget * removedChild) { }; - coord2D_ts GetRealOrigin(void); // this fnction call all the parrent to get his real position ... - + void MarkToRemove(void); // ---------------------------------------------------------------------------------------------------------------- // -- Widget Size: // ---------------------------------------------------------------------------------------------------------------- @@ -172,30 +161,12 @@ namespace ewol { virtual void OnGetFocus(void) {}; virtual void OnLostFocus(void) {}; - private: - etk::VectorType m_externEvent; //!< Generic list of event generation for output link - etk::VectorType m_ListEventAvaillable; //!< List of all event availlable for this widget public: // external acces to set an input event on this widget. bool GenEventInput(int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos); // call when input event arrive and call OnEventInput, if no event detected - bool GenEventInputExternal(const char * generateEventId, etkFloat_t x, etkFloat_t y); virtual bool GenEventShortCut(bool shift, bool control, bool alt, bool meta, uint32_t unicodeValue); - protected: - void AddEventId(const char * generateEventId) { - if (NULL != generateEventId) { - m_ListEventAvaillable.PushBack(generateEventId); - } - } - public: - // to link an extern widget at the internal event of this one it will access by here : - bool ExternLinkOnEvent(const char * eventName, int32_t widgetId, const char * eventExternId = NULL); protected: virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eventPosition_ts pos) { return false; }; - public: - // when an event arrive from an other widget, it will arrive here: - // TODO : change name ... - virtual bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y) { return false; }; - // ---------------------------------------------------------------------------------------------------------------- // -- Keboard event (when one is present or when a graphical is present // ---------------------------------------------------------------------------------------------------------------- @@ -211,15 +182,16 @@ namespace ewol { int8_t m_currentCreateId; //!< Id of the element might be modify bool m_needFlipFlop; //!< A flip flop need to be done bool m_needRegenerateDisplay; //!< the display might be done the next regeneration - virtual bool OnDraw(void) { return true; }; - protected: - void MarkToReedraw(void) { m_needRegenerateDisplay = true; }; - bool NeedRedraw(void) { bool tmpData=m_needRegenerateDisplay; m_needRegenerateDisplay=false; return tmpData; }; + void MarkToReedraw(void) { m_needRegenerateDisplay = true; }; + bool NeedRedraw(void) { bool tmpData=m_needRegenerateDisplay; m_needRegenerateDisplay=false; return tmpData; }; + public: + virtual void OnFlipFlopEvent(void); + public: + bool GenDraw(void); + protected: + virtual bool OnDraw(void) { return true; }; public: - void DoubleBufferFlipFlop(void); - virtual void OnFlipFlopEvent(void) { /* nothing to do */ }; virtual void OnRegenerateDisplay(void) { /* nothing to do */ }; - bool GenDraw(void); }; // end of the class Widget declaration };// end of nameSpace diff --git a/Sources/libewol/ewol/WidgetManager.cpp b/Sources/libewol/ewol/WidgetManager.cpp index 5eefb580..165ea788 100644 --- a/Sources/libewol/ewol/WidgetManager.cpp +++ b/Sources/libewol/ewol/WidgetManager.cpp @@ -27,19 +27,9 @@ #undef __class__ #define __class__ "ewol::WidgetManager" -extern "C" { - typedef struct { - int32_t widgetId; - ewol::Widget* widgetPointer; - } widgetList_ts; -}; - static pthread_mutex_t localMutex; static bool IsInit = false; -// internal element of the widget manager : -static etk::VectorType m_widgetList; // all widget allocated ==> all time increment ... never removed ... -static etk::VectorType m_widgetDeletedList; // all widget allocated // For the focus Management static ewol::Widget * m_focusWidgetDefault = NULL; static ewol::Widget * m_focusWidgetCurrent = NULL; @@ -51,7 +41,6 @@ void ewol::widgetManager::Init(void) int ret = pthread_mutex_init(&localMutex, NULL); EWOL_ASSERT(ret == 0, "Error creating Mutex ..."); // prevent android error ==> can create memory leak but I prefer - m_widgetList.Clear(); m_focusWidgetDefault = NULL; m_focusWidgetCurrent = NULL; IsInit = true; @@ -64,91 +53,15 @@ void ewol::widgetManager::UnInit(void) ewol::widgetManager::FocusSetDefault(NULL); ewol::widgetManager::FocusRelease(); - ewol::widgetManager::RemoveAllMarkWidget(); - - EWOL_INFO(" Remove missing user widget"); - while(0 this control the mutex Lock - ewol::widgetManager::RemoveAllMarkWidget(); - IsInit = false; int ret = pthread_mutex_destroy(&localMutex); EWOL_ASSERT(ret == 0, "Error destroying Mutex ..."); } -void ewol::widgetManager::Add(ewol::Widget * newWidget) -{ - static int32_t UniqueWidgetId = 0; - // Check existance - int32_t tmpID = ewol::widgetManager::Get(newWidget); - if (0 > tmpID) { - widgetList_ts tmpElement; - tmpElement.widgetId = UniqueWidgetId++; - tmpElement.widgetPointer = newWidget; - m_widgetList.PushBack(tmpElement); - } else { - EWOL_WARNING("Widget Already added to the widget manager, id=" << tmpID); - } -} - void ewol::widgetManager::Rm(ewol::Widget * newWidget) { - if (NULL == newWidget) { - EWOL_ERROR("Try to remove (NULL) Widget"); - return; - } - for (int32_t iii=0; iii widgetId) { - return NULL; - } - for(int32_t iii=0; iiiUnlinkParrent(); - // add ... - m_widgetDeletedList.PushBack(tmpWidgetProperty); -} - -void ewol::widgetManager::RemoveAllMarkWidget(void) -{ - etk::VectorType m_widgetDeletedList_tmp = m_widgetDeletedList; - /* - if (m_widgetDeletedList.Size() > 0 ) { - EWOL_DEBUG("NB element to remove : " << m_widgetDeletedList.Size()); - } - */ - // flip/Flop all the widget registered : - for(int32_t iii=0; iii 0 ) { - EWOL_CRITICAL("Memory leak ==> not all the widget are auto-removed nb = " << m_widgetDeletedList.Size()); - // in every case clean the list ... - m_widgetDeletedList.Clear(); - } - */ -} - diff --git a/Sources/libewol/ewol/WidgetManager.h b/Sources/libewol/ewol/WidgetManager.h index d75090fd..06169af4 100644 --- a/Sources/libewol/ewol/WidgetManager.h +++ b/Sources/libewol/ewol/WidgetManager.h @@ -35,10 +35,8 @@ namespace ewol { namespace widgetManager { void Init( void); void UnInit(void); - void Add( ewol::Widget * newWidget); + // need to call when remove a widget to clear all dependency of the focus system void Rm( ewol::Widget * newWidget); - int32_t Get( ewol::Widget * newWidget); - ewol::Widget * Get( int32_t widgetId); void FocusKeep( ewol::Widget * newWidget); // set the focus at the specific widget void FocusSetDefault(ewol::Widget * newWidget); // select the default focus getter @@ -46,18 +44,13 @@ namespace ewol { ewol::Widget * FocusGet( void); void FocusRemoveIfRemove(ewol::Widget * newWidget); - + // TODO : Remove this from here ... int32_t GetDoubleBufferCreate(void); int32_t GetDoubleBufferDraw(void); - void GetDoubleBufferFlipFlop(void); bool GetDoubleBufferNeedDraw(void); - void GetDoubleBufferStartDraw(void); - void GetDoubleBufferStopDraw(void); - - // For the multithreaded context the widget mus not de removed by the user ==> he might mark if to be remove later with a mutex protection... - void MarkWidgetToBeRemoved(int32_t widgetId); - void MarkWidgetToBeRemoved(ewol::Widget * expectedWidget); - void RemoveAllMarkWidget(void); + void SetDoubleBufferNeedDraw(void); + void DoubleBufferLock(void); + void DoubleBufferUnLock(void); }; }; diff --git a/Sources/libewol/ewol/WidgetMessageMultiCast.cpp b/Sources/libewol/ewol/WidgetMessageMultiCast.cpp deleted file mode 100644 index 4374ab3a..00000000 --- a/Sources/libewol/ewol/WidgetMessageMultiCast.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/** - ******************************************************************************* - * @file ewol/WidgetMessageMultiCast.cpp - * @brief basic ewol Widget Message Multi-cast (Sources) - * @author Edouard DUPIN - * @date 31/01/2012 - * @par Project - * ewol - * - * @par Copyright - * Copyright 2011 Edouard DUPIN, all right reserved - * - * This software is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY. - * - * Licence summary : - * You can modify and redistribute the sources code and binaries. - * You can send me the bug-fix - * - * Term of the licence in in the file licence.txt. - * - ******************************************************************************* - */ - -#include -#include - -#undef __class__ -#define __class__ "ewol::WidgetMessageMultiCast" - -extern "C" { - typedef struct { - int32_t widgetId; - const char* message; - } messageList_ts; -}; - - -// internal element of the widget manager : -static etk::VectorType m_messageList; // all widget allocated ==> all time increment ... never removed ... - - -void ewol::widgetMessageMultiCast::Init(void) -{ - EWOL_INFO("user widget message Multi-Cast"); -} - -void ewol::widgetMessageMultiCast::UnInit(void) -{ - EWOL_INFO("user widget message Multi-Cast"); - m_messageList.Clear(); -} - -void ewol::widgetMessageMultiCast::Add(int32_t widgetId, const char* const message) -{ - // TODO : Check if the message exist before ... - messageList_ts tmpMessage; - tmpMessage.widgetId = widgetId; - tmpMessage.message = message; - m_messageList.PushBack(tmpMessage); - EWOL_DEBUG("SendMulticast ADD listener :" << widgetId << " on \"" << message << "\"" ); -} - -// TODO : Do this better ... -void ewol::widgetMessageMultiCast::Rm(int32_t widgetId) -{ - // send the message at all registered widget ... - for (int32_t iii=0; iiiMarkToRemove(); m_subWidget[m_currentCreateId] = NULL; } m_subWidget[m_currentCreateId] = widget; @@ -226,23 +226,6 @@ void ewol::Windows::PopUpWidgetPush(ewol::Widget * widget) m_needFlipFlop = true; } -void ewol::Windows::PopUpWidgetPop(int32_t popUpId) -{ - if(popUpId >= 0) { - for(int32_t iii=0; iiiGetWidgetId() == popUpId) { - ewol::widgetManager::MarkWidgetToBeRemoved(m_popUpWidgetList[m_currentCreateId][iii]); - m_popUpWidgetList[m_currentCreateId][iii] = NULL; - m_popUpWidgetList[m_currentCreateId].Erase(iii); - m_needFlipFlop = true; - CalculateSize(m_size.x, m_size.y); - return; - } - } - } - } -} bool ewol::Windows::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y) { @@ -288,8 +271,21 @@ void ewol::Windows::KeyboardHide(void) void ewol::Windows::OnFlipFlopEvent(void) { - //EWOL_CRITICAL("FlipFlop on windows draw("<OnFlipFlopEvent(); + } + for(int32_t iii=0; iiiOnFlipFlopEvent(); + } + } +} diff --git a/Sources/libewol/ewol/Windows.h b/Sources/libewol/ewol/Windows.h index 28b92127..d3d9e5e5 100644 --- a/Sources/libewol/ewol/Windows.h +++ b/Sources/libewol/ewol/Windows.h @@ -73,7 +73,6 @@ namespace ewol { public: void SetSubWidget(ewol::Widget * widget); void PopUpWidgetPush(ewol::Widget * widget); - void PopUpWidgetPop(int32_t popUpId); protected: virtual bool OnDraw(void); public: diff --git a/Sources/libewol/ewol/base/MainThread.cpp b/Sources/libewol/ewol/base/MainThread.cpp index c0c43675..e7e2fa7a 100644 --- a/Sources/libewol/ewol/base/MainThread.cpp +++ b/Sources/libewol/ewol/base/MainThread.cpp @@ -180,8 +180,6 @@ static void* BaseAppEntry(void* param) if (0 == ewol::threadMsg::WaitingMessage(androidJniMsg)) { if (countNbEvent > 0) { EWOL_NativeRegenerateDisplay(); - // TODO : Generate the display here ... Instead of every time we call the sub-Widget ... - ewol::widgetManager::GetDoubleBufferFlipFlop(); countNbEvent = 0; } } diff --git a/Sources/libewol/ewol/base/gui.cpp b/Sources/libewol/ewol/base/gui.cpp index 073cc94c..603c2c69 100644 --- a/Sources/libewol/ewol/base/gui.cpp +++ b/Sources/libewol/ewol/base/gui.cpp @@ -48,12 +48,6 @@ int32_t ewol::GetCurrentHeight(void) return gui_height; } -void ewol::RmPopUp(int32_t widgetID) -{ - if (NULL != gui_uniqueWindows) { - gui_uniqueWindows->PopUpWidgetPop(widgetID); - } -} void ewol::PopUpWidgetPush(ewol::Widget * tmpWidget) { @@ -78,6 +72,9 @@ void EWOL_NativeRegenerateDisplay(void) //EWOL_INFO("Resize w=" << w << " h=" << h); if (NULL != gui_uniqueWindows) { gui_uniqueWindows->OnRegenerateDisplay(); + ewol::widgetManager::DoubleBufferLock(); + gui_uniqueWindows->OnFlipFlopEvent(); + ewol::widgetManager::DoubleBufferUnLock(); } } @@ -323,7 +320,7 @@ void EWOL_GenericDraw(bool everyTime) if ( (currentTime - startTime) > DISPLAY_PERIODE_MS) { display = true; } - ewol::widgetManager::GetDoubleBufferStartDraw(); + ewol::widgetManager::DoubleBufferLock(); if( true == ewol::widgetManager::GetDoubleBufferNeedDraw() || true == everyTime) { @@ -331,7 +328,7 @@ void EWOL_GenericDraw(bool everyTime) gui_uniqueWindows->SysDraw(); //EWOL_WARNING("DRAW..."); } - ewol::widgetManager::GetDoubleBufferStopDraw(); + ewol::widgetManager::DoubleBufferUnLock(); // send Message that we just finished a display ... EWOL_ThreadEventHasJustDisplay(); diff --git a/Sources/libewol/ewol/ewol.h b/Sources/libewol/ewol/ewol.h index 9018e6b0..19d60353 100644 --- a/Sources/libewol/ewol/ewol.h +++ b/Sources/libewol/ewol/ewol.h @@ -47,7 +47,6 @@ namespace ewol { void KeyboardHide(void); void ForceRedrawAll(void); void PopUpWidgetPush(ewol::Widget * tmpWidget); - void RmPopUp(int32_t widgetID); int32_t CmdLineNb(void); etk::UString CmdLineGet(int32_t id); diff --git a/Sources/libewol/ewol/widget/Button.cpp b/Sources/libewol/ewol/widget/Button.cpp index be9e4830..a7db4193 100644 --- a/Sources/libewol/ewol/widget/Button.cpp +++ b/Sources/libewol/ewol/widget/Button.cpp @@ -192,7 +192,7 @@ bool ewol::Button::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, ev || ewol::EVENT_INPUT_TYPE_DOUBLE == typeEvent || ewol::EVENT_INPUT_TYPE_TRIPLE == typeEvent) { // nothing to do ... - GenEventInputExternal(ewolEventButtonPressed, pos.abs.x, pos.abs.y); + GenerateEventId(ewolEventButtonPressed); MarkToReedraw(); return true; } @@ -206,7 +206,7 @@ bool ewol::Button::OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeDa //EWOL_DEBUG("BT PRESSED : \"" << UTF8_data << "\" size=" << strlen(UTF8_data)); if( typeEvent == ewol::EVENT_KB_TYPE_DOWN && unicodeData == '\r') { - GenEventInputExternal(ewolEventButtonEnter, -1, -1); + GenerateEventId(ewolEventButtonEnter); } return false; } diff --git a/Sources/libewol/ewol/widget/CheckBox.cpp b/Sources/libewol/ewol/widget/CheckBox.cpp index 58b2eebb..64192d0d 100644 --- a/Sources/libewol/ewol/widget/CheckBox.cpp +++ b/Sources/libewol/ewol/widget/CheckBox.cpp @@ -158,7 +158,7 @@ bool ewol::CheckBox::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, } else { m_value = true; } - GenEventInputExternal(ewolEventCheckBoxClicked, pos.abs.x, pos.abs.y); + GenerateEventId(ewolEventCheckBoxClicked); ewol::widgetManager::FocusKeep(this); MarkToReedraw(); return true; @@ -181,7 +181,8 @@ bool ewol::CheckBox::OnEventKb(eventKbType_te typeEvent, uniChar_t unicodeData) m_value = true; } MarkToReedraw(); - return GenEventInputExternal(ewolEventCheckBoxClicked, -1,-1); + GenerateEventId(ewolEventCheckBoxClicked); + return true; } return false; } diff --git a/Sources/libewol/ewol/widget/ContextMenu.cpp b/Sources/libewol/ewol/widget/ContextMenu.cpp index 72362f52..59fbb25d 100644 --- a/Sources/libewol/ewol/widget/ContextMenu.cpp +++ b/Sources/libewol/ewol/widget/ContextMenu.cpp @@ -57,12 +57,15 @@ ewol::ContextMenu::ContextMenu(void) ewol::ContextMenu::~ContextMenu(void) { + /* SubWidgetRemove(); + */ } bool ewol::ContextMenu::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY) { + /* EWOL_DEBUG("CalculateSize(" << availlableX << "," << availlableY << ")"); // pop-up fill all the display : m_size.x = availlableX; @@ -129,12 +132,14 @@ bool ewol::ContextMenu::CalculateSize(etkFloat_t availlableX, etkFloat_t availla m_subWidget->CalculateSize(subWidgetSize.x, subWidgetSize.y); } MarkToReedraw(); + */ return true; } bool ewol::ContextMenu::CalculateMinSize(void) { + /* EWOL_DEBUG("CalculateMinSize"); m_userExpendX=false; m_userExpendY=false; @@ -148,6 +153,7 @@ bool ewol::ContextMenu::CalculateMinSize(void) } EWOL_DEBUG("CalculateMinSize(" << m_minSize.x << "," << m_minSize.y << ")"); MarkToReedraw(); + */ return true; } @@ -169,34 +175,41 @@ void ewol::ContextMenu::SetExpendY(bool newExpend) void ewol::ContextMenu::SubWidgetSet(ewol::Widget* newWidget) { + /* if (NULL == newWidget) { return; } m_subWidget = newWidget; newWidget->SetParrent(this); + */ } void ewol::ContextMenu::SubWidgetRemove(void) { + /* if (NULL != m_subWidget) { ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget); m_subWidget = NULL; } + */ } bool ewol::ContextMenu::OnDraw(void) { + /* ewol::Drawable::OnDraw(); if (NULL != m_subWidget) { m_subWidget->GenDraw(); } + */ return true; } void ewol::ContextMenu::OnRegenerateDisplay(void) { + /* if (true == NeedRedraw()) { } // generate a white background and take gray on other surfaces @@ -240,11 +253,13 @@ void ewol::ContextMenu::OnRegenerateDisplay(void) if (NULL != m_subWidget) { m_subWidget->OnRegenerateDisplay(); } + */ } bool ewol::ContextMenu::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eventPosition_ts pos) { + /* if (NULL != m_subWidget) { coord2D_ts tmpSize = m_subWidget->GetSize(); coord2D_ts tmpOrigin = m_subWidget->GetOrigin(); @@ -269,14 +284,17 @@ bool ewol::ContextMenu::OnEventInput(int32_t IdInput, eventInputType_te typeEven } } + */ return true; } void ewol::ContextMenu::SetPositionMark(markPosition_te position, coord2D_ts arrowPos) { + /* EWOL_DEBUG("set context menu at the position : (" << arrowPos.x << "," << arrowPos.y << ")"); m_arrawBorder = position; m_arrowPos = arrowPos; MarkToReedraw(); + */ } diff --git a/Sources/libewol/ewol/widget/Entry.cpp b/Sources/libewol/ewol/widget/Entry.cpp index a6b9b3a9..a3110234 100644 --- a/Sources/libewol/ewol/widget/Entry.cpp +++ b/Sources/libewol/ewol/widget/Entry.cpp @@ -177,7 +177,7 @@ bool ewol::Entry::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eve if (1 == IdInput) { if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) { // nothing to do ... - GenEventInputExternal(ewolEventEntryClick, pos.abs.x, pos.abs.y); + GenerateEventId(ewolEventEntryClick); ewol::widgetManager::FocusKeep(this); MarkToReedraw(); return true; @@ -202,7 +202,7 @@ bool ewol::Entry::OnEventKb(eventKbType_te typeEvent, uniChar_t unicodeData) unicode::convertUnicodeToUtf8(unicodeData, UTF8_data); m_data += UTF8_data; } - GenEventInputExternal(ewolEventEntryModify, -1, -1); + GenerateEventId(ewolEventEntryModify); UpdateTextPosition(); MarkToReedraw(); return true; diff --git a/Sources/libewol/ewol/widget/Label.cpp b/Sources/libewol/ewol/widget/Label.cpp index 205e5ce8..a2fe930d 100644 --- a/Sources/libewol/ewol/widget/Label.cpp +++ b/Sources/libewol/ewol/widget/Label.cpp @@ -126,7 +126,7 @@ bool ewol::Label::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eve if (1 == IdInput) { if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) { // nothing to do ... - GenEventInputExternal(ewolEventLabelPressed, pos.abs.x, pos.abs.y); + GenerateEventId(ewolEventLabelPressed); return true; } } diff --git a/Sources/libewol/ewol/widget/Menu.cpp b/Sources/libewol/ewol/widget/Menu.cpp index 399dba4b..53170d4d 100644 --- a/Sources/libewol/ewol/widget/Menu.cpp +++ b/Sources/libewol/ewol/widget/Menu.cpp @@ -25,7 +25,7 @@ #include -#include +#include #include #include #include @@ -37,8 +37,8 @@ ewol::Menu::Menu(void) { - m_staticId = 0; - m_popUpId = -1; + m_staticPointer = NULL; + m_widgetPopUp = NULL; } ewol::Menu::~Menu(void) @@ -68,6 +68,7 @@ void ewol::Menu::SubWidgetUnLink(ewol::Widget* newWidget) void ewol::Menu::Clear(void) { + /* for( int32_t iii=0; iii < m_listElement.Size(); iii++) { if (m_listElement[iii] != NULL) { delete(m_listElement[iii]); @@ -75,6 +76,7 @@ void ewol::Menu::Clear(void) } } m_listElement.Clear(); + */ } int32_t ewol::Menu::AddTitle(etk::UString label, etk::UString image, const char * generateEvent, const etk::UString message) @@ -84,6 +86,7 @@ int32_t ewol::Menu::AddTitle(etk::UString label, etk::UString image, const char int32_t ewol::Menu::Add(int32_t parent, etk::UString label, etk::UString image, const char * generateEvent, const etk::UString message) { +/* ewol::MenuElement * tmpObject = new ewol::MenuElement(); if (NULL == tmpObject) { EWOL_ERROR("Allocation problem"); @@ -109,6 +112,8 @@ int32_t ewol::Menu::Add(int32_t parent, etk::UString label, etk::UString image, tmpObject->m_widgetId = myButton->GetWidgetId(); } return tmpObject->m_localId; +*/ + return 0; } void ewol::Menu::AddSpacer(void) @@ -119,17 +124,21 @@ void ewol::Menu::AddSpacer(void) bool ewol::Menu::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y) { + /* if (true == ewol::SizerHori::OnEventAreaExternal(widgetID, generateEventId, data, x, y)) { return true; } + */ + /* if (NULL==data && generateEventId==ewolEventButtonPressed) { for(int32_t iii=0; iiim_widgetId) { // 2 posible case if (m_listElement[iii]->m_generateEvent != NULL) { - ewol::widgetMessageMultiCast::Send(GetWidgetId(), m_listElement[iii]->m_generateEvent, m_listElement[iii]->m_message); - ewol::RmPopUp(m_popUpId); - m_popUpId = -1; + // TODO : Later ... + //ewol::widgetMessageMultiCast::Send(GetWidgetId(), m_listElement[iii]->m_generateEvent, m_listElement[iii]->m_message); + m_widgetPopUp->MarkToRemove(); + m_widgetPopUp = NULL; return true; } else { bool findChild = false; @@ -178,20 +187,21 @@ bool ewol::Menu::OnEventAreaExternal(int32_t widgetID, const char * generateEven if (NULL == myButton) { EWOL_ERROR("Allocation Error"); } - m_listElement[jjj]->m_widgetId = myButton->GetWidgetId(); - myButton->ExternLinkOnEvent(ewolEventButtonPressed, GetWidgetId(), ewolEventButtonPressed); + m_listElement[jjj]->m_widgetPointer = myButton; + myButton->RegisterOnEvent(this, ewolEventButtonPressed, ewolEventButtonPressed, ""); myButton->SetExpendX(true); myButton->SetFillX(true); myButton->SetAlignement(ewol::TEXT_ALIGN_LEFT); mySizerVert->SubWidgetAdd(myButton); } } - m_popUpId = tmpWidget->GetWidgetId(); - ewol::PopUpWidgetPush(tmpWidget); + m_staticPointer = tmpWidget; + ewol::PopUpWidgetPush(m_staticPointer); } return true; } } } + */ return false; } diff --git a/Sources/libewol/ewol/widget/Menu.h b/Sources/libewol/ewol/widget/Menu.h index b9742127..b83152bc 100644 --- a/Sources/libewol/ewol/widget/Menu.h +++ b/Sources/libewol/ewol/widget/Menu.h @@ -37,7 +37,7 @@ namespace ewol { public : int32_t m_localId; int32_t m_parentId; - int32_t m_widgetId; + ewol::EObject* m_widgetPointer; etk::UString m_label; etk::UString m_image; const char * m_generateEvent; @@ -55,8 +55,8 @@ namespace ewol { virtual void SubWidgetUnLink(ewol::Widget* newWidget); private: etk::VectorType m_listElement; - int32_t m_staticId; - int32_t m_popUpId; + ewol::EObject* m_staticPointer; + ewol::EObject* m_widgetPopUp; public: void Clear(void); int32_t AddTitle(etk::UString label, etk::UString image="", const char * generateEvent = NULL, const etk::UString message = ""); diff --git a/Sources/libewol/ewol/widget/PopUp.cpp b/Sources/libewol/ewol/widget/PopUp.cpp index 39f646d8..11495a6c 100644 --- a/Sources/libewol/ewol/widget/PopUp.cpp +++ b/Sources/libewol/ewol/widget/PopUp.cpp @@ -54,6 +54,7 @@ ewol::PopUp::~PopUp(void) bool ewol::PopUp::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY) { + /* //EWOL_DEBUG("CalculateSize(" << availlableX << "," << availlableY << ")"); // pop-up fill all the display : m_size.x = availlableX; @@ -84,12 +85,14 @@ bool ewol::PopUp::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY) m_subWidget[m_currentCreateId]->CalculateSize(subWidgetSize.x, subWidgetSize.y); } MarkToReedraw(); + */ return true; } bool ewol::PopUp::CalculateMinSize(void) { + /* //EWOL_DEBUG("CalculateMinSize"); m_userExpendX=false; m_userExpendY=false; @@ -103,6 +106,7 @@ bool ewol::PopUp::CalculateMinSize(void) } //EWOL_DEBUG("CalculateMinSize(" << m_minSize.x << "," << m_minSize.y << ")"); MarkToReedraw(); + */ return true; } @@ -124,35 +128,42 @@ void ewol::PopUp::SetExpendY(bool newExpend) void ewol::PopUp::SubWidgetSet(ewol::Widget* newWidget) { + /* if (NULL == newWidget) { return; } m_subWidget[m_currentCreateId] = newWidget; newWidget->SetParrent(this); + */ } void ewol::PopUp::SubWidgetRemove(void) { + /* if (NULL != m_subWidget[m_currentCreateId]) { ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget[m_currentCreateId]); m_subWidget[m_currentCreateId] = NULL; } + */ } bool ewol::PopUp::OnDraw(void) { + /* // draw upper classes ewol::Drawable::OnDraw(); if (NULL != m_subWidget[m_currentDrawId]) { m_subWidget[m_currentDrawId]->GenDraw(); } + */ return true; } void ewol::PopUp::OnRegenerateDisplay(void) { + /* if (true == NeedRedraw()) { } // generate a white background and take gray on other surfaces @@ -172,11 +183,13 @@ void ewol::PopUp::OnRegenerateDisplay(void) if (NULL != m_subWidget[m_currentCreateId]) { m_subWidget[m_currentCreateId]->OnRegenerateDisplay(); } + */ } bool ewol::PopUp::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eventPosition_ts pos) { + /* if (NULL != m_subWidget[m_currentCreateId]) { coord2D_ts tmpSize = m_subWidget[m_currentCreateId]->GetSize(); coord2D_ts tmpOrigin = m_subWidget[m_currentCreateId]->GetOrigin(); @@ -189,19 +202,29 @@ bool ewol::PopUp::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eve } } + */ return true; } void ewol::PopUp::SetDisplayRatio(etkFloat_t ratio) { + /* m_displayRatio = ratio; + */ } - void ewol::PopUp::OnFlipFlopEvent(void) { - // keep in the current element all the modification done ... - m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId]; + bool needFlipFlop = m_needFlipFlop; + // call herited classes + ewol::Widget::OnFlipFlopEvent(); + // internal saving + if (true == needFlipFlop) { + m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId]; + } + // in every case, we propagate the flip-flop EVENT + if(NULL != m_subWidget[m_currentDrawId]) { + m_subWidget[m_currentDrawId]->OnFlipFlopEvent(); + } } - diff --git a/Sources/libewol/ewol/widget/SizerHori.cpp b/Sources/libewol/ewol/widget/SizerHori.cpp index 9fd630ca..e7804bff 100644 --- a/Sources/libewol/ewol/widget/SizerHori.cpp +++ b/Sources/libewol/ewol/widget/SizerHori.cpp @@ -164,7 +164,7 @@ void ewol::SizerHori::SubWidgetRemoveAll(void) { for (int32_t iii=0; iiiMarkToRemove(); m_subWidget[m_currentCreateId][iii] = NULL; } } @@ -178,7 +178,6 @@ void ewol::SizerHori::SubWidgetAdd(ewol::Widget* newWidget) return; } m_subWidget[m_currentCreateId].PushBack(newWidget); - newWidget->SetParrent(this); } @@ -190,7 +189,7 @@ void ewol::SizerHori::SubWidgetRemove(ewol::Widget* newWidget) for (int32_t iii=0; iiiMarkToRemove(); m_subWidget[m_currentCreateId][iii] = NULL; } m_subWidget[m_currentCreateId].Erase(iii); @@ -254,8 +253,18 @@ bool ewol::SizerHori::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, void ewol::SizerHori::OnFlipFlopEvent(void) { - // keep in the current element all the modification done ... - m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId]; + bool needFlipFlop = m_needFlipFlop; + // call herited classes + ewol::Widget::OnFlipFlopEvent(); + // internal saving + if (true == needFlipFlop) { + m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId]; + } + // in every case, we propagate the flip-flop EVENT + for(int32_t iii=0; iiiOnFlipFlopEvent(); + } + } } - diff --git a/Sources/libewol/ewol/widget/SizerVert.cpp b/Sources/libewol/ewol/widget/SizerVert.cpp index 28b6937c..cfc61280 100644 --- a/Sources/libewol/ewol/widget/SizerVert.cpp +++ b/Sources/libewol/ewol/widget/SizerVert.cpp @@ -166,7 +166,7 @@ void ewol::SizerVert::LockExpendContamination(bool lockExpend) void ewol::SizerVert::SubWidgetRemoveAll(void) { for (int32_t iii=0; iiiMarkToRemove(); m_subWidget[m_currentCreateId][iii] = NULL; } m_subWidget[m_currentCreateId].Clear(); @@ -179,7 +179,6 @@ void ewol::SizerVert::SubWidgetAdd(ewol::Widget* newWidget) return; } m_subWidget[m_currentCreateId].PushBack(newWidget); - newWidget->SetParrent(this); } @@ -190,7 +189,7 @@ void ewol::SizerVert::SubWidgetRemove(ewol::Widget* newWidget) } for (int32_t iii=0; iiiMarkToRemove(); m_subWidget[m_currentCreateId][iii] = NULL; m_subWidget[m_currentCreateId].Erase(iii); return; @@ -253,7 +252,18 @@ bool ewol::SizerVert::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, void ewol::SizerVert::OnFlipFlopEvent(void) { - // keep in the current element all the modification done ... - m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId]; + bool needFlipFlop = m_needFlipFlop; + // call herited classes + ewol::Widget::OnFlipFlopEvent(); + // internal saving + if (true == needFlipFlop) { + m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId]; + } + // in every case, we propagate the flip-flop EVENT + for(int32_t iii=0; iiiOnFlipFlopEvent(); + } + } } diff --git a/Sources/libewol/ewol/widgetMeta/FileChooser.cpp b/Sources/libewol/ewol/widgetMeta/FileChooser.cpp index 13b5ebe5..d1e12617 100644 --- a/Sources/libewol/ewol/widgetMeta/FileChooser.cpp +++ b/Sources/libewol/ewol/widgetMeta/FileChooser.cpp @@ -184,7 +184,8 @@ class FileChooserFolderList : public ewol::List if (1 == IdInput) { if (m_selectedLine >=0 ) { // generate event extern : - return GenEventInputExternal(ewolEventFileChooserSelectFolder, x, y); + GenerateEventId(ewolEventFileChooserSelectFolder); + return true; } } } @@ -307,7 +308,8 @@ class FileChooserFileList : public ewol::List MarkToReedraw(); if (m_selectedLine >=0 ) { // generate event extern : - return GenEventInputExternal(ewolEventFileChooserSelectFile, x, y); + GenerateEventId(ewolEventFileChooserSelectFile); + return true; } return true; } @@ -317,7 +319,8 @@ class FileChooserFileList : public ewol::List if (1 == IdInput) { if (m_selectedLine >=0 ) { // generate event extern : - return GenEventInputExternal(ewolEventFileChooserValidateFile, x, y); + GenerateEventId(ewolEventFileChooserValidateFile); + return true; } } } @@ -341,6 +344,7 @@ extern const char * const ewolEventFileChooserEntryFile = "ewol-event-file ewol::FileChooser::FileChooser(void) { + /* AddEventId(ewolEventFileChooserCancel); AddEventId(ewolEventFileChooserValidate); @@ -455,6 +459,7 @@ ewol::FileChooser::FileChooser(void) // set the default Folder properties: UpdateCurrentFolder(); + */ } @@ -466,51 +471,62 @@ ewol::FileChooser::~FileChooser(void) void ewol::FileChooser::SetTitle(etk::UString label) { + /* ewol::Label * tmpWidget = dynamic_cast(ewol::widgetManager::Get(m_widgetTitleId)); if (NULL == tmpWidget) { return; } tmpWidget->SetLabel(label); + */ } void ewol::FileChooser::SetValidateLabel(etk::UString label) { + /* ewol::Button * tmpWidget = dynamic_cast(ewol::widgetManager::Get(m_widgetValidateId)); if (NULL == tmpWidget) { return; } tmpWidget->SetLabel(label); + */ } void ewol::FileChooser::SetCancelLabel(etk::UString label) { + /* ewol::Button * tmpWidget = dynamic_cast(ewol::widgetManager::Get(m_widgetCancelId)); if (NULL == tmpWidget) { return; } tmpWidget->SetLabel(label); + */ } void ewol::FileChooser::SetFolder(etk::UString folder) { + /* m_folder = folder; UpdateCurrentFolder(); + */ } void ewol::FileChooser::SetFileName(etk::UString filename) { + /* m_file = filename; ewol::Entry * tmpWidget = dynamic_cast(ewol::widgetManager::Get(m_widgetCurrentFileNameId)); if (NULL == tmpWidget) { return; } tmpWidget->SetValue(filename); + */ } bool ewol::FileChooser::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y) { + /* EWOL_INFO("Receive Event from the LIST ... : widgetid=" << widgetID << "\"" << generateEventId << "\" ==> data=\"" << data << "\"" ); if (ewolEventFileChooserEntryFolder == generateEventId) { //==> change the folder name @@ -571,6 +587,7 @@ bool ewol::FileChooser::OnEventAreaExternal(int32_t widgetID, const char * gener ewol::RmPopUp(GetWidgetId()); return tmppp; } + */ return false; }; @@ -578,6 +595,7 @@ bool ewol::FileChooser::OnEventAreaExternal(int32_t widgetID, const char * gener void ewol::FileChooser::UpdateCurrentFolder(void) { + /* FileChooserFileList * myListFile = dynamic_cast(ewol::widgetManager::Get(m_widgetListFileId)); FileChooserFolderList * myListFolder = dynamic_cast(ewol::widgetManager::Get(m_widgetListFolderId)); ewol::Entry * myEntry = dynamic_cast(ewol::widgetManager::Get(m_widgetCurrentFolderId)); @@ -625,16 +643,19 @@ void ewol::FileChooser::UpdateCurrentFolder(void) myListFile->EndGenerating(); myListFolder->EndGenerating(); MarkToReedraw(); + */ } etk::UString ewol::FileChooser::GetCompleateFileName(void) { + /* etk::UString tmpString = m_folder; tmpString += "/"; tmpString += m_file; return tmpString; + */ } diff --git a/Sources/libewol/ewol/widgetMeta/Keyboard.cpp b/Sources/libewol/ewol/widgetMeta/Keyboard.cpp index 6fe59765..a5d64e98 100644 --- a/Sources/libewol/ewol/widgetMeta/Keyboard.cpp +++ b/Sources/libewol/ewol/widgetMeta/Keyboard.cpp @@ -51,21 +51,25 @@ extern const char * const ewolEventKeyEvent = "ewol event internal key event"; ewol::Keyboard::Keyboard(void) { + /* // set event that can propagate outside .... AddEventId(ewolEventKeyboardHide); m_mode = KEYBOARD_MODE_TEXT; m_isHide = true; SetMode(m_mode); + */ } ewol::Keyboard::~Keyboard(void) { + /* if (NULL != m_subWidget) { ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget); m_subWidget = NULL; } + */ } #define ADD_BUTTON(upperWidget,widget,text,event) do { \ @@ -82,6 +86,7 @@ ewol::Keyboard::~Keyboard(void) void ewol::Keyboard::SetMode(keyboardMode_te mode) { + /* ewol::SizerVert * mySizerVert = NULL; ewol::SizerHori * mySizerHori = NULL; @@ -177,12 +182,13 @@ void ewol::Keyboard::SetMode(keyboardMode_te mode) myButton->SetExpendX(false); ADD_BUTTON(mySizerHori,myButton,"Ctrl",ewolEventKeyEvent); myButton->SetExpendX(false); - + */ } bool ewol::Keyboard::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y) { + /* EWOL_INFO("Receive Event from the Keyboard ... : widgetid=" << widgetID << "\"" << generateEventId << "\" ==> internalEvent=\"" << data << "\"" ); if (ewolEventKeyEvent == generateEventId) { ewol::Button * bt = dynamic_cast(ewol::widgetManager::Get(widgetID)); @@ -207,6 +213,7 @@ bool ewol::Keyboard::OnEventAreaExternal(int32_t widgetID, const char * generate } //return GenEventInputExternal(eventExternId, x, y); return true; + */ }; @@ -228,6 +235,7 @@ void ewol::Keyboard::SetExpendY(bool newExpend) bool ewol::Keyboard::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY) { + /* //EWOL_DEBUG("CalculateSize(" << availlableX << "," << availlableY << ")"); // pop-up fill all the display : m_size.x = availlableX; @@ -250,12 +258,14 @@ bool ewol::Keyboard::CalculateSize(etkFloat_t availlableX, etkFloat_t availlable m_subWidget->CalculateSize(subWidgetSize.x, subWidgetSize.y); } MarkToReedraw(); + */ return true; } bool ewol::Keyboard::CalculateMinSize(void) { + /* m_userExpendX=false; m_userExpendY=false; m_minSize.x = 50.0; @@ -267,6 +277,7 @@ bool ewol::Keyboard::CalculateMinSize(void) m_minSize.y = tmpSize.y; } //EWOL_DEBUG("CalculateMinSize(" << m_minSize.x << "," << m_minSize.y << ")"); + */ return true; } @@ -274,15 +285,18 @@ bool ewol::Keyboard::CalculateMinSize(void) bool ewol::Keyboard::OnDraw(void) { + /* if (NULL != m_subWidget) { m_subWidget->GenDraw(); } + */ return true; } void ewol::Keyboard::OnRegenerateDisplay(void) { + /* if (true == NeedRedraw()) { color_ts mycolor; mycolor.red = 1.0; @@ -299,13 +313,16 @@ void ewol::Keyboard::OnRegenerateDisplay(void) if (NULL != m_subWidget) { m_subWidget->OnRegenerateDisplay(); } + */ } bool ewol::Keyboard::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eventPosition_ts pos) { + /* if (NULL != m_subWidget) { return m_subWidget->GenEventInput(IdInput, typeEvent, pos.abs); } + */ return false; } diff --git a/Sources/libewol/ewol/widgetMeta/StdPopUp.h b/Sources/libewol/ewol/widgetMeta/StdPopUp.h index 20b7086c..c97373ad 100644 --- a/Sources/libewol/ewol/widgetMeta/StdPopUp.h +++ b/Sources/libewol/ewol/widgetMeta/StdPopUp.h @@ -28,13 +28,15 @@ #include #include #include +#include +#include -extern const char * const ewolEventFileStdPopUpCancel; -extern const char * const ewolEventFileStdPopUpValidate; extern const char * const ewolEventFileStdPopUpButton1; extern const char * const ewolEventFileStdPopUpButton2; extern const char * const ewolEventFileStdPopUpButton3; extern const char * const ewolEventFileStdPopUpButton4; +extern const char * const ewolEventFileStdPopUpButton5; +extern const char * const ewolEventFileStdPopUpButton6; namespace ewol { class StdPopUp : public ewol::PopUp @@ -43,18 +45,13 @@ namespace ewol { StdPopUp(void); ~StdPopUp(void); virtual bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y); - void SetTitle(etk::UString label); - void SetValidateLabel(etk::UString label); - void SetCancelLabel(etk::UString label); - void SetFolder(etk::UString folder); + void SetTitle(etk::UString text); + void SetComment(etk::UString text); + void SetButtonLabel(int32_t btId, etk::UString text); // note : if no label no bt... private: - int32_t m_widgetTitleId; - int32_t m_widgetValidateId; - int32_t m_widgetCancelId; - int32_t m_widgetCurrentFolderId; - int32_t m_widgetListFolderId; - int32_t m_widgetListFileId; - etk::UString m_folder; + ewol::widget::Label* m_title; + ewol::widget::Label* m_comment; + ewol::widget::Button* m_button[6]; }; }; diff --git a/Sources/libewol/file.mk b/Sources/libewol/file.mk index 2611ffba..ae65bcb5 100644 --- a/Sources/libewol/file.mk +++ b/Sources/libewol/file.mk @@ -6,6 +6,8 @@ FILE_LIST = ewol/ewol.cpp \ ewol/base/gui.cpp \ ewol/Debug.cpp \ ewol/EObject.cpp \ + ewol/EObjectManager.cpp \ + ewol/EObjectMessageMulticast.cpp \ ewol/OObject.cpp \ ewol/OObject/2DText.cpp \ ewol/OObject/2DTextColored.cpp \ @@ -16,7 +18,6 @@ FILE_LIST = ewol/ewol.cpp \ ewol/FontFreeType.cpp \ ewol/Widget.cpp \ ewol/WidgetManager.cpp \ - ewol/WidgetMessageMultiCast.cpp \ ewol/Windows.cpp \ ewol/ShortCutManager.cpp \ ewol/widget/WidgetScrolled.cpp \