[DEV] remove onObjectRemove...

This commit is contained in:
Edouard DUPIN 2014-08-17 23:36:53 +02:00
parent bee8936d54
commit b478b3e862
33 changed files with 6 additions and 375 deletions

2
external/eaudiofx vendored

@ -1 +1 @@
Subproject commit d62f5fd5c65d7c7b72efb68835bf9eb7d008e0a4
Subproject commit f0e325a853bca990a1e6eb329b20526a94712b6a

2
external/ewolsa vendored

@ -1 +1 @@
Subproject commit 33fe9dfba589f3e8b3d518790397de9828eb7617
Subproject commit 8d9aef8384ced7fc4a9b2761bf1966b4bdf5e231

2
external/ogg vendored

@ -1 +1 @@
Subproject commit e05a06288ad9f91541a2c06729c00e764e89a568
Subproject commit fd44b865a3f42dbcae7c08888f2228c0644e980f

View File

@ -672,16 +672,6 @@ bool ewol::Context::OS_Draw(bool _displayEveryTime) {
return hasDisplayDone;
}
void ewol::Context::onObjectRemove(const std::shared_ptr<ewol::Object>& _object) {
//EWOL_CRITICAL("element removed");
if (m_windowsCurrent == _object) {
m_windowsCurrent.reset(); // This might never arrived, the owner is the current element (expected when the widget auto remove itself)
}
// inform all manager that can not be directly linked with the object manager
m_input.onObjectRemove(_object);
m_resourceManager.cleanInternalRemoved();
}
void ewol::Context::resetIOEvent() {
m_input.newLayerSet();
}

View File

