[DEV] add doc and better code

This commit is contained in:
Edouard DUPIN 2016-03-15 22:01:19 +01:00
parent 7bddada9b8
commit 34357ed6eb
7 changed files with 160 additions and 85 deletions

View File

@ -46,8 +46,9 @@ bool ewol::context::InputManager::localEventInput(enum gale::key::type _type,
int32_t _IdInput, int32_t _IdInput,
enum gale::key::status _status, enum gale::key::status _status,
vec2 _pos) { vec2 _pos) {
if (nullptr != _destWidget) { if (_destWidget != nullptr) {
if (_type == gale::key::type_mouse || _type == gale::key::type_finger) { if ( _type == gale::key::type_mouse
|| _type == gale::key::type_finger) {
// create the system Event : // create the system Event :
ewol::event::InputSystem tmpEventSystem(_type, _status, _IdInput, _pos, _destWidget, 0, m_specialKey); // TODO : set the real ID ... ewol::event::InputSystem tmpEventSystem(_type, _status, _IdInput, _pos, _destWidget, 0, m_specialKey); // TODO : set the real ID ...
// generate the event : // generate the event :
@ -62,7 +63,7 @@ bool ewol::context::InputManager::localEventInput(enum gale::key::type _type,
void ewol::context::InputManager::abortElement(InputPoperty *_eventTable, void ewol::context::InputManager::abortElement(InputPoperty *_eventTable,
int32_t _idInput, int32_t _idInput,
enum gale::key::type _type) { enum gale::key::type _type) {
if (nullptr == _eventTable) { if (_eventTable == nullptr) {
return; return;
} }
if (_eventTable[_idInput].isUsed == true) { if (_eventTable[_idInput].isUsed == true) {
@ -76,7 +77,7 @@ void ewol::context::InputManager::abortElement(InputPoperty *_eventTable,
void ewol::context::InputManager::cleanElement(InputPoperty *_eventTable, void ewol::context::InputManager::cleanElement(InputPoperty *_eventTable,
int32_t _idInput) { int32_t _idInput) {
if (nullptr == _eventTable) { if (_eventTable == nullptr) {
return; return;
} }
//EWOL_INFO("CleanElement[" << idInput << "] = @" << (int64_t)eventTable); //EWOL_INFO("CleanElement[" << idInput << "] = @" << (int64_t)eventTable);
@ -215,7 +216,8 @@ void ewol::context::InputManager::motion(enum gale::key::type _type,
} }
ewol::widget::WindowsShared tmpWindows = m_context.getWindows(); ewol::widget::WindowsShared tmpWindows = m_context.getWindows();
// special case for the mouse event 0 that represent the hover event of the system : // special case for the mouse event 0 that represent the hover event of the system :
if (_type == gale::key::type_mouse && _pointerID == 0) { if ( _type == gale::key::type_mouse
&& _pointerID == 0) {
// this event is all time on the good widget ... and manage the enter and leave ... // this event is all time on the good widget ... and manage the enter and leave ...
// NOTE : the "layer widget" force us to get the widget at the specific position all the time : // NOTE : the "layer widget" force us to get the widget at the specific position all the time :
ewol::WidgetShared tmpWidget; ewol::WidgetShared tmpWidget;
@ -223,12 +225,12 @@ void ewol::context::InputManager::motion(enum gale::key::type _type,
// grab all events ... // grab all events ...
tmpWidget = m_grabWidget.lock(); tmpWidget = m_grabWidget.lock();
} else { } else {
if (nullptr != tmpWindows) { if (tmpWindows != nullptr) {
tmpWidget = tmpWindows->getWidgetAtPos(_pos); tmpWidget = tmpWindows->getWidgetAtPos(_pos);
} }
} }
if( tmpWidget != eventTable[_pointerID].curentWidgetEvent.lock() if( tmpWidget != eventTable[_pointerID].curentWidgetEvent.lock()
|| ( true == eventTable[_pointerID].isInside || ( eventTable[_pointerID].isInside == true
&& ( eventTable[_pointerID].origin.x() > _pos.x() && ( eventTable[_pointerID].origin.x() > _pos.x()
|| eventTable[_pointerID].origin.y() > _pos.y() || eventTable[_pointerID].origin.y() > _pos.y()
|| (eventTable[_pointerID].origin.x() + eventTable[_pointerID].size.x()) < _pos.x() || (eventTable[_pointerID].origin.x() + eventTable[_pointerID].size.x()) < _pos.x()
@ -273,8 +275,8 @@ void ewol::context::InputManager::motion(enum gale::key::type _type,
eventTable[_pointerID].destinationInputId, eventTable[_pointerID].destinationInputId,
gale::key::status_move, gale::key::status_move,
_pos); _pos);
} else if (true == eventTable[_pointerID].isUsed) { } else if (eventTable[_pointerID].isUsed == true) {
if (true == eventTable[_pointerID].isInside) { if (eventTable[_pointerID].isInside == true) {
if( eventTable[_pointerID].origin.x() > _pos.x() if( eventTable[_pointerID].origin.x() > _pos.x()
|| eventTable[_pointerID].origin.y() > _pos.y() || eventTable[_pointerID].origin.y() > _pos.y()
|| (eventTable[_pointerID].origin.x() + eventTable[_pointerID].size.x()) < _pos.x() || (eventTable[_pointerID].origin.x() + eventTable[_pointerID].size.x()) < _pos.x()
@ -322,9 +324,8 @@ void ewol::context::InputManager::motion(enum gale::key::type _type,
void ewol::context::InputManager::state(enum gale::key::type _type, void ewol::context::InputManager::state(enum gale::key::type _type,
int _pointerID, int _pointerID,
bool _isDown, bool _isDown,
vec2 _pos) vec2 _pos) {
{ if (_pointerID >= MAX_MANAGE_INPUT) {
if (MAX_MANAGE_INPUT <= _pointerID) {
// reject pointer == > out of IDs... // reject pointer == > out of IDs...
return; return;
} }
@ -351,11 +352,11 @@ void ewol::context::InputManager::state(enum gale::key::type _type,
int64_t currentTime = ewol::getTime(); int64_t currentTime = ewol::getTime();
ewol::widget::WindowsShared tmpWindows = m_context.getWindows(); ewol::widget::WindowsShared tmpWindows = m_context.getWindows();
if (true == _isDown) { if (_isDown == true) {
EVENT_DEBUG("GUI : Input ID=" << _pointerID EVENT_DEBUG("GUI : Input ID=" << _pointerID
<< " == >" << eventTable[_pointerID].destinationInputId << " == >" << eventTable[_pointerID].destinationInputId
<< " [DOWN] " << _pos); << " [DOWN] " << _pos);
if(true == eventTable[_pointerID].isUsed) { if(eventTable[_pointerID].isUsed == true) {
// we have an event previously ... check delay between click and offset position // we have an event previously ... check delay between click and offset position
if (currentTime - eventTable[_pointerID].lastTimeEvent > localLimit.sepatateTime) { if (currentTime - eventTable[_pointerID].lastTimeEvent > localLimit.sepatateTime) {
cleanElement(eventTable, _pointerID); cleanElement(eventTable, _pointerID);
@ -364,7 +365,7 @@ void ewol::context::InputManager::state(enum gale::key::type _type,
cleanElement(eventTable, _pointerID); cleanElement(eventTable, _pointerID);
} }
} }
if(true == eventTable[_pointerID].isUsed) { if(eventTable[_pointerID].isUsed == true) {
// save start time // save start time
eventTable[_pointerID].lastTimeEvent = currentTime; eventTable[_pointerID].lastTimeEvent = currentTime;
// generate DOWN Event // generate DOWN Event
@ -388,12 +389,18 @@ void ewol::context::InputManager::state(enum gale::key::type _type,
eventTable[_pointerID].isInside = true; eventTable[_pointerID].isInside = true;
ewol::WidgetShared tmpWidget = m_grabWidget.lock(); ewol::WidgetShared tmpWidget = m_grabWidget.lock();
// get destination widget : // get destination widget :
if(nullptr != tmpWindows) { if(tmpWindows != nullptr) {
if ( tmpWidget != nullptr if ( tmpWidget != nullptr
&& _type == gale::key::type_mouse) { && _type == gale::key::type_mouse) {
eventTable[_pointerID].curentWidgetEvent = tmpWidget; eventTable[_pointerID].curentWidgetEvent = tmpWidget;
} else { } else {
eventTable[_pointerID].curentWidgetEvent = tmpWindows->getWidgetAtPos(_pos); tmpWidget = tmpWindows->getWidgetAtPos(_pos);
eventTable[_pointerID].curentWidgetEvent = tmpWidget;
if (tmpWidget != nullptr) {
EVENT_DEBUG("Get widget at pos=" << _pos << " type: " << tmpWidget->getObjectType());
} else {
EVENT_DEBUG("Get widget at pos=" << _pos << " NO WIDGET");
}
} }
} else { } else {
eventTable[_pointerID].curentWidgetEvent.reset(); eventTable[_pointerID].curentWidgetEvent.reset();
@ -421,15 +428,22 @@ void ewol::context::InputManager::state(enum gale::key::type _type,
EVENT_DEBUG("GUI : Input ID=" << _pointerID EVENT_DEBUG("GUI : Input ID=" << _pointerID
<< " == >" << eventTable[_pointerID].destinationInputId << " == >" << eventTable[_pointerID].destinationInputId
<< " [UP] " << _pos); << " [UP] " << _pos);
if(false == eventTable[_pointerID].isUsed) { ewol::WidgetShared tmpWidget = eventTable[_pointerID].curentWidgetEvent.lock();
if(eventTable[_pointerID].isUsed == false) {
// bad case ... ??? // bad case ... ???
EWOL_DEBUG("Up event without previous down ... "); EWOL_DEBUG("Up event without previous down ... ");
// Mark it un-used : // Mark it un-used :
eventTable[_pointerID].isUsed = false; eventTable[_pointerID].isUsed = false;
// revove the widget ... // revove the widget ...
eventTable[_pointerID].curentWidgetEvent.reset(); eventTable[_pointerID].curentWidgetEvent.reset();
} else if (tmpWidget == nullptr) {
// The widget has been removed:
EVENT_DEBUG(" Object Removed ...");
// Mark it un-used :
eventTable[_pointerID].isUsed = false;
// revove the widget ...
eventTable[_pointerID].curentWidgetEvent.reset();
} else { } else {
ewol::WidgetShared tmpWidget = eventTable[_pointerID].curentWidgetEvent.lock();
// generate UP Event // generate UP Event
EVENT_DEBUG("GUI : Input ID=" << _pointerID EVENT_DEBUG("GUI : Input ID=" << _pointerID
<< " == >" << eventTable[_pointerID].destinationInputId << " == >" << eventTable[_pointerID].destinationInputId

View File

@ -21,21 +21,34 @@ void ewol::Object::autoDestroy() {
EWOL_WARNING("try to auto destroy inside a constructor"); EWOL_WARNING("try to auto destroy inside a constructor");
return; return;
} }
EWOL_VERBOSE("Destroy object : [" << getId() << "] type:" << getObjectType()); EWOL_VERBOSE("Destroy object: [" << getId() << "] type:" << getObjectType());
ewol::ObjectShared parent = m_parent.lock(); ewol::ObjectShared parent = m_parent.lock();
// TODO : set a signal to do this ... // TODO : set a signal to do this ...
if (parent != nullptr) { if (parent != nullptr) {
EWOL_VERBOSE("Destroy object: Call parrent");
parent->requestDestroyFromChild(shared_from_this()); parent->requestDestroyFromChild(shared_from_this());
} }
//if no parent ==> noting to do ... //if no parent ==> noting to do ...
m_destroy = true; m_destroy = true;
} }
bool ewol::Object::objectHasBeenCorectlyInit() {
return m_objectHasBeenInit;
}
void ewol::Object::requestDestroyFromChild(const ewol::ObjectShared& _child) { void ewol::Object::requestDestroyFromChild(const ewol::ObjectShared& _child) {
EWOL_INFO("requestDestroyFromChild(...) is called when an object reference as a parent have a child that request quto-destroy ..."); EWOL_INFO("requestDestroyFromChild(...) is called when an object reference as a parent have a child that request quto-destroy ...");
EWOL_CRITICAL("Call From Child with no effects ==> must implement : requestDestroyFromChild(...)"); EWOL_CRITICAL("Call From Child with no effects ==> must implement : requestDestroyFromChild(...)");
} }
void ewol::Object::destroy() {
autoDestroy();
}
bool ewol::Object::isDestroyed() const {
return m_destroy;
}
void ewol::Object::setParent(const ewol::ObjectShared& _newParent) { void ewol::Object::setParent(const ewol::ObjectShared& _newParent) {
// TODO : Implement change of parent ... // TODO : Implement change of parent ...
m_parent = _newParent; m_parent = _newParent;

View File

@ -138,9 +138,7 @@ namespace ewol {
* @brief Destructor * @brief Destructor
*/ */
virtual ~Object(); virtual ~Object();
bool objectHasBeenCorectlyInit() { bool objectHasBeenCorectlyInit();
return m_objectHasBeenInit;
}
protected: protected:
ewol::ObjectWeak m_parent; //!< Reference on the current parrent. ewol::ObjectWeak m_parent; //!< Reference on the current parrent.
bool m_destroy; //!< Flag to know if the object is requesting has destroy. bool m_destroy; //!< Flag to know if the object is requesting has destroy.
@ -148,28 +146,25 @@ namespace ewol {
/** /**
* @brief Auto-destroy the object * @brief Auto-destroy the object
*/ */
void autoDestroy(); virtual void autoDestroy();
public: public:
/** /**
* @brief Destroy the current object * @brief Destroy the current object
*/ */
virtual void destroy() { virtual void destroy();
autoDestroy();
}
/** /**
* @brief Check if the current objetc his destroy (in removing) * @brief Check if the current objetc his destroy (in removing)
* @return true The object is removed * @return true The object is removed
* @return false The object is not removed * @return false The object is not removed
*/ */
bool isDestroyed() const { bool isDestroyed() const;
return m_destroy; protected:
}
public:
/** /**
* @brief Called by a whild that want to remove pointer of itself from the current list of his parrent * @brief Called by a whild that want to remove pointer of itself from the current list of his parrent
* @param[in] _child Object of the child that want to remove itself * @param[in] _child Object of the child that want to remove itself
*/ */
virtual void requestDestroyFromChild(const ewol::ObjectShared& _child); virtual void requestDestroyFromChild(const ewol::ObjectShared& _child);
public:
/** /**
* @brief Set the Object has new parrent. * @brief Set the Object has new parrent.
* @param[in] _newParent Object that requesting the parenting * @param[in] _newParent Object that requesting the parenting

View File

@ -35,7 +35,6 @@
#define __class__ "ewol::widget::Manager" #define __class__ "ewol::widget::Manager"
ewol::widget::Manager::Manager() : ewol::widget::Manager::Manager() :
m_havePeriodic(false),
m_haveRedraw(true) { m_haveRedraw(true) {
EWOL_DEBUG(" == > init Widget-Manager"); EWOL_DEBUG(" == > init Widget-Manager");
@ -137,30 +136,16 @@ void ewol::widget::Manager::focusRelease() {
} }
m_focusWidgetCurrent = m_focusWidgetDefault; m_focusWidgetCurrent = m_focusWidgetDefault;
focusWidgetCurrent = m_focusWidgetCurrent.lock(); focusWidgetCurrent = m_focusWidgetCurrent.lock();
if (nullptr != focusWidgetCurrent) { if (focusWidgetCurrent != nullptr) {
EWOL_DEBUG("Set focus on WidgetID=" << focusWidgetCurrent->getId() ); EWOL_DEBUG("Set focus on WidgetID=" << focusWidgetCurrent->getId() );
focusWidgetCurrent->setFocus(); focusWidgetCurrent->setFocus();
} }
} }
ewol::WidgetShared ewol::widget::Manager::focusGet() { ewol::WidgetShared ewol::widget::Manager::focusGet() {
return m_focusWidgetCurrent.lock(); return m_focusWidgetCurrent.lock();
} }
void ewol::widget::Manager::focusRemoveIfRemove(const ewol::WidgetShared& _newWidget) {
ewol::WidgetShared focusWidgetDefault = m_focusWidgetDefault.lock();
ewol::WidgetShared focusWidgetCurrent = m_focusWidgetCurrent.lock();
if (focusWidgetCurrent == _newWidget) {
EWOL_WARNING("Release focus when remove widget");
focusRelease();
}
if (focusWidgetDefault == _newWidget) {
EWOL_WARNING("Release default focus when remove widget");
focusSetDefault(nullptr);
}
}
void ewol::widget::Manager::setCallbackonRedrawNeeded(const std::function<void()>& _func) { void ewol::widget::Manager::setCallbackonRedrawNeeded(const std::function<void()>& _func) {
m_funcRedrawNeeded = _func; m_funcRedrawNeeded = _func;
} }
@ -183,27 +168,28 @@ bool ewol::widget::Manager::isDrawingNeeded() {
// element that generate the list of elements // element that generate the list of elements
void ewol::widget::Manager::addWidgetCreator(const std::string& _name, void ewol::widget::Manager::addWidgetCreator(const std::string& _name,
ewol::widget::Manager::creator_tf _pointer) { ewol::widget::Manager::widgetCreatorFunction _pointer) {
if (nullptr == _pointer) { if (_pointer == nullptr) {
return; return;
} }
//Keep name in lower case : //Keep name in lower case :
std::string nameLower = etk::tolower(_name); std::string nameLower = etk::tolower(_name);
if (true == m_creatorList.exist(nameLower)) { auto it = m_creatorList.find(nameLower);
if (it != m_creatorList.end()) {
EWOL_WARNING("Replace Creator of a specify widget : " << nameLower); EWOL_WARNING("Replace Creator of a specify widget : " << nameLower);
m_creatorList[nameLower] = _pointer; it->second = _pointer;
return; return;
} }
EWOL_INFO("Add Creator of a specify widget : " << nameLower); EWOL_INFO("Add Creator of a specify widget : " << nameLower);
m_creatorList.add(nameLower, _pointer); m_creatorList.insert(make_pair(nameLower, _pointer));
} }
ewol::WidgetShared ewol::widget::Manager::create(const std::string& _name) { ewol::WidgetShared ewol::widget::Manager::create(const std::string& _name) {
std::string nameLower = etk::tolower(_name); std::string nameLower = etk::tolower(_name);
if (m_creatorList.exist(nameLower) == true) { auto it = m_creatorList.find(nameLower);
ewol::widget::Manager::creator_tf pointerFunction = m_creatorList[nameLower]; if (it != m_creatorList.end()) {
if (pointerFunction != nullptr) { if (it->second != nullptr) {
return pointerFunction(); return it->second();
} }
} }
EWOL_WARNING("try to create an UnExistant widget : " << nameLower); EWOL_WARNING("try to create an UnExistant widget : " << nameLower);
@ -212,15 +198,21 @@ ewol::WidgetShared ewol::widget::Manager::create(const std::string& _name) {
bool ewol::widget::Manager::exist(const std::string& _name) { bool ewol::widget::Manager::exist(const std::string& _name) {
std::string nameLower = etk::tolower(_name); std::string nameLower = etk::tolower(_name);
return m_creatorList.exist(nameLower); auto it = m_creatorList.find(nameLower);
if (it != m_creatorList.end()) {
return false;
}
return true;
} }
std::string ewol::widget::Manager::list() { std::string ewol::widget::Manager::list() {
std::string tmpVal; std::string tmpVal;
for (int32_t iii=0; iii<m_creatorList.size() ; iii++) { for (auto &it : m_creatorList) {
tmpVal += m_creatorList.getKey(iii); if (tmpVal.size() != 0) {
tmpVal += ","; tmpVal += ",";
} }
tmpVal += it.first;
}
return tmpVal; return tmpVal;
} }

View File

@ -10,44 +10,98 @@
#include <etk/types.h> #include <etk/types.h>
#include <ewol/debug.h> #include <ewol/debug.h>
#include <vector> #include <vector>
#include <etk/Hash.h> #include <unordered_map>
#include <ewol/widget/Widget.h> #include <ewol/widget/Widget.h>
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class Manager { class Manager {
public:
using creator_tf = std::function<ewol::WidgetShared()>;
private:
// For the focus Management
ewol::WidgetWeak m_focusWidgetDefault;
ewol::WidgetWeak m_focusWidgetCurrent;
bool m_havePeriodic;
bool m_haveRedraw;
etk::Hash<creator_tf> m_creatorList;
public: public:
Manager(); Manager();
virtual ~Manager(); virtual ~Manager();
// ---------------------------------------------
void focusKeep(const ewol::WidgetShared& _newWidget); // set the focus at the specific widget // -- Focus area
void focusSetDefault(const ewol::WidgetShared& _newWidget); // select the default focus getter // ---------------------------------------------
void focusRelease(); // release focus from the current widget to the default private:
ewol::WidgetWeak m_focusWidgetDefault; //!< default focus when no current focus is set
ewol::WidgetWeak m_focusWidgetCurrent; //!< Currect focus selected
public:
/**
* @brief Request a focus on a specify widget.
* @param[in] _newWidget Widget that might get the focus.
*/
void focusKeep(const ewol::WidgetShared& _newWidget);
/**
* @brief Set the default focus when none selected.
* @param[in] _newWidget Widget that might get the focus (when nothing else).
*/
void focusSetDefault(const ewol::WidgetShared& _newWidget);
/**
* @brief Release the current focus (back on default if possible).
*/
void focusRelease();
/**
* @brief Get the current Focused widget.
* @return The pointer on the current focused element.
*/
ewol::WidgetShared focusGet(); ewol::WidgetShared focusGet();
void focusRemoveIfRemove(const ewol::WidgetShared& _newWidget); // ---------------------------------------------
// -- Factory area
// ---------------------------------------------
public:
using widgetCreatorFunction = std::function<ewol::WidgetShared()>; //!< funtion factory basic definition
private:
std::unordered_map<std::string, widgetCreatorFunction> m_creatorList; //!< List of factory of a widget
public:
/**
* @brief add a factory of a specific widget.
* @param[in] _name Name of the widget that is associated of the factory.
* @param[in] _factory Function pointer to create the widget
*/
void addWidgetCreator(const std::string& _name, widgetCreatorFunction _factory);
/**
* @brief Create a widget with his name.
* @param[in] _name Name of the widget to create.
* @return The widget created (nullptr if it does not exist).
*/
ewol::WidgetShared create(const std::string& _name);
/**
* @brief Check if an Widget exist
* @param[in] _name Name of the widget to check.
* @return true The Widget exist.
* @return false The Widget Does NOT exist.
*/
bool exist(const std::string& _name);
/**
* @brief Get the list of all Widget that can be created.
* @return Separate with ',' string list.
*/
std::string list();
// ---------------------------------------------
// -- Something change area (TODO: maybe set it in the windows)
// ---------------------------------------------
private:
bool m_haveRedraw; //!< something request a redraw
private: private:
std::function<void()> m_funcRedrawNeeded; std::function<void()> m_funcRedrawNeeded;
public: public:
/**
* @brief Mark the display to redraw
*/
void markDrawingIsNeeded(); void markDrawingIsNeeded();
/**
* @brief Check if a redraw has been requested (set the local value back at false)
* @return true if something to be redraw
*/
bool isDrawingNeeded(); bool isDrawingNeeded();
private:
/**
* @brief Set a callback when we need redraw the display (need by MacOs)
* @param[in] _func function to call
*/
void setCallbackonRedrawNeeded(const std::function<void()>& _func); void setCallbackonRedrawNeeded(const std::function<void()>& _func);
// element that generate the list of elements
void addWidgetCreator(const std::string& _name, creator_tf _pointer);
ewol::WidgetShared create(const std::string& _name);
bool exist(const std::string& _name);
std::string list();
private:
void periodicCallUpdateCount();
}; };
}; };
}; };

View File

@ -96,13 +96,16 @@ void ewol::Widget::onChangeSize() {
} }
bool ewol::Widget::setFocus() { bool ewol::Widget::setFocus() {
EWOL_VERBOSE("set focus (start) *propertyCanFocus=" << *propertyCanFocus << " m_hasFocus=" << m_hasFocus);
if (*propertyCanFocus == true) { if (*propertyCanFocus == true) {
if (m_hasFocus == false) { if (m_hasFocus == false) {
m_hasFocus = true; m_hasFocus = true;
onGetFocus(); onGetFocus();
} }
EWOL_VERBOSE("set focus (stop) ret true");
return true; return true;
} }
EWOL_VERBOSE("set focus (stop) ret false");
return false; return false;
} }

View File

@ -61,13 +61,14 @@ void ewol::widget::Windows::onChangeSize() {
} }
ewol::WidgetShared ewol::widget::Windows::getWidgetAtPos(const vec2& _pos) { ewol::WidgetShared ewol::widget::Windows::getWidgetAtPos(const vec2& _pos) {
EWOL_VERBOSE("Get widget at pos : " << _pos);
// calculate relative position // calculate relative position
vec2 relativePos = relativePosition(_pos); vec2 relativePos = relativePosition(_pos);
// event go directly on the pop-up // event go directly on the pop-up
if (0 < m_popUpWidgetList.size()) { if (m_popUpWidgetList.size() != 0) {
return m_popUpWidgetList.back()->getWidgetAtPos(_pos); return m_popUpWidgetList.back()->getWidgetAtPos(_pos);
// otherwise in the normal windows // otherwise in the normal windows
} else if (nullptr != m_subWidget) { } else if (m_subWidget != nullptr) {
return m_subWidget->getWidgetAtPos(_pos); return m_subWidget->getWidgetAtPos(_pos);
} }
// otherwise the event go to this widget ... // otherwise the event go to this widget ...
@ -239,9 +240,11 @@ void ewol::widget::Windows::createPopUpMessage(enum popUpMessageType _type, cons
} }
void ewol::widget::Windows::requestDestroyFromChild(const ewol::ObjectShared& _child) { void ewol::widget::Windows::requestDestroyFromChild(const ewol::ObjectShared& _child) {
EWOL_VERBOSE("A child has been removed");
auto it = m_popUpWidgetList.begin(); auto it = m_popUpWidgetList.begin();
while (it != m_popUpWidgetList.end()) { while (it != m_popUpWidgetList.end()) {
if (*it == _child) { if (*it == _child) {
EWOL_VERBOSE(" Find it ...");
if (*it == nullptr) { if (*it == nullptr) {
m_popUpWidgetList.erase(it); m_popUpWidgetList.erase(it);
it = m_popUpWidgetList.begin(); it = m_popUpWidgetList.begin();
@ -257,6 +260,7 @@ void ewol::widget::Windows::requestDestroyFromChild(const ewol::ObjectShared& _c
++it; ++it;
} }
if (m_subWidget == _child) { if (m_subWidget == _child) {
EWOL_VERBOSE(" Find it ... 2");
if (m_subWidget == nullptr) { if (m_subWidget == nullptr) {
return; return;
} }