@ -144,8 +144,6 @@ namespace ewol {
// return true if a flush is needed
bool OS_Draw(bool _displayEveryTime);
virtual void onObjectRemove(const std::shared_ptr<ewol::Object>& _removeObject);
public:
/**
* @brief reset event management for the IO like Input ou Mouse or keyborad

View File

@ -140,28 +140,6 @@ void ewol::context::InputManager::unGrabPointer() {
m_context.grabPointerEvents(false, vec2(0,0));
}
void ewol::context::InputManager::onObjectRemove(const std::shared_ptr<ewol::Object>& _object) {
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
std::shared_ptr<ewol::Widget> tmpWidget = m_eventInputSaved[iii].curentWidgetEvent.lock();
if (tmpWidget == _object) {
// remove the property of this input ...
EWOL_VERBOSE("Remove object ==> rm Input Event !!!");
cleanElement(m_eventInputSaved, iii);
}
tmpWidget = m_eventMouseSaved[iii].curentWidgetEvent.lock();
if (tmpWidget == _object) {
// remove the property of this input ...
EWOL_VERBOSE("Remove object ==> rm Mouse Event !!!");
cleanElement(m_eventMouseSaved, iii);
}
}
std::shared_ptr<ewol::Widget> tmpWidgetGrab = m_grabWidget.lock();
if (tmpWidgetGrab == _object) {
EWOL_VERBOSE("Remove object ==> rm Grab widget !!!");
tmpWidgetGrab.reset();
}
}
void ewol::context::InputManager::newLayerSet() {
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
// remove the property of this input ...

View File

@ -94,8 +94,6 @@ namespace ewol {
// note if id<0 == > the it was finger event ...
void motion(enum ewol::key::type _type, int _pointerID, vec2 _pos );
void state(enum ewol::key::type _type, int _pointerID, bool _isDown, vec2 _pos);
void onObjectRemove(const std::shared_ptr<ewol::Object>& _object);
public:
/**
* @brief a new layer on the windows is set == > might remove all the property of the current element ...

View File

@ -1,21 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license APACHE v2.0 (see license file)
*/
#include <ewol/object/Config.h>
#include <etk/types.h>
#undef __class__
#define __class__ "object::Config"
std::ostream& ewol::operator <<(std::ostream& _os, const ewol::object::Config& _obj) {
_os << "{";
_os << "config=\"" << _obj.getConfig() << "\"";
_os << " data=\"" << _obj.getData() << "\"}";
return _os;
}

View File

@ -1,46 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license APACHE v2.0 (see license file)
*/
#ifndef __EWOL_OBJECT_CONFIG_H__
#define __EWOL_OBJECT_CONFIG_H__
#include <ewol/debug.h>
namespace ewol {
namespace object {
class Config {
private:
const char* m_config; //!< config properties.
std::string m_data; //!< compositing additionnal message Value.
public:
Config(const char* _config,
const std::string& _data) :
m_config(_config),
m_data(_data) {
};
void setConfig(const char* _config) {
m_config = _config;
};
inline const char* getConfig() const {
return m_config;
};
void setData(const std::string& _data) {
m_data = _data;
};
inline const std::string& getData() const {
return m_data;
};
};
};
std::ostream& operator <<(std::ostream& _os, const ewol::object::Config& _obj);
};
#endif

View File

@ -1,34 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license APACHE v2.0 (see license file)
*/
#include <ewol/object/ConfigElement.h>
#undef __class__
#define __class__ "object::ConfigElement"
std::ostream& ewol::operator <<(std::ostream& _os, const ewol::object::ConfigElement& _obj) {
_os << "{";
if (nullptr != _obj.getConfig()) {
_os << "config=\"" << _obj.getConfig() << "\"";
}
if (nullptr != _obj.getType()) {
_os << " type=\"" << _obj.getType() << "\"";
}
if (nullptr != _obj.getControl()) {
_os << " ctrl=\"" << _obj.getControl() << "\"";
}
if (nullptr != _obj.getDescription()) {
_os << " desc=\"" << _obj.getDescription() << "\"";
}
if (nullptr != _obj.getDefault()) {
_os << " default=\"" << _obj.getDefault() << "\"";
}
_os << "}";
return _os;
}

View File

@ -1,59 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license APACHE v2.0 (see license file)
*/
#ifndef __EWOL_OBJECT_CONFIG_ELEMENT_H__
#define __EWOL_OBJECT_CONFIG_ELEMENT_H__
#include <ewol/debug.h>
namespace ewol {
namespace object {
class ConfigElement {
private:
const char* m_config; //!< config properties (used for XML properties == > only : "[0-9a-zA-Z\-]" ==> this is a regExp control.
const char* m_type; //!< type of the config[integer,float,string,reg-exp,list].
const char* m_control; //!< control the type of the type set ( integer:[0..256], regExp: "[0-9a-zA-Z]", list:[plop,plop2,plop3] )
const char* m_description; //!< description to help user to configure it.
const char* m_default; //!< default value ...
public:
// note : no parameter capability is needed to create element in case of vector stoarage.
ConfigElement(const char* _config = nullptr,
const char* _type = nullptr,
const char* _control = nullptr,
const char* _description = nullptr,
const char* _default = nullptr) :
m_config(_config),
m_type(_type),
m_control(_control),
m_description(_description),
m_default(_default) {
};
inline const char* getConfig() const {
return m_config;
};
inline const char* getType() const {
return m_type;
};
inline const char* getControl() const {
return m_control;
};
inline const char* getDescription() const {
return m_description;
};
inline const char* getDefault() const {
return m_default;
};
};
};
std::ostream& operator <<(std::ostream& _os, const ewol::object::ConfigElement& _obj);
};
#endif

View File

@ -28,19 +28,6 @@ void ewol::object::MultiCast::clear() {
m_messageList.clear();
}
void ewol::object::MultiCast::onObjectRemove(const std::shared_ptr<ewol::Object>& _object) {
auto it(m_messageList.begin());
while (it != m_messageList.end()) {
std::shared_ptr<ewol::Object> obj = it->m_object.lock();
if (obj == _object) {
m_messageList.erase(it);
it = m_messageList.begin();
} else {
++it;
}
}
}
void ewol::object::MultiCast::add(const std::shared_ptr<ewol::Object>& _object, const char* const _message) {
if (_object == nullptr) {
EWOL_ERROR("Add with nullptr object");
@ -75,8 +62,7 @@ void ewol::object::MultiCast::rm(const std::shared_ptr<ewol::Object>& _object) {
}
void ewol::object::MultiCast::send(const std::shared_ptr<ewol::Object>& _object, const char* const _message, const std::string& _data) {
EWOL_VERBOSE("SendMulticast message \"" << _message << "\" data=\"" << _data << "\" to :");
EWOL_VERBOSE("SendMulticast message \"" << _message << "\" data=\"" << _data << "\" to:");
// send the message at all registered widget ...
for (auto &it : m_messageList) {
std::shared_ptr<ewol::Object> obj = it.m_object.lock();

View File

@ -40,7 +40,6 @@ namespace ewol {
void send(const std::shared_ptr<ewol::Object>& _object, const char* const _message, const std::string& _data);
void rm(const std::shared_ptr<ewol::Object>& _object);
void add(const std::shared_ptr<ewol::Object>& _object, const char* const _message);
void onObjectRemove(const std::shared_ptr<ewol::Object>& _object);
};
};
};

View File

@ -170,7 +170,7 @@ void ewol::Object::sendMultiCast(const char* const _messageId, const std::string
void ewol::Object::registerMultiCast(const char* const _messageId) {
if (m_objectHasBeenInit == false) {
EWOL_WARNING("try to generate an event inside a constructor");
EWOL_ERROR("Try to Register multicast inside a constructor (move it in the init function)");
return;
}
getMultiCast().add(shared_from_this(), _messageId);
@ -264,24 +264,6 @@ void ewol::Object::unRegisterOnEvent(const std::shared_ptr<ewol::Object>& _desti
}
}
void ewol::Object::onObjectRemove(const std::shared_ptr<ewol::Object>& _object) {
EWOL_VERBOSE("[" << getId() << "] onObjectRemove(" << _object->getId() << ")");
auto it(m_externEvent.begin());
while(it != m_externEvent.end()) {
std::shared_ptr<ewol::Object> obj = it->destObject.lock();
if (obj == nullptr) {
m_externEvent.erase(it);
it = m_externEvent.begin();
} else if (obj == _object) {
m_externEvent.erase(it);
it = m_externEvent.begin();
EWOL_INFO("[" << getId() << "] Remove extern event : to object id=" << _object->getId());
} else {
++it;
}
}
}
bool ewol::Object::loadXML(exml::Element* _node) {
if (nullptr == _node) {
return false;

View File

@ -199,7 +199,7 @@ namespace ewol {
* @brief Inform object that an other object is removed ...
* @note : Sub classes must call this class
*/
virtual void onObjectRemove(const std::shared_ptr<ewol::Object>& _object);
virtual void onObjectRemove(const std::shared_ptr<ewol::Object>& _object, bool _deprecated) { /* Deprecated */};
/**
* @brief Receive a message from an other Object with a specific eventId and data
* @param[in] _msg Message handle

View File

@ -15,8 +15,6 @@
namespace ewol {
namespace object {
class RemoveEvent {
public:
virtual void onObjectRemove(const std::shared_ptr<ewol::Object>& _object) = 0;
public:
RemoveEvent();
virtual ~RemoveEvent();

View File

@ -75,15 +75,6 @@ std::shared_ptr<ewol::Widget> ewol::widget::Container::getWidgetNamed(const std:
return nullptr;
}
void ewol::widget::Container::onObjectRemove(const std::shared_ptr<ewol::Object>& _object) {
ewol::Widget::onObjectRemove(_object);
if (m_subWidget == _object) {
m_subWidget.reset();
markToRedraw();
requestUpdateSize();
}
}
void ewol::widget::Container::systemDraw(const ewol::DrawProperty& _displayProp) {
if (true == m_hide){
// widget is hidden ...

View File

@ -55,7 +55,6 @@ namespace ewol {
public: // Derived function
virtual void systemDraw(const ewol::DrawProperty& _displayProp);
virtual void onRegenerateDisplay();
virtual void onObjectRemove(const std::shared_ptr<ewol::Object>& _object);
virtual void calculateSize(const vec2& _availlable);
virtual void calculateMinMaxSize();
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos);

View File

@ -77,20 +77,6 @@ std::shared_ptr<ewol::Widget> ewol::widget::Container2::getWidgetNamed(const std
return nullptr;
}
void ewol::widget::Container2::onObjectRemove(const std::shared_ptr<ewol::Object>& _object) {
ewol::Widget::onObjectRemove(_object);
if (m_subWidget[0] == _object) {
m_subWidget[0].reset();
markToRedraw();
requestUpdateSize();
}
if (m_subWidget[1] == _object) {
m_subWidget[1].reset();
markToRedraw();
requestUpdateSize();
}
}
void ewol::widget::Container2::systemDraw(const ewol::DrawProperty& _displayProp) {
if (true == m_hide){
// widget is hidden ...

View File

@ -154,7 +154,6 @@ namespace ewol {
public: // Derived function
virtual void systemDraw(const ewol::DrawProperty& _displayProp);
virtual void onRegenerateDisplay();
virtual void onObjectRemove(const std::shared_ptr<ewol::Object>& _object);
virtual void calculateSize(const vec2& _availlable) {
calculateSizePadded(_availlable);
}

View File

@ -154,21 +154,6 @@ std::shared_ptr<ewol::Widget> ewol::widget::ContainerN::getWidgetNamed(const std
return nullptr;
}
void ewol::widget::ContainerN::onObjectRemove(const std::shared_ptr<ewol::Object>& _object) {
// First step call parrent :
ewol::Widget::onObjectRemove(_object);
// second step find if in all the elements ...
auto it(m_subWidget.begin());
while (it != m_subWidget.end()) {
if(*it == _object) {
m_subWidget.erase(it);
it = m_subWidget.begin();
} else {
++it;
}
}
}
void ewol::widget::ContainerN::systemDraw(const ewol::DrawProperty& _displayProp) {
if (true == m_hide){
// widget is hidden ...

View File

@ -91,7 +91,6 @@ namespace ewol {
public:// Derived function
virtual void systemDraw(const ewol::DrawProperty& _displayProp);
virtual void onRegenerateDisplay();
virtual void onObjectRemove(const std::shared_ptr<ewol::Object>& _object);
virtual void calculateSize(const vec2& _availlable);
virtual void calculateMinMaxSize();
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos);

View File

@ -347,19 +347,3 @@ std::shared_ptr<ewol::Widget> ewol::widget::Gird::getWidgetAtPos(const vec2& _po
}
return nullptr;
}
void ewol::widget::Gird::onObjectRemove(const std::shared_ptr<ewol::Object>& _removeObject) {
// First step call parrent :
ewol::Widget::onObjectRemove(_removeObject);
// second step find if in all the elements ...
for(int32_t iii=m_subWidget.size()-1; iii >= 0; iii--) {
if(m_subWidget[iii].widget == _removeObject) {
EWOL_VERBOSE("[" << getId() << "]={" << getObjectType() << "} remove sizer sub Element [" << iii << "/" << m_subWidget.size()-1 << "] == > destroyed object");
m_subWidget[iii].widget = nullptr;
m_subWidget.erase(m_subWidget.begin()+iii);
}
}
if (m_tmpWidget == _removeObject) {
m_tmpWidget.reset();
}
}

View File

@ -140,7 +140,6 @@ namespace ewol {
virtual void systemDraw(const ewol::DrawProperty& _displayProp);
virtual void onRegenerateDisplay();
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& pos);
virtual void onObjectRemove(const std::shared_ptr<ewol::Object>& _removeObject);
virtual void calculateSize(const vec2& _availlable);
virtual void calculateMinMaxSize();
};

View File

@ -692,7 +692,6 @@ namespace ewol {
*/
virtual enum ewol::context::cursorDisplay getCursor();
public: // Derived function
virtual void onObjectRemove(const std::shared_ptr<ewol::Object>& _object) {};
virtual bool loadXML(exml::Element* _node);
protected: // Derived function
virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer);

View File

@ -199,24 +199,6 @@ void ewol::widget::Windows::popUpWidgetPop() {
m_popUpWidgetList.pop_back();
}
void ewol::widget::Windows::onObjectRemove(const std::shared_ptr<ewol::Object>& _removeObject) {
// First step call parrent :
ewol::Widget::onObjectRemove(_removeObject);
// second step find if in all the elements ...
if (m_subWidget == _removeObject) {
EWOL_DEBUG("Remove main element of the windows == > destroyed object");
m_subWidget.reset();
}
for (auto it(m_popUpWidgetList.begin()) ; it != m_popUpWidgetList.end() ; ++it) {
if(*it == _removeObject) {
EWOL_DEBUG("Remove Pop-up element of the windows == > destroyed object");
m_popUpWidgetList.erase(it);
it = m_popUpWidgetList.begin();
}
}
}
void ewol::widget::Windows::setBackgroundColor(const etk::Color<float>& _color) {
if (m_backgroundColor != _color) {
m_backgroundColor = _color;

View File

@ -89,7 +89,6 @@ namespace ewol {
virtual void systemDraw(const ewol::DrawProperty& _displayProp);
public: // Derived function
virtual void onRegenerateDisplay();
virtual void onObjectRemove(const std::shared_ptr<ewol::Object>& _removeObject);
virtual void calculateSize(const vec2& _availlable);
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos);
virtual void requestDestroyFromChild(const std::shared_ptr<Object>& _child);

View File

@ -162,25 +162,3 @@ void ewol::widget::ColorChooser::onReceiveMessage(const ewol::object::Message& _
}
};
void ewol::widget::ColorChooser::onObjectRemove(const std::shared_ptr<ewol::Object>& _removeObject) {
// First step call parrent :
ewol::widget::Sizer::onObjectRemove(_removeObject);
// second step find if in all the elements ...
if(_removeObject == m_widgetRed) {
m_widgetRed.reset();
}
if(_removeObject == m_widgetGreen) {
m_widgetGreen.reset();
}
if(_removeObject == m_widgetBlue) {
m_widgetBlue.reset();
}
if(_removeObject == m_widgetAlpha) {
m_widgetAlpha.reset();
}
if(_removeObject == m_widgetColorBar) {
m_widgetColorBar.reset();
}
}

View File

@ -36,7 +36,6 @@ namespace ewol {
virtual ~ColorChooser();
public: // Derived function
virtual void onReceiveMessage(const ewol::object::Message& _msg);
virtual void onObjectRemove(const std::shared_ptr<ewol::Object>& _removeObject);
public:
void setColor(etk::Color<> _newColor);
etk::Color<> getColor();

View File

@ -219,21 +219,6 @@ void ewol::widget::Parameter::onReceiveMessage(const ewol::object::Message& _msg
return;
}
void ewol::widget::Parameter::onObjectRemove(const std::shared_ptr<ewol::Object>& _removeObject) {
// First step call parrent :
ewol::widget::PopUp::onObjectRemove(_removeObject);
// second step find if in all the elements ...
if(_removeObject == m_widgetTitle) {
m_widgetTitle = nullptr;
}
if(_removeObject == m_paramList) {
m_paramList = nullptr;
}
if(_removeObject == m_wSlider) {
m_wSlider = nullptr;
}
}
void ewol::widget::Parameter::menuAdd(std::string _label, std::string _image, std::shared_ptr<ewol::Widget> _associateWidget) {
if (nullptr != m_paramList) {
m_paramList->menuAdd(_label, m_currentIdList, _image);

View File

@ -38,7 +38,6 @@ namespace ewol {
virtual ~Parameter();
public: // Derived function
virtual void onReceiveMessage(const ewol::object::Message& _msg);
virtual void onObjectRemove(const std::shared_ptr<ewol::Object>& _removeObject);
public:
void setTitle(std::string _label);
void menuAdd(std::string _label, std::string _image, std::shared_ptr<ewol::Widget> _associateWidget);

View File

@ -114,26 +114,6 @@ std::shared_ptr<ewol::widget::Button> ewol::widget::StdPopUp::addButton(const st
return myButton;
}
void ewol::widget::StdPopUp::onObjectRemove(const std::shared_ptr<ewol::Object>& _removeObject) {
// call parent:
ewol::widget::PopUp::onObjectRemove(_removeObject);
if (_removeObject == m_subBar) {
m_subBar = nullptr;
markToRedraw();
return;
}
if (_removeObject == m_comment) {
m_comment = nullptr;
markToRedraw();
return;
}
if (_removeObject == m_title) {
m_title = nullptr;
markToRedraw();
return;
}
}
void ewol::widget::StdPopUp::onReceiveMessage(const ewol::object::Message& _msg) {
// call parent:
ewol::widget::PopUp::onReceiveMessage(_msg);

View File

@ -77,7 +77,6 @@ namespace ewol {
*/
std::shared_ptr<ewol::widget::Button> addButton(const std::string& _text, bool _autoExit=false);
public: // Derived function
virtual void onObjectRemove(const std::shared_ptr<ewol::Object>& _removeObject);
virtual void onReceiveMessage(const ewol::object::Message& _msg);
};
};