[DEV] start abstraction of using shared_ptr and weak_ptr to bench some other implementation thread safe ...

This commit is contained in:
Edouard DUPIN 2016-03-07 23:32:59 +01:00
parent 9371f59962
commit 9e7d41f266
70 changed files with 430 additions and 290 deletions

View File

@ -52,13 +52,13 @@ void ewol::Context::setInitImage(const std::string& _fileName) {
void ewol::Context::inputEventTransfertWidget(std::shared_ptr<ewol::Widget> _source, void ewol::Context::inputEventTransfertWidget(ewol::WidgetShared _source,
std::shared_ptr<ewol::Widget> _destination) { ewol::WidgetShared _destination) {
m_input.transfertEvent(_source, _destination); m_input.transfertEvent(_source, _destination);
} }
void ewol::Context::inputEventGrabPointer(std::shared_ptr<ewol::Widget> _widget) { void ewol::Context::inputEventGrabPointer(ewol::WidgetShared _widget) {
m_input.grabPointer(_widget); m_input.grabPointer(_widget);
} }
@ -138,7 +138,7 @@ void ewol::Context::onResume(gale::Context& _context) {
void ewol::Context::onRegenerateDisplay(gale::Context& _context) { void ewol::Context::onRegenerateDisplay(gale::Context& _context) {
//EWOL_INFO("REGENERATE_DISPLAY"); //EWOL_INFO("REGENERATE_DISPLAY");
// check if the user selected a windows // check if the user selected a windows
std::shared_ptr<ewol::widget::Windows> window = m_windowsCurrent; ewol::widget::WindowsShared window = m_windowsCurrent;
if (window == nullptr) { if (window == nullptr) {
EWOL_DEBUG("No windows ..."); EWOL_DEBUG("No windows ...");
return; return;
@ -156,7 +156,7 @@ void ewol::Context::onDraw(gale::Context& _context) {
// clean internal data... // clean internal data...
m_objectManager.cleanInternalRemoved(); m_objectManager.cleanInternalRemoved();
// real draw... // real draw...
std::shared_ptr<ewol::widget::Windows> window = m_windowsCurrent; ewol::widget::WindowsShared window = m_windowsCurrent;
if (window == nullptr) { if (window == nullptr) {
return; return;
} }
@ -249,7 +249,7 @@ void ewol::Context::onKeyboard(const gale::key::Special& _special,
return; return;
} }
// get the current focused Widget : // get the current focused Widget :
std::shared_ptr<ewol::Widget> tmpWidget = m_widgetManager.focusGet(); ewol::WidgetShared tmpWidget = m_widgetManager.focusGet();
if (tmpWidget == nullptr) { if (tmpWidget == nullptr) {
// no Widget ... // no Widget ...
return; return;
@ -301,7 +301,7 @@ void ewol::Context::processEvents() {
*/ */
void ewol::Context::onClipboardEvent(enum gale::context::clipBoard::clipboardListe _clipboardId) { void ewol::Context::onClipboardEvent(enum gale::context::clipBoard::clipboardListe _clipboardId) {
std::shared_ptr<ewol::Widget> tmpWidget = m_widgetManager.focusGet(); ewol::WidgetShared tmpWidget = m_widgetManager.focusGet();
if (tmpWidget != nullptr) { if (tmpWidget != nullptr) {
tmpWidget->onEventClipboard(_clipboardId); tmpWidget->onEventClipboard(_clipboardId);
} }
@ -434,7 +434,7 @@ void ewol::Context::resetIOEvent() {
} }
void ewol::Context::setWindows(const std::shared_ptr<ewol::widget::Windows>& _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 :
m_widgetManager.focusSetDefault(nullptr); m_widgetManager.focusSetDefault(nullptr);
@ -447,7 +447,7 @@ void ewol::Context::setWindows(const std::shared_ptr<ewol::widget::Windows>& _wi
forceRedrawAll(); forceRedrawAll();
} }
std::shared_ptr<ewol::widget::Windows> ewol::Context::getWindows() { ewol::widget::WindowsShared ewol::Context::getWindows() {
return m_windowsCurrent; return m_windowsCurrent;
}; };
void ewol::Context::onResize(const ivec2& _size) { void ewol::Context::onResize(const ivec2& _size) {

View File

@ -92,18 +92,18 @@ namespace ewol {
*/ */
virtual void stop(); virtual void stop();
private: private:
std::shared_ptr<ewol::widget::Windows> m_windowsCurrent; //!< curent displayed windows ewol::widget::WindowsShared m_windowsCurrent; //!< curent displayed windows
public: public:
/** /**
* @brief set the current windows to display : * @brief set the current windows to display :
* @param _windows Windows that might be displayed * @param _windows Windows that might be displayed
*/ */
void setWindows(const std::shared_ptr<ewol::widget::Windows>& _windows); void setWindows(const ewol::widget::WindowsShared& _windows);
/** /**
* @brief get the current windows that is displayed * @brief get the current windows that is displayed
* @return the current handle on the windows (can be null) * @return the current handle on the windows (can be null)
*/ */
std::shared_ptr<ewol::widget::Windows> getWindows(); ewol::widget::WindowsShared getWindows();
/** /**
* @brief Redraw all the windows * @brief Redraw all the windows
@ -116,12 +116,12 @@ namespace ewol {
* @param source the widget where the event came from * @param source the widget where the event came from
* @param destination the widget where the event mitgh be generated now * @param destination the widget where the event mitgh be generated now
*/ */
void inputEventTransfertWidget(std::shared_ptr<ewol::Widget> _source, std::shared_ptr<ewol::Widget> _destination); void inputEventTransfertWidget(ewol::WidgetShared _source, ewol::WidgetShared _destination);
/** /**
* @brief This fonction lock the pointer properties to move in relative instead of absolute * @brief This fonction lock the pointer properties to move in relative instead of absolute
* @param[in] widget The widget that lock the pointer events * @param[in] widget The widget that lock the pointer events
*/ */
void inputEventGrabPointer(std::shared_ptr<ewol::Widget> _widget); void inputEventGrabPointer(ewol::WidgetShared _widget);
/** /**
* @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
*/ */

View File

@ -42,7 +42,7 @@ void ewol::context::InputManager::setDpi(int32_t newDPI) {
} }
bool ewol::context::InputManager::localEventInput(enum gale::key::type _type, bool ewol::context::InputManager::localEventInput(enum gale::key::type _type,
std::shared_ptr<ewol::Widget> _destWidget, ewol::WidgetShared _destWidget,
int32_t _IdInput, int32_t _IdInput,
enum gale::key::status _status, enum gale::key::status _status,
vec2 _pos) { vec2 _pos) {
@ -93,14 +93,14 @@ void ewol::context::InputManager::cleanElement(InputPoperty *_eventTable,
_eventTable[_idInput].posEvent.setValue(0,0); _eventTable[_idInput].posEvent.setValue(0,0);
} }
void ewol::context::InputManager::transfertEvent(std::shared_ptr<ewol::Widget> _source, std::shared_ptr<ewol::Widget> _destination) { void ewol::context::InputManager::transfertEvent(ewol::WidgetShared _source, ewol::WidgetShared _destination) {
if( _source == nullptr if( _source == nullptr
|| _destination == nullptr) { || _destination == nullptr) {
// prevent errors ... // prevent errors ...
return; return;
} }
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) { for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
std::shared_ptr<ewol::Widget> tmpWidget = m_eventInputSaved[iii].curentWidgetEvent.lock(); ewol::WidgetShared tmpWidget = m_eventInputSaved[iii].curentWidgetEvent.lock();
if (tmpWidget == _source) { if (tmpWidget == _source) {
// inform the widget that it does not receive the event now // inform the widget that it does not receive the event now
EVENT_DEBUG("GUI : Input ID=" << iii << " == >" << m_eventInputSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_ABORT] " << m_eventInputSaved[iii].posEvent); EVENT_DEBUG("GUI : Input ID=" << iii << " == >" << m_eventInputSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_ABORT] " << m_eventInputSaved[iii].posEvent);
@ -125,7 +125,7 @@ void ewol::context::InputManager::transfertEvent(std::shared_ptr<ewol::Widget> _
} }
} }
void ewol::context::InputManager::grabPointer(std::shared_ptr<ewol::Widget> _widget) { void ewol::context::InputManager::grabPointer(ewol::WidgetShared _widget) {
if(_widget == nullptr) { if(_widget == nullptr) {
return; return;
} }
@ -171,13 +171,13 @@ ewol::context::InputManager::~InputManager() {
} }
int32_t ewol::context::InputManager::localGetDestinationId(enum gale::key::type _type, int32_t ewol::context::InputManager::localGetDestinationId(enum gale::key::type _type,
std::shared_ptr<ewol::Widget> _destWidget, ewol::WidgetShared _destWidget,
int32_t _realInputId) { int32_t _realInputId) {
if (_type == gale::key::type_finger) { if (_type == gale::key::type_finger) {
int32_t lastMinimum = 0; int32_t lastMinimum = 0;
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) { for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
if (true == m_eventInputSaved[iii].isUsed) { if (true == m_eventInputSaved[iii].isUsed) {
std::shared_ptr<ewol::Widget> tmpWidget = m_eventInputSaved[iii].curentWidgetEvent.lock(); ewol::WidgetShared tmpWidget = m_eventInputSaved[iii].curentWidgetEvent.lock();
if (tmpWidget == _destWidget) { if (tmpWidget == _destWidget) {
if (iii != _realInputId) { if (iii != _realInputId) {
lastMinimum = std::max(lastMinimum, m_eventInputSaved[iii].destinationInputId); lastMinimum = std::max(lastMinimum, m_eventInputSaved[iii].destinationInputId);
@ -213,12 +213,12 @@ void ewol::context::InputManager::motion(enum gale::key::type _type,
// not manage input // not manage input
return; return;
} }
std::shared_ptr<ewol::widget::Windows> 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 :
std::shared_ptr<ewol::Widget> tmpWidget; ewol::WidgetShared tmpWidget;
if (m_grabWidget.lock() != nullptr) { if (m_grabWidget.lock() != nullptr) {
// grab all events ... // grab all events ...
tmpWidget = m_grabWidget.lock(); tmpWidget = m_grabWidget.lock();
@ -349,7 +349,7 @@ void ewol::context::InputManager::state(enum gale::key::type _type,
} }
// get the curent time ... // get the curent time ...
int64_t currentTime = ewol::getTime(); int64_t currentTime = ewol::getTime();
std::shared_ptr<ewol::widget::Windows> tmpWindows = m_context.getWindows(); ewol::widget::WindowsShared tmpWindows = m_context.getWindows();
if (true == _isDown) { if (true == _isDown) {
EVENT_DEBUG("GUI : Input ID=" << _pointerID EVENT_DEBUG("GUI : Input ID=" << _pointerID
@ -386,7 +386,7 @@ void ewol::context::InputManager::state(enum gale::key::type _type,
eventTable[_pointerID].lastTimeEvent = currentTime; eventTable[_pointerID].lastTimeEvent = currentTime;
// set the element inside ... // set the element inside ...
eventTable[_pointerID].isInside = true; eventTable[_pointerID].isInside = true;
std::shared_ptr<ewol::Widget> tmpWidget = m_grabWidget.lock(); ewol::WidgetShared tmpWidget = m_grabWidget.lock();
// get destination widget : // get destination widget :
if(nullptr != tmpWindows) { if(nullptr != tmpWindows) {
if ( tmpWidget != nullptr if ( tmpWidget != nullptr
@ -429,7 +429,7 @@ void ewol::context::InputManager::state(enum gale::key::type _type,
// revove the widget ... // revove the widget ...
eventTable[_pointerID].curentWidgetEvent.reset(); eventTable[_pointerID].curentWidgetEvent.reset();
} else { } else {
std::shared_ptr<ewol::Widget> tmpWidget = eventTable[_pointerID].curentWidgetEvent.lock(); 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,7 +21,7 @@ namespace ewol {
bool isUsed; bool isUsed;
int32_t destinationInputId; int32_t destinationInputId;
int64_t lastTimeEvent; int64_t lastTimeEvent;
std::weak_ptr<ewol::Widget> curentWidgetEvent; ewol::WidgetWeak curentWidgetEvent;
vec2 origin; vec2 origin;
vec2 size; vec2 size;
vec2 downStart; vec2 downStart;
@ -44,7 +44,7 @@ namespace ewol {
class InputManager{ class InputManager{
// special grab pointer mode : // special grab pointer mode :
private: private:
std::weak_ptr<ewol::Widget> m_grabWidget; //!< widget that grab the curent pointer. ewol::WidgetWeak m_grabWidget; //!< widget that grab the curent pointer.
private: private:
int32_t m_dpi; int32_t m_dpi;
InputLimit m_eventInputLimit; InputLimit m_eventInputLimit;
@ -64,7 +64,7 @@ namespace ewol {
* @return true if event has been greped * @return true if event has been greped
*/ */
bool localEventInput(enum gale::key::type _type, bool localEventInput(enum gale::key::type _type,
std::shared_ptr<ewol::Widget> _destWidget, ewol::WidgetShared _destWidget,
int32_t _IdInput, int32_t _IdInput,
enum gale::key::status _typeEvent, enum gale::key::status _typeEvent,
vec2 _pos); vec2 _pos);
@ -78,7 +78,7 @@ namespace ewol {
* @return the ewol input id * @return the ewol input id
*/ */
int32_t localGetDestinationId(enum gale::key::type _type, int32_t localGetDestinationId(enum gale::key::type _type,
std::shared_ptr<ewol::Widget> _destWidget, ewol::WidgetShared _destWidget,
int32_t _realInputId); int32_t _realInputId);
private: private:
ewol::Context& m_context; ewol::Context& m_context;
@ -100,12 +100,12 @@ namespace ewol {
* @param _source the widget where the event came from * @param _source the widget where the event came from
* @param _destination the widget where the event mitgh be generated now * @param _destination the widget where the event mitgh be generated now
*/ */
void transfertEvent(std::shared_ptr<ewol::Widget> _source, std::shared_ptr<ewol::Widget> _destination); void transfertEvent(ewol::WidgetShared _source, ewol::WidgetShared _destination);
/** /**
* @brief This fonction lock the pointer properties to move in relative instead of absolute * @brief This fonction lock the pointer properties to move in relative instead of absolute
* @param[in] _widget The widget that lock the pointer events * @param[in] _widget The widget that lock the pointer events
*/ */
void grabPointer(std::shared_ptr<ewol::Widget> _widget); void grabPointer(ewol::WidgetShared _widget);
/** /**
* @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
*/ */

View File

@ -76,7 +76,7 @@ namespace ewol {
enum gale::key::status _status, enum gale::key::status _status,
uint8_t _id, uint8_t _id,
const vec2& _pos, const vec2& _pos,
std::shared_ptr<ewol::Widget> _dest, ewol::WidgetShared _dest,
int32_t _realIdEvent, int32_t _realIdEvent,
gale::key::Special _specialKey) : gale::key::Special _specialKey) :
m_event(_type, _status, _id, _pos, _specialKey), m_event(_type, _status, _id, _pos, _specialKey),
@ -84,13 +84,13 @@ namespace ewol {
m_realIdEvent(_realIdEvent) { }; m_realIdEvent(_realIdEvent) { };
ewol::event::Input m_event; ewol::event::Input m_event;
private: private:
std::shared_ptr<ewol::Widget> m_dest; ewol::WidgetShared m_dest;
int32_t m_realIdEvent; int32_t m_realIdEvent;
public: public:
void setDestWidget(std::shared_ptr<ewol::Widget> _dest) { void setDestWidget(ewol::WidgetShared _dest) {
m_dest = _dest; m_dest = _dest;
}; };
inline std::shared_ptr<ewol::Widget> getDestWidget() const { inline ewol::WidgetShared getDestWidget() const {
return m_dest; return m_dest;
}; };
void setRealId(int32_t _realIdEvent) { void setRealId(int32_t _realIdEvent) {

28
ewol/memory.h Normal file
View File

@ -0,0 +1,28 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license APACHE v2.0 (see license file)
*/
#pragma once
#include <etk/types.h>
#include <vector>
#include <exml/exml.h>
#include <mutex>
#include <memory>
namespace ewol {
template<class TYPE>
using SharedPtr = std::shared_ptr<TYPE>;
template<class TYPE>
using WeakPtr = std::weak_ptr<TYPE>;
template<class TYPE>
using EnableSharedFromThis = std::enable_shared_from_this<TYPE>;
/*
template<class TYPE>
using DynamicPointerCastZZ = std::dynamic_pointer_cast<TYPE>;
*/
}

View File

@ -42,7 +42,7 @@ ewol::object::Manager::~Manager() {
void ewol::object::Manager::displayListObject() { void ewol::object::Manager::displayListObject() {
EWOL_INFO("List loaded object : "); EWOL_INFO("List loaded object : ");
for (auto &it : m_eObjectList) { for (auto &it : m_eObjectList) {
std::shared_ptr<ewol::Object> element = it.lock(); ewol::ObjectShared element = it.lock();
if (element != nullptr) { if (element != nullptr) {
EWOL_INFO(" [" << element->getId() << "] ref=" << element.use_count()-1 << " name='" << element->propertyName.get() << "' type=" << element->getObjectType()); EWOL_INFO(" [" << element->getId() << "] ref=" << element.use_count()-1 << " name='" << element->propertyName.get() << "' type=" << element->getObjectType());
} }
@ -56,7 +56,7 @@ void ewol::object::Manager::unInit() {
m_workerList.clear(); m_workerList.clear();
} }
for (auto &it : m_eObjectList) { for (auto &it : m_eObjectList) {
std::shared_ptr<ewol::Object> element = it.lock(); ewol::ObjectShared element = it.lock();
if (element != nullptr) { if (element != nullptr) {
//it->removeObject(); //it->removeObject();
} }
@ -67,7 +67,7 @@ void ewol::object::Manager::unInit() {
m_eObjectList.clear(); m_eObjectList.clear();
} }
void ewol::object::Manager::add(const std::shared_ptr<ewol::Object>& _object) { void ewol::object::Manager::add(const ewol::ObjectShared& _object) {
if (_object == nullptr) { if (_object == nullptr) {
EWOL_ERROR("try to add an inexistant Object in manager"); EWOL_ERROR("try to add an inexistant Object in manager");
} }
@ -95,12 +95,12 @@ void ewol::object::Manager::cleanInternalRemoved() {
} }
} }
std::shared_ptr<ewol::Object> ewol::object::Manager::get(const std::string& _name) { ewol::ObjectShared ewol::object::Manager::get(const std::string& _name) {
if (_name == "") { if (_name == "") {
return nullptr; return nullptr;
} }
for (auto &it : m_eObjectList) { for (auto &it : m_eObjectList) {
std::shared_ptr<ewol::Object> element = it.lock(); ewol::ObjectShared element = it.lock();
if ( element != nullptr if ( element != nullptr
&& element->propertyName.get() == _name) { && element->propertyName.get() == _name) {
return element; return element;
@ -110,16 +110,16 @@ std::shared_ptr<ewol::Object> ewol::object::Manager::get(const std::string& _nam
} }
std::shared_ptr<ewol::Object> ewol::object::Manager::getObjectNamed(const std::string& _name) { ewol::ObjectShared ewol::object::Manager::getObjectNamed(const std::string& _name) {
return ewol::object::Manager::get(_name); return ewol::object::Manager::get(_name);
} }
void ewol::object::Manager::workerAdd(const std::shared_ptr<ewol::Object>& _worker) { void ewol::object::Manager::workerAdd(const ewol::ObjectShared& _worker) {
m_workerList.push_back(_worker); m_workerList.push_back(_worker);
} }
void ewol::object::Manager::workerRemove(const std::shared_ptr<ewol::Object>& _worker) { void ewol::object::Manager::workerRemove(const ewol::ObjectShared& _worker) {
auto it(m_workerList.begin()); auto it(m_workerList.begin());
while (it != m_workerList.end()) { while (it != m_workerList.end()) {
if (*it == _worker) { if (*it == _worker) {

View File

@ -17,7 +17,7 @@ namespace ewol {
namespace object { namespace object {
class Manager : public esignal::Interface { class Manager : public esignal::Interface {
private: private:
std::vector<std::weak_ptr<ewol::Object>> m_eObjectList; // all widget allocated == > all time increment ... never removed ... std::vector<ewol::ObjectWeak> m_eObjectList; // all widget allocated == > all time increment ... never removed ...
Context& m_context; Context& m_context;
public: public:
Manager(Context& _context); Manager(Context& _context);
@ -43,7 +43,7 @@ namespace ewol {
* @note The manager remove the object when the refecence Low down 1 (last keeper) * @note The manager remove the object when the refecence Low down 1 (last keeper)
* @param[in] _object Reference shared pointer on the object * @param[in] _object Reference shared pointer on the object
*/ */
void add(const std::shared_ptr<ewol::Object>& _object); void add(const ewol::ObjectShared& _object);
public: public:
/** /**
* @brief clean the weak pointer list (remove weak_ptr that is remoed) * @brief clean the weak pointer list (remove weak_ptr that is remoed)
@ -54,27 +54,27 @@ namespace ewol {
* @param[in] _name Name of the Object * @param[in] _name Name of the Object
* @return Pointer on the finded Object. * @return Pointer on the finded Object.
*/ */
std::shared_ptr<ewol::Object> get(const std::string& _name); ewol::ObjectShared get(const std::string& _name);
public: public:
/** /**
* @brief retrive an object with his name * @brief retrive an object with his name
* @param[in] _name Name of the object * @param[in] _name Name of the object
* @return the requested object or nullptr * @return the requested object or nullptr
*/ */
std::shared_ptr<ewol::Object> getObjectNamed(const std::string& _name); ewol::ObjectShared getObjectNamed(const std::string& _name);
private: private:
std::vector<std::shared_ptr<ewol::Object>> m_workerList; std::vector<ewol::ObjectShared> m_workerList;
public: public:
/** /**
* @brief Add a worker on the system list. * @brief Add a worker on the system list.
* @param[in] _worker Worker to add in the list. * @param[in] _worker Worker to add in the list.
*/ */
void workerAdd(const std::shared_ptr<ewol::Object>& _worker); void workerAdd(const ewol::ObjectShared& _worker);
/** /**
* @brief Remove a worker on the system list. * @brief Remove a worker on the system list.
* @param[in] _worker Worker to add in the list. * @param[in] _worker Worker to add in the list.
*/ */
void workerRemove(const std::shared_ptr<ewol::Object>& _worker); void workerRemove(const ewol::ObjectShared& _worker);
public: public:
esignal::ISignal<ewol::event::Time> periodicCall; esignal::ISignal<ewol::event::Time> periodicCall;
private: private:

View File

@ -22,7 +22,7 @@ void ewol::Object::autoDestroy() {
return; return;
} }
EWOL_VERBOSE("Destroy object : [" << getId() << "] type:" << getObjectType()); EWOL_VERBOSE("Destroy object : [" << getId() << "] type:" << getObjectType());
std::shared_ptr<ewol::Object> 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) {
parent->requestDestroyFromChild(shared_from_this()); parent->requestDestroyFromChild(shared_from_this());
@ -31,12 +31,12 @@ void ewol::Object::autoDestroy() {
m_destroy = true; m_destroy = true;
} }
void ewol::Object::requestDestroyFromChild(const std::shared_ptr<ewol::Object>& _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::setParent(const std::shared_ptr<ewol::Object>& _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;
} }
@ -133,7 +133,7 @@ bool ewol::Object::storeXML(const std::shared_ptr<exml::Element>& _node) const {
} }
bool ewol::Object::propertySetOnWidgetNamed(const std::string& _objectName, const std::string& _config, const std::string& _value) { bool ewol::Object::propertySetOnWidgetNamed(const std::string& _objectName, const std::string& _config, const std::string& _value) {
std::shared_ptr<ewol::Object> object = getObjectManager().get(_objectName); ewol::ObjectShared object = getObjectManager().get(_objectName);
if (object == nullptr) { if (object == nullptr) {
return false; return false;
} }
@ -149,11 +149,11 @@ ewol::Context& ewol::Object::getContext() {
return ewol::getContext(); return ewol::getContext();
} }
std::shared_ptr<ewol::Object> ewol::Object::getObjectNamed(const std::string& _objectName) { ewol::ObjectShared ewol::Object::getObjectNamed(const std::string& _objectName) {
return getObjectManager().getObjectNamed(_objectName); return getObjectManager().getObjectNamed(_objectName);
} }
std::shared_ptr<ewol::Object> ewol::Object::getSubObjectNamed(const std::string& _objectName) { ewol::ObjectShared ewol::Object::getSubObjectNamed(const std::string& _objectName) {
EWOL_VERBOSE("check if name : " << _objectName << " ?= " << propertyName.get()); EWOL_VERBOSE("check if name : " << _objectName << " ?= " << propertyName.get());
if (_objectName == propertyName.get()) { if (_objectName == propertyName.get()) {
return shared_from_this(); return shared_from_this();
@ -163,7 +163,7 @@ std::shared_ptr<ewol::Object> ewol::Object::getSubObjectNamed(const std::string&
bool ewol::propertySetOnObjectNamed(const std::string& _objectName, const std::string& _config, const std::string& _value) { bool ewol::propertySetOnObjectNamed(const std::string& _objectName, const std::string& _config, const std::string& _value) {
std::shared_ptr<ewol::Object> object = ewol::getContext().getEObjectManager().get(_objectName); ewol::ObjectShared object = ewol::getContext().getEObjectManager().get(_objectName);
if (object == nullptr) { if (object == nullptr) {
return false; return false;
} }

View File

@ -15,27 +15,29 @@
#include <unordered_map> #include <unordered_map>
#include <ewol/debug.h> #include <ewol/debug.h>
#include <ewol/memory.h>
#include <eproperty/Interface.h> #include <eproperty/Interface.h>
#include <eproperty/Value.h> #include <eproperty/Value.h>
#include <eproperty/Range.h> #include <eproperty/Range.h>
#include <eproperty/List.h> #include <eproperty/List.h>
#include <esignal/Interface.h> #include <esignal/Interface.h>
namespace ewol { namespace ewol {
// some class need to define element befor other ... // some class need to define element befor other ...
class Object; class Object;
namespace object { namespace object {
class Manager; class Manager;
}; }
class Context; class Context;
}; }
template<class TYPE_OBJECT> static void baseInit(const std::shared_ptr<TYPE_OBJECT>& _object) { template<class TYPE_OBJECT> static void baseInit(const ewol::SharedPtr<TYPE_OBJECT>& _object) {
// end of recurtion // end of recurtion
return; return;
} }
template<class TYPE_OBJECT, class TYPE_VAL, class ... TYPE> static void baseInit(const std::shared_ptr<TYPE_OBJECT>& _object, const std::string& _name, const TYPE_VAL& _val, TYPE&& ... _all ) { template<class TYPE_OBJECT, class TYPE_VAL, class ... TYPE> static void baseInit(const ewol::SharedPtr<TYPE_OBJECT>& _object, const std::string& _name, const TYPE_VAL& _val, TYPE&& ... _all ) {
eproperty::Property* prop(nullptr); eproperty::Property* prop(nullptr);
eproperty::PropertyType<TYPE_VAL>* propType(nullptr); eproperty::PropertyType<TYPE_VAL>* propType(nullptr);
if (_object == nullptr) { if (_object == nullptr) {
@ -59,11 +61,11 @@ exit_on_error:
} }
#define UN_DECLARE_FACTORY(className) \ #define UN_DECLARE_FACTORY(className) \
template<typename ... TYPE> static std::shared_ptr<className> create(const TYPE& ... _all) = delete; template<class ... TYPE> static ewol::SharedPtr<className> create(const TYPE& ... _all) = delete;
#define DECLARE_FACTORY(className) \ #define DECLARE_FACTORY(className) \
template<typename ... TYPE> static std::shared_ptr<className> create(const TYPE& ... _all) { \ template<class ... TYPE> static ewol::SharedPtr<className> create(const TYPE& ... _all) { \
std::shared_ptr<className> object(new className()); \ ewol::SharedPtr<className> object(new className()); \
if (object == nullptr) { \ if (object == nullptr) { \
EWOL_ERROR("Factory error"); \ EWOL_ERROR("Factory error"); \
return nullptr; \ return nullptr; \
@ -79,9 +81,9 @@ exit_on_error:
} }
#define DECLARE_SINGLE_FACTORY(className, uniqueName) \ #define DECLARE_SINGLE_FACTORY(className, uniqueName) \
template<typename ... TYPE> static std::shared_ptr<className> create(const TYPE& ... _all) { \ template<class ... TYPE> static ewol::SharedPtr<className> create(const TYPE& ... _all) { \
std::shared_ptr<className> object; \ ewol::SharedPtr<className> object; \
std::shared_ptr<ewol::Object> object2 = getObjectNamed(uniqueName); \ ewol::SharedPtr<ewol::Object> object2 = getObjectNamed(uniqueName); \
if (object2 != nullptr) { \ if (object2 != nullptr) { \
object = std::dynamic_pointer_cast<className>(object2); \ object = std::dynamic_pointer_cast<className>(object2); \
if (object == nullptr) { \ if (object == nullptr) { \
@ -96,11 +98,13 @@ exit_on_error:
} }
namespace ewol { namespace ewol {
using ObjectShared = ewol::SharedPtr<ewol::Object>;
using ObjectWeak = ewol::WeakPtr<ewol::Object>;
/** /**
* @brief Basic message classes for ewol system * @brief Basic message classes for ewol system
* this class mermit at every Object to communicate between them. * this class mermit at every Object to communicate between them.
*/ */
class Object : public std::enable_shared_from_this<Object>, class Object : public ewol::EnableSharedFromThis<Object>,
public eproperty::Interface, public eproperty::Interface,
public esignal::Interface { public esignal::Interface {
public: // Event list public: // Event list
@ -130,7 +134,7 @@ namespace ewol {
return m_objectHasBeenInit; return m_objectHasBeenInit;
} }
protected: protected:
std::weak_ptr<Object> 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.
protected: protected:
/** /**
@ -157,12 +161,12 @@ namespace ewol {
* @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 std::shared_ptr<Object>& _child); virtual void requestDestroyFromChild(const ewol::ObjectShared& _child);
/** /**
* @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
*/ */
virtual void setParent(const std::shared_ptr<Object>& _newParent); virtual void setParent(const ewol::ObjectShared& _newParent);
/** /**
* @brief Remove the current parenting. * @brief Remove the current parenting.
*/ */
@ -264,20 +268,20 @@ namespace ewol {
* @param[in] _name Name of the object * @param[in] _name Name of the object
* @return the requested object or nullptr * @return the requested object or nullptr
*/ */
static std::shared_ptr<ewol::Object> getObjectNamed(const std::string& _objectName); static ewol::ObjectShared getObjectNamed(const std::string& _objectName);
/** /**
* @brief Retrive an object with his name (in the global list) * @brief Retrive an object with his name (in the global list)
* @param[in] _name Name of the object * @param[in] _name Name of the object
* @return the requested object or nullptr * @return the requested object or nullptr
*/ */
virtual std::shared_ptr<ewol::Object> getSubObjectNamed(const std::string& _objectName); virtual ewol::ObjectShared getSubObjectNamed(const std::string& _objectName);
protected: protected:
// TODO : Create a template ... // TODO : Create a template ...
/** /**
* @brief link on an signal in the subwiget with his name * @brief link on an signal in the subwiget with his name
*/ */
#define subBind(_type, _name, _event, _shared_ptr, _func, ...) do {\ #define subBind(_type, _name, _event, _shared_ptr, _func, ...) do {\
std::shared_ptr<_type> myObject = std::dynamic_pointer_cast<_type>(getSubObjectNamed(_name)); \ ewol::SharedPtr<_type> myObject = std::dynamic_pointer_cast<_type>(getSubObjectNamed(_name)); \
if (myObject != nullptr) { \ if (myObject != nullptr) { \
myObject->_event.connect(_shared_ptr, _func, ##__VA_ARGS__); \ myObject->_event.connect(_shared_ptr, _func, ##__VA_ARGS__); \
} else { \ } else { \
@ -285,13 +289,13 @@ namespace ewol {
} \ } \
} while (false) } while (false)
/* /*
template<class TYPE> void subBind(std::shared_ptr<ewol::Object> _obj, void (TYPE::*_func)()) { template<class TYPE> void subBind(ewol::SharedPtr<ewol::Object> _obj, void (TYPE::*_func)()) {
std::shared_ptr<TYPE> obj2 = std::dynamic_pointer_cast<TYPE>(_obj); ewol::SharedPtr<TYPE> obj2 = std::dynamic_pointer_cast<TYPE>(_obj);
if (obj2 == nullptr) { if (obj2 == nullptr) {
EWOL_ERROR("Can not connect signal ..."); EWOL_ERROR("Can not connect signal ...");
return; return;
} }
m_callerList.push_back(std::make_pair(std::weak_ptr<ewol::Object>(_obj), std::connect(_func, obj2.get()))); m_callerList.push_back(std::make_pair(ewol::ObjectWeak(_obj), std::connect(_func, obj2.get())));
} }
*/ */
}; };
@ -302,7 +306,7 @@ namespace ewol {
* @brief link on an signal in the global object list with his name * @brief link on an signal in the global object list with his name
*/ */
#define globalBind(_type, _name, _event, _obj, _func, ...) do {\ #define globalBind(_type, _name, _event, _obj, _func, ...) do {\
std::shared_ptr<_type> myObject = std::dynamic_pointer_cast<_type>(ewol::getContext().getEObjectManager().getObjectNamed(_name)); \ ewol::SharedPtr<_type> myObject = std::dynamic_pointer_cast<_type>(ewol::getContext().getEObjectManager().getObjectNamed(_name)); \
if (myObject != nullptr) { \ if (myObject != nullptr) { \
myObject->_event.connect(_obj, _func, ##__VA_ARGS__); \ myObject->_event.connect(_obj, _func, ##__VA_ARGS__); \
} else { \ } else { \
@ -314,7 +318,7 @@ namespace ewol {
* @brief link on an signal in the subWidget of an object with his name * @brief link on an signal in the subWidget of an object with his name
*/ */
#define externSubBind(_object, _type, _name, _event, _obj, _func, ...) do {\ #define externSubBind(_object, _type, _name, _event, _obj, _func, ...) do {\
std::shared_ptr<_type> myObject = std::dynamic_pointer_cast<_type>(_object->getObjectNamed(_name)); \ ewol::SharedPtr<_type> myObject = std::dynamic_pointer_cast<_type>(_object->getObjectNamed(_name)); \
if (myObject != nullptr) { \ if (myObject != nullptr) { \
myObject->_event.connect(_obj, _func, ##__VA_ARGS__); \ myObject->_event.connect(_obj, _func, ##__VA_ARGS__); \
} else { \ } else { \

View File

@ -12,6 +12,9 @@
namespace ewol { namespace ewol {
namespace object { namespace object {
class Worker;
using WorkerShared = ewol::SharedPtr<ewol::object::Worker>;
using WorkerWeak = ewol::WeakPtr<ewol::object::Worker>;
/** /**
* @brief A worker might not been possesed by someone, then the system might keep a pointer on it. * @brief A worker might not been possesed by someone, then the system might keep a pointer on it.
*/ */

View File

@ -20,6 +20,9 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class Button;
using ButtonShared = ewol::SharedPtr<ewol::widget::Button>;
using ButtonWeak = ewol::WeakPtr<ewol::widget::Button>;
/** /**
* @brief a composed button is a button with an inside composed with the specify XML element * @brief a composed button is a button with an inside composed with the specify XML element
* ==> this permit to generate standard element simple * ==> this permit to generate standard element simple

View File

@ -171,12 +171,12 @@ bool ewol::widget::ButtonColor::onEventInput(const ewol::event::Input& _event) {
tmpPos.setX( tmpPos.x() - m_minSize.x()/2.0); tmpPos.setX( tmpPos.x() - m_minSize.x()/2.0);
m_widgetContextMenu->setPositionMark(ewol::widget::ContextMenu::markButtom, tmpPos ); m_widgetContextMenu->setPositionMark(ewol::widget::ContextMenu::markButtom, tmpPos );
std::shared_ptr<ewol::widget::ColorChooser> myColorChooser = widget::ColorChooser::create(); ewol::widget::ColorChooserShared myColorChooser = widget::ColorChooser::create();
myColorChooser->propertyValue.set(propertyValue.get()); myColorChooser->propertyValue.set(propertyValue.get());
// set it in the pop-up-system : // set it in the pop-up-system :
m_widgetContextMenu->setSubWidget(myColorChooser); m_widgetContextMenu->setSubWidget(myColorChooser);
myColorChooser->signalChange.connect(shared_from_this(), &ewol::widget::ButtonColor::onCallbackColorChange); myColorChooser->signalChange.connect(shared_from_this(), &ewol::widget::ButtonColor::onCallbackColorChange);
std::shared_ptr<ewol::widget::Windows> currentWindows = getWindows(); ewol::widget::WindowsShared currentWindows = getWindows();
if (currentWindows == nullptr) { if (currentWindows == nullptr) {
EWOL_ERROR("Can not get the curent Windows..."); EWOL_ERROR("Can not get the curent Windows...");
m_widgetContextMenu.reset(); m_widgetContextMenu.reset();

View File

@ -19,6 +19,9 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class ButtonColor;
using ButtonColorShared = ewol::SharedPtr<ewol::widget::ButtonColor>;
using ButtonColorWeak = ewol::WeakPtr<ewol::widget::ButtonColor>;
class ButtonColor : public ewol::Widget { class ButtonColor : public ewol::Widget {
public: // signals public: // signals
esignal::ISignal<etk::Color<>> signalChange; esignal::ISignal<etk::Color<>> signalChange;
@ -28,7 +31,7 @@ namespace ewol {
private: private:
ewol::compositing::Shaper m_shaper; //!< Compositing theme. ewol::compositing::Shaper m_shaper; //!< Compositing theme.
ewol::compositing::Text m_text; //!< Compositing Test display. ewol::compositing::Text m_text; //!< Compositing Test display.
std::shared_ptr<ewol::widget::ContextMenu> m_widgetContextMenu; //!< Specific context menu. ewol::widget::ContextMenuShared m_widgetContextMenu; //!< Specific context menu.
bool m_mouseHover; //!< Flag to know where the mouse is (inside the displayed widget (if not fill)). bool m_mouseHover; //!< Flag to know where the mouse is (inside the displayed widget (if not fill)).
bool m_buttonPressed; //!< Flag to know if the button is curently pressed. bool m_buttonPressed; //!< Flag to know if the button is curently pressed.
// hover area : // hover area :

View File

@ -17,6 +17,9 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class CheckBox;
using CheckBoxShared = ewol::SharedPtr<ewol::widget::CheckBox>;
using CheckBoxWeak = ewol::WeakPtr<ewol::widget::CheckBox>;
class CheckBox : public ewol::widget::Container2 { class CheckBox : public ewol::widget::Container2 {
public: // Event list public: // Event list
esignal::ISignal<> signalPressed; esignal::ISignal<> signalPressed;

View File

@ -17,6 +17,9 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class ColorBar;
using ColorBarShared = ewol::SharedPtr<ewol::widget::ColorBar>;
using ColorBarWeak = ewol::WeakPtr<ewol::widget::ColorBar>;
class ColorBar : public ewol::Widget { class ColorBar : public ewol::Widget {
public: // signals public: // signals
esignal::ISignal<etk::Color<>> signalChange; esignal::ISignal<etk::Color<>> signalChange;

View File

@ -21,7 +21,7 @@ ewol::widget::Composer::Composer() {
// nothing to do ... // nothing to do ...
} }
static std::shared_ptr<ewol::Widget> composerGenerate(bool _modeFile, const std::string& _data) { static ewol::WidgetShared composerGenerate(bool _modeFile, const std::string& _data) {
ewol::widget::Manager& widgetManager = ewol::getContext().getWidgetManager(); ewol::widget::Manager& widgetManager = ewol::getContext().getWidgetManager();
if (_data == "") { if (_data == "") {
return nullptr; return nullptr;
@ -57,7 +57,7 @@ static std::shared_ptr<ewol::Widget> composerGenerate(bool _modeFile, const std:
return nullptr; return nullptr;
} }
EWOL_DEBUG("try to create subwidget : '" << widgetName << "'"); EWOL_DEBUG("try to create subwidget : '" << widgetName << "'");
std::shared_ptr<ewol::Widget> tmpWidget = widgetManager.create(widgetName); ewol::WidgetShared tmpWidget = widgetManager.create(widgetName);
if (tmpWidget == nullptr) { if (tmpWidget == nullptr) {
EWOL_ERROR ("(l "<<pNode->getPos()<<") Can not create the widget : \"" << widgetName << "\""); EWOL_ERROR ("(l "<<pNode->getPos()<<") Can not create the widget : \"" << widgetName << "\"");
return nullptr; return nullptr;
@ -68,11 +68,11 @@ static std::shared_ptr<ewol::Widget> composerGenerate(bool _modeFile, const std:
return tmpWidget; return tmpWidget;
} }
std::shared_ptr<ewol::Widget> ewol::widget::composerGenerateFile(const std::string& _data) { ewol::WidgetShared ewol::widget::composerGenerateFile(const std::string& _data) {
return composerGenerate(true, _data); return composerGenerate(true, _data);
} }
std::shared_ptr<ewol::Widget> ewol::widget::composerGenerateString(const std::string& _data) { ewol::WidgetShared ewol::widget::composerGenerateString(const std::string& _data) {
return composerGenerate(false, _data); return composerGenerate(false, _data);
} }

View File

@ -13,6 +13,9 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class Composer;
using ComposerShared = ewol::SharedPtr<ewol::widget::Composer>;
using ComposerWeak = ewol::WeakPtr<ewol::widget::Composer>;
/** /**
* @ingroup ewolWidgetGroup * @ingroup ewolWidgetGroup
* @brief the composer widget is a widget that create a link on a string.file to parse the data and generate some widget tree * @brief the composer widget is a widget that create a link on a string.file to parse the data and generate some widget tree
@ -44,7 +47,7 @@ namespace ewol {
*/ */
bool loadFromString(const std::string& _composerXmlString); bool loadFromString(const std::string& _composerXmlString);
}; };
std::shared_ptr<ewol::Widget> composerGenerateString(const std::string& _data = ""); ewol::WidgetShared composerGenerateString(const std::string& _data = "");
std::shared_ptr<ewol::Widget> composerGenerateFile(const std::string& _data = ""); ewol::WidgetShared composerGenerateFile(const std::string& _data = "");
}; };
}; };

View File

@ -25,11 +25,11 @@ ewol::widget::Container::~Container() {
subWidgetRemove(); subWidgetRemove();
} }
std::shared_ptr<ewol::Widget> ewol::widget::Container::getSubWidget() { ewol::WidgetShared ewol::widget::Container::getSubWidget() {
return m_subWidget; return m_subWidget;
} }
void ewol::widget::Container::setSubWidget(std::shared_ptr<ewol::Widget> _newWidget) { void ewol::widget::Container::setSubWidget(ewol::WidgetShared _newWidget) {
if (_newWidget == nullptr) { if (_newWidget == nullptr) {
return; return;
} }
@ -42,8 +42,8 @@ void ewol::widget::Container::setSubWidget(std::shared_ptr<ewol::Widget> _newWid
requestUpdateSize(); requestUpdateSize();
} }
void ewol::widget::Container::subWidgetReplace(const std::shared_ptr<ewol::Widget>& _oldWidget, void ewol::widget::Container::subWidgetReplace(const ewol::WidgetShared& _oldWidget,
const std::shared_ptr<ewol::Widget>& _newWidget) { const ewol::WidgetShared& _newWidget) {
if (m_subWidget != _oldWidget) { if (m_subWidget != _oldWidget) {
EWOL_WARNING("Request replace with a wrong old widget"); EWOL_WARNING("Request replace with a wrong old widget");
return; return;
@ -74,8 +74,8 @@ void ewol::widget::Container::subWidgetUnLink() {
m_subWidget.reset(); m_subWidget.reset();
} }
std::shared_ptr<ewol::Object> ewol::widget::Container::getSubObjectNamed(const std::string& _objectName) { ewol::ObjectShared ewol::widget::Container::getSubObjectNamed(const std::string& _objectName) {
std::shared_ptr<ewol::Object> tmpObject = ewol::Widget::getSubObjectNamed(_objectName); ewol::ObjectShared tmpObject = ewol::Widget::getSubObjectNamed(_objectName);
if (tmpObject != nullptr) { if (tmpObject != nullptr) {
return tmpObject; return tmpObject;
} }
@ -130,7 +130,7 @@ void ewol::widget::Container::onRegenerateDisplay() {
} }
} }
std::shared_ptr<ewol::Widget> ewol::widget::Container::getWidgetAtPos(const vec2& _pos) { ewol::WidgetShared ewol::widget::Container::getWidgetAtPos(const vec2& _pos) {
if (propertyHide.get() == false) { if (propertyHide.get() == false) {
if (m_subWidget != nullptr) { if (m_subWidget != nullptr) {
return m_subWidget->getWidgetAtPos(_pos); return m_subWidget->getWidgetAtPos(_pos);
@ -164,7 +164,7 @@ bool ewol::widget::Container::loadXML(const std::shared_ptr<const exml::Element>
continue; continue;
} }
EWOL_DEBUG("try to create subwidget : '" << widgetName << "'"); EWOL_DEBUG("try to create subwidget : '" << widgetName << "'");
std::shared_ptr<ewol::Widget> tmpWidget = getWidgetManager().create(widgetName); ewol::WidgetShared tmpWidget = getWidgetManager().create(widgetName);
if (tmpWidget == nullptr) { if (tmpWidget == nullptr) {
EWOL_ERROR ("(l "<<pNode->getPos()<<") Can not create the widget : \"" << widgetName << "\""); EWOL_ERROR ("(l "<<pNode->getPos()<<") Can not create the widget : \"" << widgetName << "\"");
continue; continue;
@ -187,7 +187,7 @@ void ewol::widget::Container::setOffset(const vec2& _newVal) {
} }
} }
void ewol::widget::Container::requestDestroyFromChild(const std::shared_ptr<Object>& _child) { void ewol::widget::Container::requestDestroyFromChild(const ewol::ObjectShared& _child) {
if (m_subWidget != _child) { if (m_subWidget != _child) {
return; return;
} }

View File

@ -13,13 +13,16 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class Container;
using ContainerShared = ewol::SharedPtr<ewol::widget::Container>;
using ContainerWeak = ewol::WeakPtr<ewol::widget::Container>;
/** /**
* @ingroup ewolWidgetGroup * @ingroup ewolWidgetGroup
* @brief the Cotainer widget is a widget that have an only one subWidget * @brief the Cotainer widget is a widget that have an only one subWidget
*/ */
class Container : public ewol::Widget { class Container : public ewol::Widget {
protected: protected:
std::shared_ptr<ewol::Widget> m_subWidget; ewol::WidgetShared m_subWidget;
protected: protected:
/** /**
* @brief Constructor * @brief Constructor
@ -35,19 +38,19 @@ namespace ewol {
* @brief get the main node widget * @brief get the main node widget
* @return the requested pointer on the node * @return the requested pointer on the node
*/ */
std::shared_ptr<ewol::Widget> getSubWidget(); ewol::WidgetShared getSubWidget();
/** /**
* @brief set the subWidget node widget. * @brief set the subWidget node widget.
* @param[in] _newWidget The widget to add. * @param[in] _newWidget The widget to add.
*/ */
void setSubWidget(std::shared_ptr<ewol::Widget> _newWidget); void setSubWidget(ewol::WidgetShared _newWidget);
/** /**
* @brief Replace a old subwidget with a new one. * @brief Replace a old subwidget with a new one.
* @param[in] _oldWidget The widget to replace. * @param[in] _oldWidget The widget to replace.
* @param[in] _newWidget The widget to set. * @param[in] _newWidget The widget to set.
*/ */
virtual void subWidgetReplace(const std::shared_ptr<ewol::Widget>& _oldWidget, virtual void subWidgetReplace(const ewol::WidgetShared& _oldWidget,
const std::shared_ptr<ewol::Widget>& _newWidget); const ewol::WidgetShared& _newWidget);
/** /**
* @brief remove the subWidget node (async). * @brief remove the subWidget node (async).
*/ */
@ -61,11 +64,11 @@ namespace ewol {
virtual void onRegenerateDisplay(); virtual void onRegenerateDisplay();
virtual void onChangeSize(); virtual void onChangeSize();
virtual void calculateMinMaxSize(); virtual void calculateMinMaxSize();
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos); virtual ewol::WidgetShared getWidgetAtPos(const vec2& _pos);
virtual std::shared_ptr<ewol::Object> getSubObjectNamed(const std::string& _objectName); virtual ewol::ObjectShared getSubObjectNamed(const std::string& _objectName);
virtual bool loadXML(const std::shared_ptr<const exml::Element>& _node); virtual bool loadXML(const std::shared_ptr<const exml::Element>& _node);
virtual void setOffset(const vec2& _newVal); virtual void setOffset(const vec2& _newVal);
virtual void requestDestroyFromChild(const std::shared_ptr<Object>& _child); virtual void requestDestroyFromChild(const ewol::ObjectShared& _child);
}; };
}; };
}; };

View File

@ -26,7 +26,7 @@ ewol::widget::Container2::~Container2() {
subWidgetRemoveToggle(); subWidgetRemoveToggle();
} }
void ewol::widget::Container2::setSubWidget(std::shared_ptr<ewol::Widget> _newWidget, int32_t _idWidget) { void ewol::widget::Container2::setSubWidget(ewol::WidgetShared _newWidget, int32_t _idWidget) {
subWidgetRemove(_idWidget); subWidgetRemove(_idWidget);
m_subWidget[_idWidget] = _newWidget; m_subWidget[_idWidget] = _newWidget;
if (m_subWidget[_idWidget] != nullptr) { if (m_subWidget[_idWidget] != nullptr) {
@ -37,8 +37,8 @@ void ewol::widget::Container2::setSubWidget(std::shared_ptr<ewol::Widget> _newWi
requestUpdateSize(); requestUpdateSize();
} }
void ewol::widget::Container2::subWidgetReplace(const std::shared_ptr<ewol::Widget>& _oldWidget, void ewol::widget::Container2::subWidgetReplace(const ewol::WidgetShared& _oldWidget,
const std::shared_ptr<ewol::Widget>& _newWidget) { const ewol::WidgetShared& _newWidget) {
bool haveChange = false; bool haveChange = false;
for (size_t iii=0; iii<2; ++iii) { for (size_t iii=0; iii<2; ++iii) {
if (m_subWidget[iii] != _oldWidget) { if (m_subWidget[iii] != _oldWidget) {
@ -79,8 +79,8 @@ void ewol::widget::Container2::subWidgetUnLink(int32_t _idWidget) {
m_subWidget[_idWidget].reset(); m_subWidget[_idWidget].reset();
} }
std::shared_ptr<ewol::Object> ewol::widget::Container2::getSubObjectNamed(const std::string& _widgetName) { ewol::ObjectShared ewol::widget::Container2::getSubObjectNamed(const std::string& _widgetName) {
std::shared_ptr<ewol::Object> tmpObject = ewol::Widget::getSubObjectNamed(_widgetName); ewol::ObjectShared tmpObject = ewol::Widget::getSubObjectNamed(_widgetName);
if (tmpObject != nullptr) { if (tmpObject != nullptr) {
return tmpObject; return tmpObject;
} }
@ -165,7 +165,7 @@ void ewol::widget::Container2::onRegenerateDisplay() {
} }
} }
/* /*
std::shared_ptr<ewol::Widget> ewol::widget::Container2::getWidgetAtPos(const vec2& _pos) { ewol::WidgetShared ewol::widget::Container2::getWidgetAtPos(const vec2& _pos) {
if (isHide() == false) { if (isHide() == false) {
if (m_subWidget[m_idWidgetDisplayed] != nullptr) { if (m_subWidget[m_idWidgetDisplayed] != nullptr) {
return m_subWidget[m_idWidgetDisplayed]->getWidgetAtPos(_pos); return m_subWidget[m_idWidgetDisplayed]->getWidgetAtPos(_pos);
@ -205,7 +205,7 @@ bool ewol::widget::Container2::loadXML(const std::shared_ptr<const exml::Element
} }
} }
EWOL_DEBUG("try to create subwidget : '" << widgetName << "'"); EWOL_DEBUG("try to create subwidget : '" << widgetName << "'");
std::shared_ptr<ewol::Widget> tmpWidget = getWidgetManager().create(widgetName); ewol::WidgetShared tmpWidget = getWidgetManager().create(widgetName);
if (tmpWidget == nullptr) { if (tmpWidget == nullptr) {
EWOL_ERROR ("(l "<<pNode->getPos()<<") Can not create the widget : \"" << widgetName << "\""); EWOL_ERROR ("(l "<<pNode->getPos()<<") Can not create the widget : \"" << widgetName << "\"");
continue; continue;
@ -232,7 +232,7 @@ void ewol::widget::Container2::setOffset(const vec2& _newVal) {
} }
} }
void ewol::widget::Container2::requestDestroyFromChild(const std::shared_ptr<Object>& _child) { void ewol::widget::Container2::requestDestroyFromChild(const ewol::ObjectShared& _child) {
if (m_subWidget[0] == _child) { if (m_subWidget[0] == _child) {
if (m_subWidget[0] == nullptr) { if (m_subWidget[0] == nullptr) {
return; return;

View File

@ -14,13 +14,16 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class Container2;
using Container2Shared = ewol::SharedPtr<ewol::widget::Container2>;
using Container2Weak = ewol::WeakPtr<ewol::widget::Container2>;
/** /**
* @ingroup ewolWidgetGroup * @ingroup ewolWidgetGroup
* @brief the Cotainer widget is a widget that have an only one subWidget * @brief the Cotainer widget is a widget that have an only one subWidget
*/ */
class Container2 : public ewol::Widget { class Container2 : public ewol::Widget {
protected: protected:
std::shared_ptr<ewol::Widget> m_subWidget[2]; //!< 2 subwidget possible ewol::WidgetShared m_subWidget[2]; //!< 2 subwidget possible
int32_t m_idWidgetDisplayed; //!< current widget displayed int32_t m_idWidgetDisplayed; //!< current widget displayed
protected: protected:
/** /**
@ -40,20 +43,20 @@ namespace ewol {
* @param[in] _subWidget Widget to add normal * @param[in] _subWidget Widget to add normal
* @param[in] _idWidget Id of the widget to set * @param[in] _idWidget Id of the widget to set
*/ */
void setSubWidget(std::shared_ptr<ewol::Widget> _subWidget, int32_t _idWidget); void setSubWidget(ewol::WidgetShared _subWidget, int32_t _idWidget);
public: public:
/** /**
* @brief Specify the current widget * @brief Specify the current widget
* @param[in] _subWidget Widget to add normal * @param[in] _subWidget Widget to add normal
*/ */
void setSubWidget(std::shared_ptr<ewol::Widget> _subWidget) { void setSubWidget(ewol::WidgetShared _subWidget) {
setSubWidget(_subWidget, 0); setSubWidget(_subWidget, 0);
} }
/** /**
* @brief Specify the current toggle widget * @brief Specify the current toggle widget
* @param[in] _subWidget Widget to add Toggle * @param[in] _subWidget Widget to add Toggle
*/ */
void setSubWidgetToggle(std::shared_ptr<ewol::Widget> _subWidget) { void setSubWidgetToggle(ewol::WidgetShared _subWidget) {
setSubWidget(_subWidget, 1); setSubWidget(_subWidget, 1);
} }
private: private:
@ -62,7 +65,7 @@ namespace ewol {
* @param[in] _idWidget Id of the widget to set * @param[in] _idWidget Id of the widget to set
* @return The base widget * @return The base widget
*/ */
std::shared_ptr<ewol::Widget> getSubWidget(int32_t _idWidget) const { ewol::WidgetShared getSubWidget(int32_t _idWidget) const {
return m_subWidget[_idWidget]; return m_subWidget[_idWidget];
}; };
public: public:
@ -70,14 +73,14 @@ namespace ewol {
* @brief get the current displayed composition * @brief get the current displayed composition
* @return The base widget * @return The base widget
*/ */
std::shared_ptr<ewol::Widget> getSubWidget() const { ewol::WidgetShared getSubWidget() const {
return getSubWidget(0); return getSubWidget(0);
}; };
/** /**
* @brief get the current displayed composition * @brief get the current displayed composition
* @return The toggle widget * @return The toggle widget
*/ */
std::shared_ptr<ewol::Widget> getSubWidgetToggle() const { ewol::WidgetShared getSubWidgetToggle() const {
return getSubWidget(1); return getSubWidget(1);
}; };
private: private:
@ -152,8 +155,8 @@ namespace ewol {
* @param[in] _oldWidget The widget to replace. * @param[in] _oldWidget The widget to replace.
* @param[in] _newWidget The widget to set. * @param[in] _newWidget The widget to set.
*/ */
virtual void subWidgetReplace(const std::shared_ptr<ewol::Widget>& _oldWidget, virtual void subWidgetReplace(const ewol::WidgetShared& _oldWidget,
const std::shared_ptr<ewol::Widget>& _newWidget); const ewol::WidgetShared& _newWidget);
public: // Derived function public: // Derived function
virtual void systemDraw(const ewol::DrawProperty& _displayProp); virtual void systemDraw(const ewol::DrawProperty& _displayProp);
virtual void onRegenerateDisplay(); virtual void onRegenerateDisplay();
@ -163,11 +166,11 @@ namespace ewol {
virtual void calculateMinMaxSize() { virtual void calculateMinMaxSize() {
calculateMinMaxSizePadded(); calculateMinMaxSizePadded();
} }
//virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos); //virtual ewol::WidgetShared getWidgetAtPos(const vec2& _pos);
virtual std::shared_ptr<ewol::Object> getSubObjectNamed(const std::string& _objectName); virtual ewol::ObjectShared getSubObjectNamed(const std::string& _objectName);
virtual bool loadXML(const std::shared_ptr<const exml::Element>& _node); virtual bool loadXML(const std::shared_ptr<const exml::Element>& _node);
virtual void setOffset(const vec2& _newVal); virtual void setOffset(const vec2& _newVal);
virtual void requestDestroyFromChild(const std::shared_ptr<Object>& _child); virtual void requestDestroyFromChild(const ewol::ObjectShared& _child);
}; };
}; };
}; };

View File

@ -51,8 +51,8 @@ void ewol::widget::ContainerN::onChangePropertyLockExpand() {
requestUpdateSize(); requestUpdateSize();
} }
void ewol::widget::ContainerN::subWidgetReplace(const std::shared_ptr<ewol::Widget>& _oldWidget, void ewol::widget::ContainerN::subWidgetReplace(const ewol::WidgetShared& _oldWidget,
const std::shared_ptr<ewol::Widget>& _newWidget) { const ewol::WidgetShared& _newWidget) {
bool haveChange = false; bool haveChange = false;
for (auto &it : m_subWidget) { for (auto &it : m_subWidget) {
if (it != _oldWidget) { if (it != _oldWidget) {
@ -74,7 +74,7 @@ void ewol::widget::ContainerN::subWidgetReplace(const std::shared_ptr<ewol::Widg
requestUpdateSize(); requestUpdateSize();
} }
int32_t ewol::widget::ContainerN::subWidgetAdd(std::shared_ptr<ewol::Widget> _newWidget) { int32_t ewol::widget::ContainerN::subWidgetAdd(ewol::WidgetShared _newWidget) {
if (_newWidget == nullptr) { if (_newWidget == nullptr) {
EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} Try to add An empty Widget ... "); EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} Try to add An empty Widget ... ");
return -1; return -1;
@ -87,7 +87,7 @@ int32_t ewol::widget::ContainerN::subWidgetAdd(std::shared_ptr<ewol::Widget> _ne
return _newWidget->getId(); return _newWidget->getId();
} }
int32_t ewol::widget::ContainerN::subWidgetAddStart(std::shared_ptr<ewol::Widget> _newWidget) { int32_t ewol::widget::ContainerN::subWidgetAddStart(ewol::WidgetShared _newWidget) {
if (nullptr == _newWidget) { if (nullptr == _newWidget) {
EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} Try to add start An empty Widget ... "); EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} Try to add start An empty Widget ... ");
return -1; return -1;
@ -101,7 +101,7 @@ int32_t ewol::widget::ContainerN::subWidgetAddStart(std::shared_ptr<ewol::Widget
return _newWidget->getId(); return _newWidget->getId();
} }
void ewol::widget::ContainerN::subWidgetRemove(std::shared_ptr<ewol::Widget> _newWidget) { void ewol::widget::ContainerN::subWidgetRemove(ewol::WidgetShared _newWidget) {
if (nullptr == _newWidget) { if (nullptr == _newWidget) {
return; return;
} }
@ -121,7 +121,7 @@ void ewol::widget::ContainerN::subWidgetRemove(std::shared_ptr<ewol::Widget> _ne
} }
} }
void ewol::widget::ContainerN::subWidgetUnLink(std::shared_ptr<ewol::Widget> _newWidget) { void ewol::widget::ContainerN::subWidgetUnLink(ewol::WidgetShared _newWidget) {
if (nullptr == _newWidget) { if (nullptr == _newWidget) {
return; return;
} }
@ -154,8 +154,8 @@ void ewol::widget::ContainerN::subWidgetRemoveAllDelayed() {
subWidgetRemoveAll(); subWidgetRemoveAll();
} }
std::shared_ptr<ewol::Object> ewol::widget::ContainerN::getSubObjectNamed(const std::string& _objectName) { ewol::ObjectShared ewol::widget::ContainerN::getSubObjectNamed(const std::string& _objectName) {
std::shared_ptr<ewol::Object> tmpObject = ewol::Widget::getSubObjectNamed(_objectName); ewol::ObjectShared tmpObject = ewol::Widget::getSubObjectNamed(_objectName);
if (tmpObject != nullptr) { if (tmpObject != nullptr) {
return tmpObject; return tmpObject;
} }
@ -229,7 +229,7 @@ void ewol::widget::ContainerN::onRegenerateDisplay() {
} }
} }
std::shared_ptr<ewol::Widget> ewol::widget::ContainerN::getWidgetAtPos(const vec2& _pos) { ewol::WidgetShared ewol::widget::ContainerN::getWidgetAtPos(const vec2& _pos) {
if (*propertyHide == true) { if (*propertyHide == true) {
return nullptr; return nullptr;
} }
@ -241,7 +241,7 @@ std::shared_ptr<ewol::Widget> ewol::widget::ContainerN::getWidgetAtPos(const vec
if( (tmpOrigin.x() <= _pos.x() && tmpOrigin.x() + tmpSize.x() >= _pos.x()) if( (tmpOrigin.x() <= _pos.x() && tmpOrigin.x() + tmpSize.x() >= _pos.x())
&& (tmpOrigin.y() <= _pos.y() && tmpOrigin.y() + tmpSize.y() >= _pos.y()) ) && (tmpOrigin.y() <= _pos.y() && tmpOrigin.y() + tmpSize.y() >= _pos.y()) )
{ {
std::shared_ptr<ewol::Widget> tmpWidget = it->getWidgetAtPos(_pos); ewol::WidgetShared tmpWidget = it->getWidgetAtPos(_pos);
if (tmpWidget != nullptr) { if (tmpWidget != nullptr) {
return tmpWidget; return tmpWidget;
} }
@ -285,7 +285,7 @@ bool ewol::widget::ContainerN::loadXML(const std::shared_ptr<const exml::Element
continue; continue;
} }
EWOL_DEBUG("[" << getId() << "] {" << getObjectType() << "} load new element : \"" << widgetName << "\""); EWOL_DEBUG("[" << getId() << "] {" << getObjectType() << "} load new element : \"" << widgetName << "\"");
std::shared_ptr<ewol::Widget> subWidget = getWidgetManager().create(widgetName); ewol::WidgetShared subWidget = getWidgetManager().create(widgetName);
if (subWidget == nullptr) { if (subWidget == nullptr) {
EWOL_ERROR ("[" << getId() << "] {" << getObjectType() << "} (l "<<pNode->getPos()<<") Can not create the widget : \"" << widgetName << "\""); EWOL_ERROR ("[" << getId() << "] {" << getObjectType() << "} (l "<<pNode->getPos()<<") Can not create the widget : \"" << widgetName << "\"");
continue; continue;
@ -313,7 +313,7 @@ void ewol::widget::ContainerN::setOffset(const vec2& _newVal) {
} }
} }
void ewol::widget::ContainerN::requestDestroyFromChild(const std::shared_ptr<Object>& _child) { void ewol::widget::ContainerN::requestDestroyFromChild(const ewol::ObjectShared& _child) {
auto it = m_subWidget.begin(); auto it = m_subWidget.begin();
while (it != m_subWidget.end()) { while (it != m_subWidget.end()) {
if (*it == _child) { if (*it == _child) {

View File

@ -14,6 +14,9 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class ContainerN;
using ContainerNShared = ewol::SharedPtr<ewol::widget::ContainerN>;
using ContainerNWeak = ewol::WeakPtr<ewol::widget::ContainerN>;
/** /**
* @ingroup ewolWidgetGroup * @ingroup ewolWidgetGroup
* @brief the Cotainer widget is a widget that have an only one subWidget * @brief the Cotainer widget is a widget that have an only one subWidget
@ -22,7 +25,7 @@ namespace ewol {
public: // properties: public: // properties:
eproperty::Value<bvec2> propertyLockExpand; //!< Lock the expend of the sub widget to this one == > this permit to limit bigger subWidget eproperty::Value<bvec2> propertyLockExpand; //!< Lock the expend of the sub widget to this one == > this permit to limit bigger subWidget
protected: protected:
std::list<std::shared_ptr<ewol::Widget>> m_subWidget; std::list<ewol::WidgetShared> m_subWidget;
protected: protected:
/** /**
* @brief Constructor * @brief Constructor
@ -51,20 +54,20 @@ namespace ewol {
* @param[in] _oldWidget The widget to replace. * @param[in] _oldWidget The widget to replace.
* @param[in] _newWidget The widget to set. * @param[in] _newWidget The widget to set.
*/ */
virtual void subWidgetReplace(const std::shared_ptr<ewol::Widget>& _oldWidget, virtual void subWidgetReplace(const ewol::WidgetShared& _oldWidget,
const std::shared_ptr<ewol::Widget>& _newWidget); const ewol::WidgetShared& _newWidget);
/** /**
* @brief add at end position a Widget (note : This system use an inverted phylisophie (button to top, and left to right) * @brief add at end position a Widget (note : This system use an inverted phylisophie (button to top, and left to right)
* @param[in] _newWidget the element pointer * @param[in] _newWidget the element pointer
* @return the ID of the set element * @return the ID of the set element
*/ */
virtual int32_t subWidgetAdd(std::shared_ptr<ewol::Widget> _newWidget); virtual int32_t subWidgetAdd(ewol::WidgetShared _newWidget);
//! @previous //! @previous
inline int32_t subWidgetAddBack(std::shared_ptr<ewol::Widget> _newWidget) { inline int32_t subWidgetAddBack(ewol::WidgetShared _newWidget) {
return subWidgetAdd(_newWidget); return subWidgetAdd(_newWidget);
}; };
//! @previous //! @previous
inline int32_t subWidgetAddEnd(std::shared_ptr<ewol::Widget> _newWidget) { inline int32_t subWidgetAddEnd(ewol::WidgetShared _newWidget) {
return subWidgetAdd(_newWidget); return subWidgetAdd(_newWidget);
}; };
/** /**
@ -72,31 +75,31 @@ namespace ewol {
* @param[in] _newWidget the element pointer * @param[in] _newWidget the element pointer
* @return the ID of the set element * @return the ID of the set element
*/ */
virtual int32_t subWidgetAddStart(std::shared_ptr<ewol::Widget> _newWidget); virtual int32_t subWidgetAddStart(ewol::WidgetShared _newWidget);
//! @previous //! @previous
inline int32_t subWidgetAddFront(std::shared_ptr<ewol::Widget> _newWidget) { inline int32_t subWidgetAddFront(ewol::WidgetShared _newWidget) {
return subWidgetAddStart(_newWidget); return subWidgetAddStart(_newWidget);
}; };
/** /**
* @brief remove definitly a widget from the system and this layer. * @brief remove definitly a widget from the system and this layer.
* @param[in] _newWidget the element pointer. * @param[in] _newWidget the element pointer.
*/ */
virtual void subWidgetRemove(std::shared_ptr<ewol::Widget> _newWidget); virtual void subWidgetRemove(ewol::WidgetShared _newWidget);
/** /**
* @brief Just unlick the specify widget, this function does not remove it from the system (if you can, do nt use it ...) * @brief Just unlick the specify widget, this function does not remove it from the system (if you can, do nt use it ...)
* @param[in] _newWidget the element pointer. * @param[in] _newWidget the element pointer.
*/ */
virtual void subWidgetUnLink(std::shared_ptr<ewol::Widget> _newWidget); virtual void subWidgetUnLink(ewol::WidgetShared _newWidget);
public:// Derived function public:// Derived function
virtual void systemDraw(const ewol::DrawProperty& _displayProp); virtual void systemDraw(const ewol::DrawProperty& _displayProp);
virtual void onRegenerateDisplay(); virtual void onRegenerateDisplay();
virtual void onChangeSize(); virtual void onChangeSize();
virtual void calculateMinMaxSize(); virtual void calculateMinMaxSize();
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos); virtual ewol::WidgetShared getWidgetAtPos(const vec2& _pos);
virtual std::shared_ptr<ewol::Object> getSubObjectNamed(const std::string& _objectName); virtual ewol::ObjectShared getSubObjectNamed(const std::string& _objectName);
virtual bool loadXML(const std::shared_ptr<const exml::Element>& _node); virtual bool loadXML(const std::shared_ptr<const exml::Element>& _node);
virtual void setOffset(const vec2& _newVal); virtual void setOffset(const vec2& _newVal);
virtual void requestDestroyFromChild(const std::shared_ptr<Object>& _child); virtual void requestDestroyFromChild(const ewol::ObjectShared& _child);
protected: protected:
virtual void onChangePropertyLockExpand(); virtual void onChangePropertyLockExpand();
}; };

View File

@ -225,8 +225,8 @@ bool ewol::widget::ContextMenu::onEventInput(const ewol::event::Input& _event) {
return false; return false;
} }
std::shared_ptr<ewol::Widget> ewol::widget::ContextMenu::getWidgetAtPos(const vec2& _pos) { ewol::WidgetShared ewol::widget::ContextMenu::getWidgetAtPos(const vec2& _pos) {
std::shared_ptr<ewol::Widget> val = ewol::widget::Container::getWidgetAtPos(_pos); ewol::WidgetShared val = ewol::widget::Container::getWidgetAtPos(_pos);
if (val != nullptr) { if (val != nullptr) {
return val; return val;
} }
@ -248,7 +248,7 @@ void ewol::widget::ContextMenu::onChangePropertyShape() {
void ewol::widget::ContextMenu::setPositionMarkAuto(const vec2& _origin, const vec2& _size) { void ewol::widget::ContextMenu::setPositionMarkAuto(const vec2& _origin, const vec2& _size) {
std::shared_ptr<ewol::widget::Windows> windows = getWindows(); ewol::widget::WindowsShared windows = getWindows();
vec2 globalSize = windows->getSize(); vec2 globalSize = windows->getSize();
// TODO : Support left and right // TODO : Support left and right
float upperSize = globalSize.y() - (_origin.y() + _size.y()); float upperSize = globalSize.y() - (_origin.y() + _size.y());

View File

@ -17,6 +17,9 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class ContextMenu;
using ContextMenuShared = ewol::SharedPtr<ewol::widget::ContextMenu>;
using ContextMenuWeak = ewol::WeakPtr<ewol::widget::ContextMenu>;
/** /**
* @ingroup ewolWidgetGroup * @ingroup ewolWidgetGroup
*/ */
@ -58,7 +61,7 @@ namespace ewol {
virtual bool onEventInput(const ewol::event::Input& _event); virtual bool onEventInput(const ewol::event::Input& _event);
virtual void onChangeSize(); virtual void onChangeSize();
virtual void calculateMinMaxSize(); virtual void calculateMinMaxSize();
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos); virtual ewol::WidgetShared getWidgetAtPos(const vec2& _pos);
protected: protected:
virtual void onChangePropertyArrowPos(); virtual void onChangePropertyArrowPos();
virtual void onChangePropertyArrawBorder(); virtual void onChangePropertyArrawBorder();

View File

@ -20,6 +20,9 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class Entry;
using EntryShared = ewol::SharedPtr<ewol::widget::Entry>;
using EntryWeak = ewol::WeakPtr<ewol::widget::Entry>;
/** /**
* @ingroup ewolWidgetGroup * @ingroup ewolWidgetGroup
* @brief Entry box display : * @brief Entry box display :

View File

@ -191,7 +191,7 @@ void ewol::widget::Gird::subWidgetRemoveAll() {
} }
void ewol::widget::Gird::subWidgetAdd(int32_t _colId, int32_t _rowId, std::shared_ptr<ewol::Widget> _newWidget) { void ewol::widget::Gird::subWidgetAdd(int32_t _colId, int32_t _rowId, ewol::WidgetShared _newWidget) {
if (_newWidget == nullptr) { if (_newWidget == nullptr) {
return; return;
} }
@ -233,7 +233,7 @@ void ewol::widget::Gird::subWidgetAdd(int32_t _colId, int32_t _rowId, std::share
m_subWidget.push_back(prop); m_subWidget.push_back(prop);
} }
void ewol::widget::Gird::subWidgetRemove(std::shared_ptr<ewol::Widget> _newWidget) { void ewol::widget::Gird::subWidgetRemove(ewol::WidgetShared _newWidget) {
for (size_t iii=0; iii<m_subWidget.size(); iii++) { for (size_t iii=0; iii<m_subWidget.size(); iii++) {
if (_newWidget == m_subWidget[iii].widget) { if (_newWidget == m_subWidget[iii].widget) {
m_subWidget.erase(m_subWidget.begin()+iii); m_subWidget.erase(m_subWidget.begin()+iii);
@ -261,7 +261,7 @@ void ewol::widget::Gird::subWidgetRemove(int32_t _colId, int32_t _rowId) {
EWOL_WARNING("[" << getId() << "] Can not remove unExistant widget"); EWOL_WARNING("[" << getId() << "] Can not remove unExistant widget");
} }
void ewol::widget::Gird::subWidgetUnLink(std::shared_ptr<ewol::Widget> _newWidget) { void ewol::widget::Gird::subWidgetUnLink(ewol::WidgetShared _newWidget) {
if (_newWidget == nullptr) { if (_newWidget == nullptr) {
return; return;
} }
@ -307,7 +307,7 @@ void ewol::widget::Gird::onRegenerateDisplay() {
} }
} }
std::shared_ptr<ewol::Widget> ewol::widget::Gird::getWidgetAtPos(const vec2& _pos) { ewol::WidgetShared ewol::widget::Gird::getWidgetAtPos(const vec2& _pos) {
if (*propertyHide == true) { if (*propertyHide == true) {
return nullptr; return nullptr;
} }
@ -320,7 +320,7 @@ std::shared_ptr<ewol::Widget> ewol::widget::Gird::getWidgetAtPos(const vec2& _po
vec2 tmpOrigin = it.widget->getOrigin(); vec2 tmpOrigin = it.widget->getOrigin();
if( (tmpOrigin.x() <= _pos.x() && tmpOrigin.x() + tmpSize.x() >= _pos.x()) if( (tmpOrigin.x() <= _pos.x() && tmpOrigin.x() + tmpSize.x() >= _pos.x())
&& (tmpOrigin.y() <= _pos.y() && tmpOrigin.y() + tmpSize.y() >= _pos.y()) ) { && (tmpOrigin.y() <= _pos.y() && tmpOrigin.y() + tmpSize.y() >= _pos.y()) ) {
std::shared_ptr<ewol::Widget> tmpWidget = it.widget->getWidgetAtPos(_pos); ewol::WidgetShared tmpWidget = it.widget->getWidgetAtPos(_pos);
if (tmpWidget != nullptr) { if (tmpWidget != nullptr) {
return tmpWidget; return tmpWidget;
} }

View File

@ -15,6 +15,9 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class Gird;
using GirdShared = ewol::SharedPtr<ewol::widget::Gird>;
using GirdWeak = ewol::WeakPtr<ewol::widget::Gird>;
/** /**
* @ingroup ewolWidgetGroup * @ingroup ewolWidgetGroup
*/ */
@ -22,7 +25,7 @@ namespace ewol {
private: private:
class GirdProperties { class GirdProperties {
public: public:
std::shared_ptr<ewol::Widget> widget; ewol::WidgetShared widget;
int32_t row; int32_t row;
int32_t col; int32_t col;
}; };
@ -30,7 +33,7 @@ namespace ewol {
int32_t m_uniformSizeRow; int32_t m_uniformSizeRow;
std::vector<int32_t> m_sizeCol; //!< size of all colomn (if set (otherwise 0)) std::vector<int32_t> m_sizeCol; //!< size of all colomn (if set (otherwise 0))
std::vector<GirdProperties> m_subWidget; //!< all sub widget are contained in this element std::vector<GirdProperties> m_subWidget; //!< all sub widget are contained in this element
std::shared_ptr<ewol::Widget> m_tmpWidget; //!< use when replace a widget ... ewol::WidgetShared m_tmpWidget; //!< use when replace a widget ...
bool m_gavityButtom; bool m_gavityButtom;
protected: protected:
/** /**
@ -95,12 +98,12 @@ namespace ewol {
* @param[in] _rowId Id of the row [0..y]. * @param[in] _rowId Id of the row [0..y].
* @param[in] _newWidget the element pointer * @param[in] _newWidget the element pointer
*/ */
virtual void subWidgetAdd(int32_t _colId, int32_t _rowId, std::shared_ptr<ewol::Widget> _newWidget); virtual void subWidgetAdd(int32_t _colId, int32_t _rowId, ewol::WidgetShared _newWidget);
/** /**
* @brief remove definitly a widget from the system and this Gird. * @brief remove definitly a widget from the system and this Gird.
* @param[in] _newWidget the element pointer. * @param[in] _newWidget the element pointer.
*/ */
virtual void subWidgetRemove(std::shared_ptr<ewol::Widget> _newWidget); virtual void subWidgetRemove(ewol::WidgetShared _newWidget);
/** /**
* @brief remove definitly a widget from the system and this Gird. * @brief remove definitly a widget from the system and this Gird.
* @param[in] _colId Id of the colomn [0..x]. * @param[in] _colId Id of the colomn [0..x].
@ -111,7 +114,7 @@ namespace ewol {
* @brief Just unlick the specify widget, this function does not remove it from the system (if you can, do nt use it ...). * @brief Just unlick the specify widget, this function does not remove it from the system (if you can, do nt use it ...).
* @param[in] _newWidget the element pointer. * @param[in] _newWidget the element pointer.
*/ */
virtual void subWidgetUnLink(std::shared_ptr<ewol::Widget> _newWidget); virtual void subWidgetUnLink(ewol::WidgetShared _newWidget);
/** /**
* @brief Just unlick the specify widget, this function does not remove it from the system (if you can, do nt use it ...). * @brief Just unlick the specify widget, this function does not remove it from the system (if you can, do nt use it ...).
* @param[in] _colId Id of the colomn [0..x]. * @param[in] _colId Id of the colomn [0..x].
@ -136,7 +139,7 @@ namespace ewol {
public: // Derived function public: // Derived function
virtual void systemDraw(const ewol::DrawProperty& _displayProp); virtual void systemDraw(const ewol::DrawProperty& _displayProp);
virtual void onRegenerateDisplay(); virtual void onRegenerateDisplay();
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& pos); virtual ewol::WidgetShared getWidgetAtPos(const vec2& pos);
virtual void onChangeSize(); virtual void onChangeSize();
virtual void calculateMinMaxSize(); virtual void calculateMinMaxSize();
}; };

View File

@ -17,6 +17,9 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class Image;
using ImageShared = ewol::SharedPtr<ewol::widget::Image>;
using ImageWeak = ewol::WeakPtr<ewol::widget::Image>;
/** /**
* @ingroup ewolWidgetGroup * @ingroup ewolWidgetGroup
*/ */

View File

@ -17,6 +17,9 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class Joystick;
using JoystickShared = ewol::SharedPtr<ewol::widget::Joystick>;
using JoystickWeak = ewol::WeakPtr<ewol::widget::Joystick>;
/** /**
* @ingroup ewolWidgetGroup * @ingroup ewolWidgetGroup
*/ */

View File

@ -17,6 +17,9 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class Label;
using LabelShared = ewol::SharedPtr<ewol::widget::Label>;
using LabelWeak = ewol::WeakPtr<ewol::widget::Label>;
/** /**
* @ingroup ewolWidgetGroup * @ingroup ewolWidgetGroup
*/ */

View File

@ -21,7 +21,7 @@ ewol::widget::Layer::~Layer() {
EWOL_DEBUG("[" << getId() << "] Layer : destroy"); EWOL_DEBUG("[" << getId() << "] Layer : destroy");
} }
std::shared_ptr<ewol::Widget> ewol::widget::Layer::getWidgetAtPos(const vec2& _pos) { ewol::WidgetShared ewol::widget::Layer::getWidgetAtPos(const vec2& _pos) {
if (*propertyHide == true) { if (*propertyHide == true) {
return nullptr; return nullptr;
} }
@ -34,7 +34,7 @@ std::shared_ptr<ewol::Widget> ewol::widget::Layer::getWidgetAtPos(const vec2& _p
vec2 tmpOrigin = it->getOrigin(); vec2 tmpOrigin = it->getOrigin();
if( (tmpOrigin.x() <= _pos.x() && tmpOrigin.x() + tmpSize.x() >= _pos.x()) if( (tmpOrigin.x() <= _pos.x() && tmpOrigin.x() + tmpSize.x() >= _pos.x())
&& (tmpOrigin.y() <= _pos.y() && tmpOrigin.y() + tmpSize.y() >= _pos.y()) ) { && (tmpOrigin.y() <= _pos.y() && tmpOrigin.y() + tmpSize.y() >= _pos.y()) ) {
std::shared_ptr<ewol::Widget> tmpWidget = it->getWidgetAtPos(_pos); ewol::WidgetShared tmpWidget = it->getWidgetAtPos(_pos);
if (tmpWidget != nullptr) { if (tmpWidget != nullptr) {
return tmpWidget; return tmpWidget;
} }

View File

@ -14,6 +14,9 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class Layer;
using LayerShared = ewol::SharedPtr<ewol::widget::Layer>;
using LayerWeak = ewol::WeakPtr<ewol::widget::Layer>;
/** /**
* @ingroup ewolWidgetGroup * @ingroup ewolWidgetGroup
*/ */
@ -30,7 +33,7 @@ namespace ewol {
*/ */
virtual ~Layer(); virtual ~Layer();
public: // Derived function public: // Derived function
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos); virtual ewol::WidgetShared getWidgetAtPos(const vec2& _pos);
}; };
}; };
}; };

View File

@ -235,7 +235,7 @@ bool ewol::widget::List::onEventInput(const ewol::event::Input& _event) {
bool isUsed = onItemEvent(_event.getId(), _event.getStatus(), 0, rawID, _event.getPos().x(), _event.getPos().y()); bool isUsed = onItemEvent(_event.getId(), _event.getStatus(), 0, rawID, _event.getPos().x(), _event.getPos().y());
if (true == isUsed) { if (true == isUsed) {
// TODO : this generate bugs ... I did not understand why .. // TODO : this generate bugs ... I did not understand why ..
//std::shared_ptr<ewol::Widget>Manager::focusKeep(this); //ewol::WidgetSharedManager::focusKeep(this);
} }
return isUsed; return isUsed;
} }

View File

@ -15,6 +15,9 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class List;
using ListShared = ewol::SharedPtr<ewol::widget::List>;
using ListWeak = ewol::WeakPtr<ewol::widget::List>;
/** /**
* @ingroup ewolWidgetGroup * @ingroup ewolWidgetGroup
*/ */

View File

@ -14,6 +14,9 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class ListFileSystem;
using ListFileSystemShared = ewol::SharedPtr<ewol::widget::ListFileSystem>;
using ListFileSystemWeak = ewol::WeakPtr<ewol::widget::ListFileSystem>;
/** /**
* @brief Generic display folder class. This widget display the content of a single folder : * @brief Generic display folder class. This widget display the content of a single folder :
*/ */

View File

@ -74,7 +74,7 @@ ewol::widget::Manager::~Manager() {
* focus Area : * focus Area :
* *************************************************************************/ * *************************************************************************/
void ewol::widget::Manager::focusKeep(const std::shared_ptr<ewol::Widget>& _newWidget) { void ewol::widget::Manager::focusKeep(const ewol::WidgetShared& _newWidget) {
if (_newWidget == nullptr) { if (_newWidget == nullptr) {
// nothing to do ... // nothing to do ...
return; return;
@ -102,14 +102,14 @@ void ewol::widget::Manager::focusKeep(const std::shared_ptr<ewol::Widget>& _newW
} }
} }
void ewol::widget::Manager::focusSetDefault(const std::shared_ptr<ewol::Widget>& _newWidget) { void ewol::widget::Manager::focusSetDefault(const ewol::WidgetShared& _newWidget) {
if( _newWidget != nullptr if( _newWidget != nullptr
&& _newWidget->propertyCanFocus.get() == false) { && _newWidget->propertyCanFocus.get() == false) {
EWOL_VERBOSE("Widget can not have focus, id=" << _newWidget->getId() ); EWOL_VERBOSE("Widget can not have focus, id=" << _newWidget->getId() );
return; return;
} }
std::shared_ptr<ewol::Widget> focusWidgetDefault = m_focusWidgetDefault.lock(); ewol::WidgetShared focusWidgetDefault = m_focusWidgetDefault.lock();
std::shared_ptr<ewol::Widget> focusWidgetCurrent = m_focusWidgetCurrent.lock(); ewol::WidgetShared focusWidgetCurrent = m_focusWidgetCurrent.lock();
if (focusWidgetDefault == focusWidgetCurrent) { if (focusWidgetDefault == focusWidgetCurrent) {
if (focusWidgetCurrent != nullptr) { if (focusWidgetCurrent != nullptr) {
EWOL_DEBUG("Rm focus on WidgetID=" << focusWidgetCurrent->getId() ); EWOL_DEBUG("Rm focus on WidgetID=" << focusWidgetCurrent->getId() );
@ -125,8 +125,8 @@ void ewol::widget::Manager::focusSetDefault(const std::shared_ptr<ewol::Widget>&
} }
void ewol::widget::Manager::focusRelease() { void ewol::widget::Manager::focusRelease() {
std::shared_ptr<ewol::Widget> focusWidgetDefault = m_focusWidgetDefault.lock(); ewol::WidgetShared focusWidgetDefault = m_focusWidgetDefault.lock();
std::shared_ptr<ewol::Widget> focusWidgetCurrent = m_focusWidgetCurrent.lock(); ewol::WidgetShared focusWidgetCurrent = m_focusWidgetCurrent.lock();
if (focusWidgetDefault == focusWidgetCurrent) { if (focusWidgetDefault == focusWidgetCurrent) {
// nothink to do ... // nothink to do ...
return; return;
@ -144,13 +144,13 @@ void ewol::widget::Manager::focusRelease() {
} }
std::shared_ptr<ewol::Widget> ewol::widget::Manager::focusGet() { ewol::WidgetShared ewol::widget::Manager::focusGet() {
return m_focusWidgetCurrent.lock(); return m_focusWidgetCurrent.lock();
} }
void ewol::widget::Manager::focusRemoveIfRemove(const std::shared_ptr<ewol::Widget>& _newWidget) { void ewol::widget::Manager::focusRemoveIfRemove(const ewol::WidgetShared& _newWidget) {
std::shared_ptr<ewol::Widget> focusWidgetDefault = m_focusWidgetDefault.lock(); ewol::WidgetShared focusWidgetDefault = m_focusWidgetDefault.lock();
std::shared_ptr<ewol::Widget> focusWidgetCurrent = m_focusWidgetCurrent.lock(); ewol::WidgetShared focusWidgetCurrent = m_focusWidgetCurrent.lock();
if (focusWidgetCurrent == _newWidget) { if (focusWidgetCurrent == _newWidget) {
EWOL_WARNING("Release focus when remove widget"); EWOL_WARNING("Release focus when remove widget");
focusRelease(); focusRelease();
@ -198,7 +198,7 @@ void ewol::widget::Manager::addWidgetCreator(const std::string& _name,
m_creatorList.add(nameLower, _pointer); m_creatorList.add(nameLower, _pointer);
} }
std::shared_ptr<ewol::Widget> 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) { if (m_creatorList.exist(nameLower) == true) {
ewol::widget::Manager::creator_tf pointerFunction = m_creatorList[nameLower]; ewol::widget::Manager::creator_tf pointerFunction = m_creatorList[nameLower];

View File

@ -17,11 +17,11 @@ namespace ewol {
namespace widget { namespace widget {
class Manager { class Manager {
public: public:
typedef std::shared_ptr<ewol::Widget> (*creator_tf)(); using creator_tf = std::function<ewol::WidgetShared()>;
private: private:
// For the focus Management // For the focus Management
std::weak_ptr<ewol::Widget> m_focusWidgetDefault; ewol::WidgetWeak m_focusWidgetDefault;
std::weak_ptr<ewol::Widget> m_focusWidgetCurrent; ewol::WidgetWeak m_focusWidgetCurrent;
bool m_havePeriodic; bool m_havePeriodic;
bool m_haveRedraw; bool m_haveRedraw;
etk::Hash<creator_tf> m_creatorList; etk::Hash<creator_tf> m_creatorList;
@ -29,11 +29,11 @@ namespace ewol {
Manager(); Manager();
virtual ~Manager(); virtual ~Manager();
void focusKeep(const std::shared_ptr<ewol::Widget>& _newWidget); // set the focus at the specific widget void focusKeep(const ewol::WidgetShared& _newWidget); // set the focus at the specific widget
void focusSetDefault(const std::shared_ptr<ewol::Widget>& _newWidget); // select the default focus getter void focusSetDefault(const ewol::WidgetShared& _newWidget); // select the default focus getter
void focusRelease(); // release focus from the current widget to the default void focusRelease(); // release focus from the current widget to the default
std::shared_ptr<ewol::Widget> focusGet(); ewol::WidgetShared focusGet();
void focusRemoveIfRemove(const std::shared_ptr<ewol::Widget>& _newWidget); void focusRemoveIfRemove(const ewol::WidgetShared& _newWidget);
private: private:
std::function<void()> m_funcRedrawNeeded; std::function<void()> m_funcRedrawNeeded;
public: public:
@ -43,7 +43,7 @@ namespace ewol {
// element that generate the list of elements // element that generate the list of elements
void addWidgetCreator(const std::string& _name, creator_tf _pointer); void addWidgetCreator(const std::string& _name, creator_tf _pointer);
std::shared_ptr<ewol::Widget> create(const std::string& _name); ewol::WidgetShared create(const std::string& _name);
bool exist(const std::string& _name); bool exist(const std::string& _name);
std::string list(); std::string list();
private: private:

View File

@ -33,16 +33,16 @@ void ewol::widget::Menu::subWidgetRemoveAll() {
ewol::widget::Sizer::subWidgetRemoveAll(); ewol::widget::Sizer::subWidgetRemoveAll();
} }
int32_t ewol::widget::Menu::subWidgetAdd(std::shared_ptr<ewol::Widget> _newWidget) { int32_t ewol::widget::Menu::subWidgetAdd(ewol::WidgetShared _newWidget) {
EWOL_ERROR("Not availlable"); EWOL_ERROR("Not availlable");
return -1; return -1;
} }
void ewol::widget::Menu::subWidgetRemove(std::shared_ptr<ewol::Widget> _newWidget) { void ewol::widget::Menu::subWidgetRemove(ewol::WidgetShared _newWidget) {
EWOL_ERROR("Not availlable"); EWOL_ERROR("Not availlable");
} }
void ewol::widget::Menu::subWidgetUnLink(std::shared_ptr<ewol::Widget> _newWidget) { void ewol::widget::Menu::subWidgetUnLink(ewol::WidgetShared _newWidget) {
EWOL_ERROR("Not availlable"); EWOL_ERROR("Not availlable");
} }
@ -83,7 +83,7 @@ int32_t ewol::widget::Menu::add(int32_t _parent,
tmpObject.m_image = _image; tmpObject.m_image = _image;
tmpObject.m_message = _message; tmpObject.m_message = _message;
if (-1 == tmpObject.m_parentId) { if (-1 == tmpObject.m_parentId) {
std::shared_ptr<ewol::widget::Button> myButton = ewol::widget::Button::create(); ewol::widget::ButtonShared myButton = ewol::widget::Button::create();
if (myButton == nullptr) { if (myButton == nullptr) {
EWOL_ERROR("Allocation button error"); EWOL_ERROR("Allocation button error");
return tmpObject.m_localId; return tmpObject.m_localId;
@ -104,7 +104,7 @@ int32_t ewol::widget::Menu::add(int32_t _parent,
// add it in the widget list // add it in the widget list
ewol::widget::Sizer::subWidgetAdd(myButton); ewol::widget::Sizer::subWidgetAdd(myButton);
// keep the specific event ... // keep the specific event ...
myButton->signalPressed.connect(shared_from_this(), &ewol::widget::Menu::onButtonPressed, std::weak_ptr<ewol::widget::Button>(myButton)); myButton->signalPressed.connect(shared_from_this(), &ewol::widget::Menu::onButtonPressed, ewol::widget::ButtonWeak(myButton));
tmpObject.m_widgetPointer = myButton; tmpObject.m_widgetPointer = myButton;
} }
m_listElement.push_back(tmpObject); m_listElement.push_back(tmpObject);
@ -121,8 +121,8 @@ int32_t ewol::widget::Menu::addSpacer() {
return -1; return -1;
} }
void ewol::widget::Menu::onButtonPressed(std::weak_ptr<ewol::widget::Button> _button) { void ewol::widget::Menu::onButtonPressed(ewol::widget::ButtonWeak _button) {
std::shared_ptr<ewol::widget::Button> caller = _button.lock(); ewol::widget::ButtonShared caller = _button.lock();
if (caller == nullptr) { if (caller == nullptr) {
return; return;
} }
@ -135,7 +135,7 @@ void ewol::widget::Menu::onButtonPressed(std::weak_ptr<ewol::widget::Button> _bu
EWOL_DEBUG("Menu == > generate Event"); EWOL_DEBUG("Menu == > generate Event");
// Send a multicast event ... // Send a multicast event ...
signalSelect.emit(it.m_message); signalSelect.emit(it.m_message);
std::shared_ptr<ewol::widget::ContextMenu> tmpContext = m_widgetContextMenu.lock(); ewol::widget::ContextMenuShared tmpContext = m_widgetContextMenu.lock();
if (tmpContext != nullptr) { if (tmpContext != nullptr) {
EWOL_DEBUG("Mark the menu to remove ..."); EWOL_DEBUG("Mark the menu to remove ...");
tmpContext->destroy(); tmpContext->destroy();
@ -155,7 +155,7 @@ void ewol::widget::Menu::onButtonPressed(std::weak_ptr<ewol::widget::Button> _bu
return; return;
} }
// create a context menu: // create a context menu:
std::shared_ptr<ewol::widget::ContextMenu> tmpContext = ewol::widget::ContextMenu::create(); ewol::widget::ContextMenuShared tmpContext = ewol::widget::ContextMenu::create();
m_widgetContextMenu = tmpContext; m_widgetContextMenu = tmpContext;
if (tmpContext == nullptr) { if (tmpContext == nullptr) {
EWOL_ERROR("Allocation Error"); EWOL_ERROR("Allocation Error");
@ -163,7 +163,7 @@ void ewol::widget::Menu::onButtonPressed(std::weak_ptr<ewol::widget::Button> _bu
} }
// get the button widget: // get the button widget:
vec2 newPosition; vec2 newPosition;
std::shared_ptr<ewol::Widget> eventFromWidget = std::dynamic_pointer_cast<ewol::Widget>(caller); ewol::WidgetShared eventFromWidget = std::dynamic_pointer_cast<ewol::Widget>(caller);
if (eventFromWidget != nullptr) { if (eventFromWidget != nullptr) {
vec2 tmpOri = eventFromWidget->getOrigin(); vec2 tmpOri = eventFromWidget->getOrigin();
vec2 tmpSize = eventFromWidget->getSize(); vec2 tmpSize = eventFromWidget->getSize();
@ -172,8 +172,8 @@ void ewol::widget::Menu::onButtonPressed(std::weak_ptr<ewol::widget::Button> _bu
tmpOri.y() ); tmpOri.y() );
} }
tmpContext->setPositionMark(ewol::widget::ContextMenu::markTop, newPosition); tmpContext->setPositionMark(ewol::widget::ContextMenu::markTop, newPosition);
std::shared_ptr<ewol::widget::Sizer> mySizer; ewol::widget::SizerShared mySizer;
std::shared_ptr<ewol::widget::Button> myButton; ewol::widget::ButtonShared myButton;
mySizer = ewol::widget::Sizer::create("mode", widget::Sizer::modeVert); mySizer = ewol::widget::Sizer::create("mode", widget::Sizer::modeVert);
if (mySizer != nullptr) { if (mySizer != nullptr) {
mySizer->propertyLockExpand.set(vec2(true,true)); mySizer->propertyLockExpand.set(vec2(true,true));
@ -202,7 +202,7 @@ void ewol::widget::Menu::onButtonPressed(std::weak_ptr<ewol::widget::Button> _bu
myButton->propertyExpand.set(bvec2(true,true)); myButton->propertyExpand.set(bvec2(true,true));
myButton->propertyFill.set(bvec2(true,true)); myButton->propertyFill.set(bvec2(true,true));
// set callback // set callback
myButton->signalPressed.connect(shared_from_this(), &ewol::widget::Menu::onButtonPressed, std::weak_ptr<ewol::widget::Button>(myButton)); myButton->signalPressed.connect(shared_from_this(), &ewol::widget::Menu::onButtonPressed, ewol::widget::ButtonWeak(myButton));
// add it in the widget list // add it in the widget list
mySizer->subWidgetAdd(myButton); mySizer->subWidgetAdd(myButton);
if (it2->m_image.size() != 0) { if (it2->m_image.size() != 0) {
@ -226,7 +226,7 @@ void ewol::widget::Menu::onButtonPressed(std::weak_ptr<ewol::widget::Button> _bu
" </sizer>\n") " </sizer>\n")
); );
} else { } else {
std::shared_ptr<ewol::widget::Label> tmpLabel = widget::Label::create(); ewol::widget::LabelShared tmpLabel = widget::Label::create();
if (tmpLabel != nullptr) { if (tmpLabel != nullptr) {
tmpLabel->propertyValue.set(std::string("<left>") + it2->m_label + "</left>\n"); tmpLabel->propertyValue.set(std::string("<left>") + it2->m_label + "</left>\n");
tmpLabel->propertyExpand.set(bvec2(true,false)); tmpLabel->propertyExpand.set(bvec2(true,false));
@ -238,7 +238,7 @@ void ewol::widget::Menu::onButtonPressed(std::weak_ptr<ewol::widget::Button> _bu
it2->m_widgetPointer = myButton; it2->m_widgetPointer = myButton;
} }
} }
std::shared_ptr<ewol::widget::Windows> currentWindows = getWindows(); ewol::widget::WindowsShared currentWindows = getWindows();
if (currentWindows == nullptr) { if (currentWindows == nullptr) {
EWOL_ERROR("Can not get the curent Windows..."); EWOL_ERROR("Can not get the curent Windows...");
} else { } else {

View File

@ -22,11 +22,14 @@ namespace ewol {
MenuElement() { }; MenuElement() { };
int32_t m_localId; int32_t m_localId;
int32_t m_parentId; int32_t m_parentId;
std::weak_ptr<ewol::Widget> m_widgetPointer; ewol::WidgetWeak m_widgetPointer;
std::string m_label; std::string m_label;
std::string m_image; std::string m_image;
std::string m_message; std::string m_message;
}; };
class Menu;
using MenuShared = ewol::SharedPtr<ewol::widget::Menu>;
using MenuWeak = ewol::WeakPtr<ewol::widget::Menu>;
/** /**
* @ingroup ewolWidgetGroup * @ingroup ewolWidgetGroup
*/ */
@ -40,13 +43,13 @@ namespace ewol {
virtual ~Menu(); virtual ~Menu();
private: private:
virtual void subWidgetRemoveAll(); virtual void subWidgetRemoveAll();
virtual int32_t subWidgetAdd(std::shared_ptr<ewol::Widget> _newWidget); virtual int32_t subWidgetAdd(ewol::WidgetShared _newWidget);
virtual void subWidgetRemove(std::shared_ptr<ewol::Widget> _newWidget); virtual void subWidgetRemove(ewol::WidgetShared _newWidget);
virtual void subWidgetUnLink(std::shared_ptr<ewol::Widget> _newWidget); virtual void subWidgetUnLink(ewol::WidgetShared _newWidget);
private: private:
std::vector<ewol::widget::MenuElement> m_listElement; std::vector<ewol::widget::MenuElement> m_listElement;
int32_t m_staticId; // unique ID for every element of the menu ... int32_t m_staticId; // unique ID for every element of the menu ...
std::weak_ptr<ewol::widget::ContextMenu> m_widgetContextMenu; ewol::widget::ContextMenuWeak m_widgetContextMenu;
int32_t get(const std::string& _label); int32_t get(const std::string& _label);
public: public:
void clear(); void clear();
@ -55,7 +58,7 @@ namespace ewol {
int32_t addSpacer(); int32_t addSpacer();
void remove(int32_t _id); void remove(int32_t _id);
private: private:
void onButtonPressed(std::weak_ptr<ewol::widget::Button> _button); void onButtonPressed(ewol::widget::ButtonWeak _button);
}; };
}; };
}; };

View File

@ -130,8 +130,8 @@ void ewol::widget::PopUp::onRegenerateDisplay() {
} }
} }
std::shared_ptr<ewol::Widget> ewol::widget::PopUp::getWidgetAtPos(const vec2& _pos) { ewol::WidgetShared ewol::widget::PopUp::getWidgetAtPos(const vec2& _pos) {
std::shared_ptr<ewol::Widget> val = ewol::widget::Container::getWidgetAtPos(_pos); ewol::WidgetShared val = ewol::widget::Container::getWidgetAtPos(_pos);
if (val != nullptr) { if (val != nullptr) {
return val; return val;
} }

View File

@ -17,6 +17,9 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class PopUp;
using PopUpShared = ewol::SharedPtr<ewol::widget::PopUp>;
using PopUpWeak = ewol::WeakPtr<ewol::widget::PopUp>;
/** /**
* @ingroup ewolWidgetGroup * @ingroup ewolWidgetGroup
*/ */
@ -48,7 +51,7 @@ namespace ewol {
virtual void onRegenerateDisplay(); virtual void onRegenerateDisplay();
virtual void onChangeSize(); virtual void onChangeSize();
virtual bool onEventInput(const ewol::event::Input& _event); virtual bool onEventInput(const ewol::event::Input& _event);
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos); virtual ewol::WidgetShared getWidgetAtPos(const vec2& _pos);
protected: protected:
virtual bool onStartAnnimation(enum ewol::Widget::annimationMode _mode); virtual bool onStartAnnimation(enum ewol::Widget::annimationMode _mode);
virtual void onStopAnnimation(); virtual void onStopAnnimation();

View File

@ -16,6 +16,9 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class ProgressBar;
using ProgressBarShared = ewol::SharedPtr<ewol::widget::ProgressBar>;
using ProgressBarWeak = ewol::WeakPtr<ewol::widget::ProgressBar>;
/** /**
* @ingroup ewolWidgetGroup * @ingroup ewolWidgetGroup
*/ */

View File

@ -349,8 +349,8 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
return false; return false;
} }
std::shared_ptr<ewol::Widget> ewol::widget::Scroll::getWidgetAtPos(const vec2& _pos) { ewol::WidgetShared ewol::widget::Scroll::getWidgetAtPos(const vec2& _pos) {
std::shared_ptr<ewol::Widget> tmpWidget = ewol::widget::Container::getWidgetAtPos(_pos); ewol::WidgetShared tmpWidget = ewol::widget::Container::getWidgetAtPos(_pos);
if (tmpWidget != nullptr) { if (tmpWidget != nullptr) {
return tmpWidget; return tmpWidget;
} }

View File

@ -16,6 +16,9 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class Scroll;
using ScrollShared = ewol::SharedPtr<ewol::widget::Scroll>;
using ScrollWeak = ewol::WeakPtr<ewol::widget::Scroll>;
class Scroll : public ewol::widget::Container { class Scroll : public ewol::widget::Container {
public: // properties public: // properties
eproperty::Range<vec2> propertyLimit; //!< Set the limitation of the ratio in the sreen eproperty::Range<vec2> propertyLimit; //!< Set the limitation of the ratio in the sreen
@ -50,7 +53,7 @@ namespace ewol {
virtual void onRegenerateDisplay(); virtual void onRegenerateDisplay();
virtual bool onEventInput(const ewol::event::Input& _event); virtual bool onEventInput(const ewol::event::Input& _event);
virtual void systemDraw(const ewol::DrawProperty& _displayProp); virtual void systemDraw(const ewol::DrawProperty& _displayProp);
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos); virtual ewol::WidgetShared getWidgetAtPos(const vec2& _pos);
protected: // Derived function protected: // Derived function
virtual void onDraw(); virtual void onDraw();
protected: protected:

View File

@ -164,14 +164,14 @@ void ewol::widget::Select::onCallbackLabelPressed(int32_t _value) {
void ewol::widget::Select::onCallbackOpenMenu() { void ewol::widget::Select::onCallbackOpenMenu() {
// create a context menu: // create a context menu:
std::shared_ptr<ewol::widget::ContextMenu> tmpContext = ewol::widget::ContextMenu::create(); ewol::widget::ContextMenuShared tmpContext = ewol::widget::ContextMenu::create();
if (tmpContext == nullptr) { if (tmpContext == nullptr) {
EWOL_ERROR("Allocation Error"); EWOL_ERROR("Allocation Error");
return; return;
} }
// auto-select mark position: // auto-select mark position:
tmpContext->setPositionMarkAuto(m_origin, m_size); tmpContext->setPositionMarkAuto(m_origin, m_size);
std::shared_ptr<ewol::widget::Sizer> mySizer; ewol::widget::SizerShared mySizer;
mySizer = ewol::widget::Sizer::create(); mySizer = ewol::widget::Sizer::create();
if (mySizer == nullptr) { if (mySizer == nullptr) {
EWOL_ERROR("Allocation Error or sizer"); EWOL_ERROR("Allocation Error or sizer");
@ -183,7 +183,7 @@ void ewol::widget::Select::onCallbackOpenMenu() {
// set it in the pop-up-system: // set it in the pop-up-system:
tmpContext->setSubWidget(mySizer); tmpContext->setSubWidget(mySizer);
for (auto &it : m_listElement) { for (auto &it : m_listElement) {
std::shared_ptr<ewol::widget::Label> myLabel = ewol::widget::Label::create(); ewol::widget::LabelShared myLabel = ewol::widget::Label::create();
if (myLabel == nullptr) { if (myLabel == nullptr) {
EWOL_ERROR("Allocation Error"); EWOL_ERROR("Allocation Error");
continue; continue;
@ -201,7 +201,7 @@ void ewol::widget::Select::onCallbackOpenMenu() {
// add it in the widget list // add it in the widget list
mySizer->subWidgetAddStart(myLabel); mySizer->subWidgetAddStart(myLabel);
} }
std::shared_ptr<ewol::widget::Windows> currentWindows = getWindows(); ewol::widget::WindowsShared currentWindows = getWindows();
if (currentWindows == nullptr) { if (currentWindows == nullptr) {
EWOL_ERROR("Can not get the curent Windows..."); EWOL_ERROR("Can not get the curent Windows...");
} else { } else {

View File

@ -13,6 +13,9 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class Select;
using SelectShared = ewol::SharedPtr<ewol::widget::Select>;
using SelectWeak = ewol::WeakPtr<ewol::widget::Select>;
/** /**
* @brief a composed Select is a Select with an inside composed with the specify XML element * @brief a composed Select is a Select with an inside composed with the specify XML element
* ==> this permit to generate standard element simple * ==> this permit to generate standard element simple

View File

@ -257,7 +257,7 @@ void ewol::widget::Sizer::calculateMinMaxSize() {
//EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} Result min size : " << m_minSize); //EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} Result min size : " << m_minSize);
} }
int32_t ewol::widget::Sizer::subWidgetAdd(std::shared_ptr<ewol::Widget> _newWidget) { int32_t ewol::widget::Sizer::subWidgetAdd(ewol::WidgetShared _newWidget) {
if (*propertyAnimation == animationNone) { if (*propertyAnimation == animationNone) {
return ewol::widget::ContainerN::subWidgetAdd(_newWidget); return ewol::widget::ContainerN::subWidgetAdd(_newWidget);
} }
@ -265,7 +265,7 @@ int32_t ewol::widget::Sizer::subWidgetAdd(std::shared_ptr<ewol::Widget> _newWidg
return ewol::widget::ContainerN::subWidgetAdd(_newWidget); return ewol::widget::ContainerN::subWidgetAdd(_newWidget);
} }
int32_t ewol::widget::Sizer::subWidgetAddStart(std::shared_ptr<ewol::Widget> _newWidget) { int32_t ewol::widget::Sizer::subWidgetAddStart(ewol::WidgetShared _newWidget) {
if (*propertyAnimation == animationNone) { if (*propertyAnimation == animationNone) {
return ewol::widget::ContainerN::subWidgetAddStart(_newWidget); return ewol::widget::ContainerN::subWidgetAddStart(_newWidget);
} }
@ -273,7 +273,7 @@ int32_t ewol::widget::Sizer::subWidgetAddStart(std::shared_ptr<ewol::Widget> _ne
return ewol::widget::ContainerN::subWidgetAddStart(_newWidget); return ewol::widget::ContainerN::subWidgetAddStart(_newWidget);
} }
void ewol::widget::Sizer::subWidgetRemove(std::shared_ptr<ewol::Widget> _newWidget) { void ewol::widget::Sizer::subWidgetRemove(ewol::WidgetShared _newWidget) {
if (*propertyAnimation == animationNone) { if (*propertyAnimation == animationNone) {
ewol::widget::ContainerN::subWidgetRemove(_newWidget); ewol::widget::ContainerN::subWidgetRemove(_newWidget);
return; return;
@ -282,7 +282,7 @@ void ewol::widget::Sizer::subWidgetRemove(std::shared_ptr<ewol::Widget> _newWidg
ewol::widget::ContainerN::subWidgetRemove(_newWidget); ewol::widget::ContainerN::subWidgetRemove(_newWidget);
} }
void ewol::widget::Sizer::subWidgetUnLink(std::shared_ptr<ewol::Widget> _newWidget) { void ewol::widget::Sizer::subWidgetUnLink(ewol::WidgetShared _newWidget) {
if (*propertyAnimation == animationNone) { if (*propertyAnimation == animationNone) {
ewol::widget::ContainerN::subWidgetUnLink(_newWidget); ewol::widget::ContainerN::subWidgetUnLink(_newWidget);
return; return;

View File

@ -16,6 +16,9 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class Sizer;
using SizerShared = ewol::SharedPtr<ewol::widget::Sizer>;
using SizerWeak = ewol::WeakPtr<ewol::widget::Sizer>;
/** /**
* @ingroup ewolWidgetGroup * @ingroup ewolWidgetGroup
*/ */
@ -54,10 +57,10 @@ namespace ewol {
virtual void onChangeSize(); virtual void onChangeSize();
virtual void calculateMinMaxSize(); virtual void calculateMinMaxSize();
// overwrite the set fuction to start annimations ... // overwrite the set fuction to start annimations ...
virtual int32_t subWidgetAdd(std::shared_ptr<ewol::Widget> _newWidget); virtual int32_t subWidgetAdd(ewol::WidgetShared _newWidget);
virtual int32_t subWidgetAddStart(std::shared_ptr<ewol::Widget> _newWidget); virtual int32_t subWidgetAddStart(ewol::WidgetShared _newWidget);
virtual void subWidgetRemove(std::shared_ptr<ewol::Widget> _newWidget); virtual void subWidgetRemove(ewol::WidgetShared _newWidget);
virtual void subWidgetUnLink(std::shared_ptr<ewol::Widget> _newWidget); virtual void subWidgetUnLink(ewol::WidgetShared _newWidget);
protected: protected:
virtual void onChangePropertyMode(); virtual void onChangePropertyMode();
virtual void onChangePropertyBorderSize(); virtual void onChangePropertyBorderSize();

View File

@ -16,6 +16,9 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class Slider;
using SliderShared = ewol::SharedPtr<ewol::widget::Slider>;
using SliderWeak = ewol::WeakPtr<ewol::widget::Slider>;
/** /**
* @ingroup ewolWidgetGroup * @ingroup ewolWidgetGroup
*/ */

View File

@ -16,6 +16,9 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class Spacer;
using SpacerShared = ewol::SharedPtr<ewol::widget::Spacer>;
using SpacerWeak = ewol::WeakPtr<ewol::widget::Spacer>;
/** /**
* @ingroup ewolWidgetGroup * @ingroup ewolWidgetGroup
*/ */
@ -36,7 +39,7 @@ namespace ewol {
private: private:
ewol::compositing::Drawing m_draw; //!< Compositing drawing element ewol::compositing::Drawing m_draw; //!< Compositing drawing element
public: // Derived function public: // Derived function
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos) { return nullptr; }; virtual ewol::WidgetShared getWidgetAtPos(const vec2& _pos) { return nullptr; };
virtual void onRegenerateDisplay(); virtual void onRegenerateDisplay();
virtual void onDraw(); virtual void onDraw();
protected: protected:

View File

@ -13,6 +13,9 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class Spin;
using SpinShared = ewol::SharedPtr<ewol::widget::Spin>;
using SpinWeak = ewol::WeakPtr<ewol::widget::Spin>;
/** /**
* @brief a composed Spin is a Spin with an inside composed with the specify XML element * @brief a composed Spin is a Spin with an inside composed with the specify XML element
* ==> this permit to generate standard element simple * ==> this permit to generate standard element simple

View File

@ -140,7 +140,7 @@ void ewol::widget::WSlider::subWidgetSelectSet(int32_t _id) {
} }
} }
void ewol::widget::WSlider::subWidgetSelectSet(const std::shared_ptr<ewol::Widget>& _widgetPointer) { void ewol::widget::WSlider::subWidgetSelectSet(const ewol::WidgetShared& _widgetPointer) {
if (_widgetPointer == nullptr) { if (_widgetPointer == nullptr) {
EWOL_ERROR("Can not change to a widget nullptr"); EWOL_ERROR("Can not change to a widget nullptr");
return; return;
@ -289,7 +289,7 @@ void ewol::widget::WSlider::onChangePropertyTransitionMode() {
} }
std::shared_ptr<ewol::Widget> ewol::widget::WSlider::getWidgetAtPos(const vec2& _pos) { ewol::WidgetShared ewol::widget::WSlider::getWidgetAtPos(const vec2& _pos) {
if (*propertyHide == true) { if (*propertyHide == true) {
return nullptr; return nullptr;
} }
@ -303,7 +303,7 @@ std::shared_ptr<ewol::Widget> ewol::widget::WSlider::getWidgetAtPos(const vec2&
if( (tmpOrigin.x() <= _pos.x() && tmpOrigin.x() + tmpSize.x() >= _pos.x()) if( (tmpOrigin.x() <= _pos.x() && tmpOrigin.x() + tmpSize.x() >= _pos.x())
&& (tmpOrigin.y() <= _pos.y() && tmpOrigin.y() + tmpSize.y() >= _pos.y()) ) && (tmpOrigin.y() <= _pos.y() && tmpOrigin.y() + tmpSize.y() >= _pos.y()) )
{ {
std::shared_ptr<ewol::Widget> tmpWidget = (*it)->getWidgetAtPos(_pos); ewol::WidgetShared tmpWidget = (*it)->getWidgetAtPos(_pos);
if (nullptr != tmpWidget) { if (nullptr != tmpWidget) {
return tmpWidget; return tmpWidget;
} }
@ -320,7 +320,7 @@ std::shared_ptr<ewol::Widget> ewol::widget::WSlider::getWidgetAtPos(const vec2&
if( (tmpOrigin.x() <= _pos.x() && tmpOrigin.x() + tmpSize.x() >= _pos.x()) if( (tmpOrigin.x() <= _pos.x() && tmpOrigin.x() + tmpSize.x() >= _pos.x())
&& (tmpOrigin.y() <= _pos.y() && tmpOrigin.y() + tmpSize.y() >= _pos.y()) ) && (tmpOrigin.y() <= _pos.y() && tmpOrigin.y() + tmpSize.y() >= _pos.y()) )
{ {
std::shared_ptr<ewol::Widget> tmpWidget = (*it)->getWidgetAtPos(_pos); ewol::WidgetShared tmpWidget = (*it)->getWidgetAtPos(_pos);
if (nullptr != tmpWidget) { if (nullptr != tmpWidget) {
return tmpWidget; return tmpWidget;
} }
@ -336,7 +336,7 @@ std::shared_ptr<ewol::Widget> ewol::widget::WSlider::getWidgetAtPos(const vec2&
if( (tmpOrigin.x() <= _pos.x() && tmpOrigin.x() + tmpSize.x() >= _pos.x()) if( (tmpOrigin.x() <= _pos.x() && tmpOrigin.x() + tmpSize.x() >= _pos.x())
&& (tmpOrigin.y() <= _pos.y() && tmpOrigin.y() + tmpSize.y() >= _pos.y()) ) && (tmpOrigin.y() <= _pos.y() && tmpOrigin.y() + tmpSize.y() >= _pos.y()) )
{ {
std::shared_ptr<ewol::Widget> tmpWidget = (*it)->getWidgetAtPos(_pos); ewol::WidgetShared tmpWidget = (*it)->getWidgetAtPos(_pos);
if (nullptr != tmpWidget) { if (nullptr != tmpWidget) {
return tmpWidget; return tmpWidget;
} }

View File

@ -15,6 +15,9 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class WSlider;
using WSliderShared = ewol::SharedPtr<ewol::widget::WSlider>;
using WSliderWeak = ewol::WeakPtr<ewol::widget::WSlider>;
/** /**
* @ingroup ewolWidgetGroup * @ingroup ewolWidgetGroup
*/ */
@ -58,7 +61,7 @@ namespace ewol {
* @brief Select a new subwidget to display * @brief Select a new subwidget to display
* @param[in] _widgetPointer Pointer on the widget selected (must be added before) * @param[in] _widgetPointer Pointer on the widget selected (must be added before)
*/ */
void subWidgetSelectSet(const std::shared_ptr<ewol::Widget>& _widgetPointer); void subWidgetSelectSet(const ewol::WidgetShared& _widgetPointer);
/** /**
* @brief Select a new subwidget to display * @brief Select a new subwidget to display
* @param[in] _widgetName Name of the subwidget name * @param[in] _widgetName Name of the subwidget name
@ -68,7 +71,7 @@ namespace ewol {
virtual void onChangeSize(); virtual void onChangeSize();
virtual void systemDraw(const ewol::DrawProperty& _displayProp); virtual void systemDraw(const ewol::DrawProperty& _displayProp);
virtual void onRegenerateDisplay(); virtual void onRegenerateDisplay();
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos); virtual ewol::WidgetShared getWidgetAtPos(const vec2& _pos);
virtual void periodicCall(const ewol::event::Time& _event); virtual void periodicCall(const ewol::event::Time& _event);
protected: protected:
virtual void onChangePropertySelectWidget(); virtual void onChangePropertySelectWidget();

View File

@ -547,7 +547,7 @@ bool ewol::Widget::loadXML(const std::shared_ptr<const exml::Element>& _node) {
} }
bool ewol::Widget::systemEventEntry(ewol::event::EntrySystem& _event) { bool ewol::Widget::systemEventEntry(ewol::event::EntrySystem& _event) {
std::shared_ptr<ewol::Widget> up = std::dynamic_pointer_cast<ewol::Widget>(m_parent.lock()); ewol::WidgetShared up = std::dynamic_pointer_cast<ewol::Widget>(m_parent.lock());
if (up != nullptr) { if (up != nullptr) {
if (up->systemEventEntry(_event) == true) { if (up->systemEventEntry(_event) == true) {
return true; return true;
@ -557,7 +557,7 @@ bool ewol::Widget::systemEventEntry(ewol::event::EntrySystem& _event) {
} }
bool ewol::Widget::systemEventInput(ewol::event::InputSystem& _event) { bool ewol::Widget::systemEventInput(ewol::event::InputSystem& _event) {
std::shared_ptr<ewol::Widget> up = std::dynamic_pointer_cast<ewol::Widget>(m_parent.lock()); ewol::WidgetShared up = std::dynamic_pointer_cast<ewol::Widget>(m_parent.lock());
if (up != nullptr) { if (up != nullptr) {
if (up->systemEventInput(_event) == true) { if (up->systemEventInput(_event) == true) {
return true; return true;
@ -636,7 +636,7 @@ ewol::widget::Manager& ewol::Widget::getWidgetManager() {
return getContext().getWidgetManager(); return getContext().getWidgetManager();
} }
std::shared_ptr<ewol::widget::Windows> ewol::Widget::getWindows() { ewol::widget::WindowsShared ewol::Widget::getWindows() {
return getContext().getWindows(); return getContext().getWindows();
} }

View File

@ -22,6 +22,8 @@ namespace ewol {
class Manager; class Manager;
class Windows; class Windows;
}; };
using WidgetShared = ewol::SharedPtr<ewol::Widget>;
using WidgetWeak = ewol::WeakPtr<ewol::Widget>;
}; };
#include <gale/context/clipBoard.h> #include <gale/context/clipBoard.h>
#include <gale/key/key.h> #include <gale/key/key.h>
@ -39,7 +41,7 @@ namespace ewol {
#define DECLARE_WIDGET_FACTORY(className, name) \ #define DECLARE_WIDGET_FACTORY(className, name) \
DECLARE_FACTORY(className); \ DECLARE_FACTORY(className); \
static void createManagerWidget(ewol::widget::Manager& _widgetManager) { \ static void createManagerWidget(ewol::widget::Manager& _widgetManager) { \
_widgetManager.addWidgetCreator(name, []() -> std::shared_ptr<ewol::Widget> { \ _widgetManager.addWidgetCreator(name, []() -> ewol::WidgetShared { \
return className::create(); \ return className::create(); \
}); \ }); \
} }
@ -348,7 +350,7 @@ namespace ewol {
* @return pointer on the widget found * @return pointer on the widget found
* @note : INTERNAL EWOL SYSTEM * @note : INTERNAL EWOL SYSTEM
*/ */
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos) { virtual ewol::WidgetShared getWidgetAtPos(const vec2& _pos) {
if (propertyHide.get() == false) { if (propertyHide.get() == false) {
return std::dynamic_pointer_cast<ewol::Widget>(shared_from_this()); return std::dynamic_pointer_cast<ewol::Widget>(shared_from_this());
} }
@ -526,7 +528,7 @@ namespace ewol {
/** /**
* @brief get the curent Windows * @brief get the curent Windows
*/ */
std::shared_ptr<ewol::widget::Windows> getWindows(); ewol::SharedPtr<ewol::widget::Windows> getWindows();
/* /*
* Annimation section : * Annimation section :
*/ */

View File

@ -17,6 +17,9 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class WidgetScrolled;
using WidgetScrolledShared = ewol::SharedPtr<ewol::widget::WidgetScrolled>;
using WidgetScrolledWeak = ewol::WeakPtr<ewol::widget::WidgetScrolled>;
/** /**
* @brief Widget to integrate a scrool bar in a widget. This is not a stadalone widget. * @brief Widget to integrate a scrool bar in a widget. This is not a stadalone widget.
*/ */

View File

@ -60,7 +60,7 @@ void ewol::widget::Windows::onChangeSize() {
} }
} }
std::shared_ptr<ewol::Widget> ewol::widget::Windows::getWidgetAtPos(const vec2& _pos) { ewol::WidgetShared ewol::widget::Windows::getWidgetAtPos(const vec2& _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
@ -160,7 +160,7 @@ void ewol::widget::Windows::systemDraw(const ewol::DrawProperty& _displayProp) {
#endif #endif
} }
void ewol::widget::Windows::setSubWidget(std::shared_ptr<ewol::Widget> _widget) { void ewol::widget::Windows::setSubWidget(ewol::WidgetShared _widget) {
if (m_subWidget != nullptr) { if (m_subWidget != nullptr) {
EWOL_INFO("Remove current main windows Widget..."); EWOL_INFO("Remove current main windows Widget...");
m_subWidget->removeParent(); m_subWidget->removeParent();
@ -175,7 +175,7 @@ void ewol::widget::Windows::setSubWidget(std::shared_ptr<ewol::Widget> _widget)
onChangeSize(); onChangeSize();
} }
void ewol::widget::Windows::popUpWidgetPush(std::shared_ptr<ewol::Widget> _widget) { void ewol::widget::Windows::popUpWidgetPush(ewol::WidgetShared _widget) {
if (_widget == nullptr) { if (_widget == nullptr) {
// nothing to do an error appear : // nothing to do an error appear :
EWOL_ERROR("can not set widget pop-up (null pointer)"); EWOL_ERROR("can not set widget pop-up (null pointer)");
@ -213,7 +213,7 @@ void ewol::widget::Windows::setTitle(const std::string& _title) {
void ewol::widget::Windows::createPopUpMessage(enum popUpMessageType _type, const std::string& _message) { void ewol::widget::Windows::createPopUpMessage(enum popUpMessageType _type, const std::string& _message) {
std::shared_ptr<ewol::widget::StdPopUp> tmpPopUp = widget::StdPopUp::create(); ewol::widget::StdPopUpShared tmpPopUp = widget::StdPopUp::create();
if (tmpPopUp == nullptr) { if (tmpPopUp == nullptr) {
EWOL_ERROR("Can not create a simple pop-up"); EWOL_ERROR("Can not create a simple pop-up");
return; return;
@ -238,7 +238,7 @@ void ewol::widget::Windows::createPopUpMessage(enum popUpMessageType _type, cons
popUpWidgetPush(tmpPopUp); popUpWidgetPush(tmpPopUp);
} }
void ewol::widget::Windows::requestDestroyFromChild(const std::shared_ptr<Object>& _child) { void ewol::widget::Windows::requestDestroyFromChild(const ewol::ObjectShared& _child) {
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) {
@ -266,8 +266,8 @@ void ewol::widget::Windows::requestDestroyFromChild(const std::shared_ptr<Object
} }
} }
std::shared_ptr<ewol::Object> ewol::widget::Windows::getSubObjectNamed(const std::string& _objectName) { ewol::ObjectShared ewol::widget::Windows::getSubObjectNamed(const std::string& _objectName) {
std::shared_ptr<ewol::Object> tmpObject = ewol::Widget::getSubObjectNamed(_objectName); ewol::ObjectShared tmpObject = ewol::Widget::getSubObjectNamed(_objectName);
if (tmpObject != nullptr) { if (tmpObject != nullptr) {
return tmpObject; return tmpObject;
} }

View File

@ -16,6 +16,9 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class Windows;
using WindowsShared = ewol::SharedPtr<ewol::widget::Windows>;
using WindowsWeak = ewol::WeakPtr<ewol::widget::Windows>;
/** /**
* @brief Windows basic interface * @brief Windows basic interface
*/ */
@ -46,11 +49,11 @@ namespace ewol {
virtual void onStateSuspend() {}; virtual void onStateSuspend() {};
virtual void onStateResume() {}; virtual void onStateResume() {};
private: private:
std::shared_ptr<ewol::Widget> m_subWidget; ewol::WidgetShared m_subWidget;
std::list<std::shared_ptr<ewol::Widget>> m_popUpWidgetList; std::list<ewol::WidgetShared> m_popUpWidgetList;
public: public:
void setSubWidget(std::shared_ptr<ewol::Widget> _widget); void setSubWidget(ewol::WidgetShared _widget);
void popUpWidgetPush(std::shared_ptr<ewol::Widget> _widget); void popUpWidgetPush(ewol::WidgetShared _widget);
void popUpWidgetPop(); void popUpWidgetPop();
size_t popUpCount() { size_t popUpCount() {
return m_popUpWidgetList.size(); return m_popUpWidgetList.size();
@ -75,9 +78,9 @@ namespace ewol {
public: // Derived function public: // Derived function
virtual void onRegenerateDisplay(); virtual void onRegenerateDisplay();
virtual void onChangeSize(); virtual void onChangeSize();
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos); virtual ewol::WidgetShared getWidgetAtPos(const vec2& _pos);
virtual void requestDestroyFromChild(const std::shared_ptr<Object>& _child); virtual void requestDestroyFromChild(const ewol::ObjectShared& _child);
virtual std::shared_ptr<ewol::Object> getSubObjectNamed(const std::string& _objectName); virtual ewol::ObjectShared getSubObjectNamed(const std::string& _objectName);
void setTitle(const std::string& _title); void setTitle(const std::string& _title);
public: public:
enum popUpMessageType { enum popUpMessageType {

View File

@ -20,6 +20,9 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class ColorChooser;
using ColorChooserShared = ewol::SharedPtr<ewol::widget::ColorChooser>;
using ColorChooserWeak = ewol::WeakPtr<ewol::widget::ColorChooser>;
/** /**
* @ingroup ewolWidgetGroup * @ingroup ewolWidgetGroup
*/ */
@ -35,11 +38,11 @@ namespace ewol {
DECLARE_WIDGET_FACTORY(ColorChooser, "ColorChooser"); DECLARE_WIDGET_FACTORY(ColorChooser, "ColorChooser");
virtual ~ColorChooser(); virtual ~ColorChooser();
private: private:
std::shared_ptr<ewol::widget::ColorBar> m_widgetColorBar; ewol::widget::ColorBarShared m_widgetColorBar;
std::shared_ptr<ewol::widget::Slider> m_widgetRed; ewol::widget::SliderShared m_widgetRed;
std::shared_ptr<ewol::widget::Slider> m_widgetGreen; ewol::widget::SliderShared m_widgetGreen;
std::shared_ptr<ewol::widget::Slider> m_widgetBlue; ewol::widget::SliderShared m_widgetBlue;
std::shared_ptr<ewol::widget::Slider> m_widgetAlpha; ewol::widget::SliderShared m_widgetAlpha;
void onCallbackColorChangeRed(const float& _newColor); void onCallbackColorChangeRed(const float& _newColor);
void onCallbackColorChangeGreen(const float& _newColor); void onCallbackColorChangeGreen(const float& _newColor);
void onCallbackColorChangeBlue(const float& _newColor); void onCallbackColorChangeBlue(const float& _newColor);

View File

@ -14,6 +14,9 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class FileChooser;
using FileChooserShared = ewol::SharedPtr<ewol::widget::FileChooser>;
using FileChooserWeak = ewol::WeakPtr<ewol::widget::FileChooser>;
/** /**
* @brief File Chooser is a simple selector of file for opening, saving, and what you want ... * @brief File Chooser is a simple selector of file for opening, saving, and what you want ...
* *
@ -26,7 +29,7 @@ namespace ewol {
* *
* The first step is to create the file chooser pop-up : (never in the constructor!!!) * The first step is to create the file chooser pop-up : (never in the constructor!!!)
* [code style=c++] * [code style=c++]
* std::shared_ptr<ewol::widget::FileChooser> tmpWidget = ewol::Widget::FileChooser::create(); * ewol::widget::FileChooserShared tmpWidget = ewol::Widget::FileChooser::create();
* if (tmpWidget == nullptr) { * if (tmpWidget == nullptr) {
* APPL_ERROR("Can not open File chooser !!! "); * APPL_ERROR("Can not open File chooser !!! ");
* return -1; * return -1;
@ -42,7 +45,7 @@ namespace ewol {
* // simply set a folder (by default this is the home folder) * // simply set a folder (by default this is the home folder)
* //tmpWidget->setFolder("/home/me"); * //tmpWidget->setFolder("/home/me");
* // add the widget as windows pop-up ... * // add the widget as windows pop-up ...
* std::shared_ptr<ewol::widget::Windows> tmpWindows = getWindows(); * ewol::widget::WindowsShared tmpWindows = getWindows();
* if (tmpWindows == nullptr) { * if (tmpWindows == nullptr) {
* APPL_ERROR("Can not get the current windows !!! "); * APPL_ERROR("Can not get the current windows !!! ");
* return -1; * return -1;

View File

@ -36,9 +36,9 @@ ewol::widget::Parameter::Parameter() :
void ewol::widget::Parameter::init() { void ewol::widget::Parameter::init() {
ewol::widget::PopUp::init(); ewol::widget::PopUp::init();
std::shared_ptr<ewol::widget::Sizer> mySizerVert = nullptr; ewol::widget::SizerShared mySizerVert = nullptr;
std::shared_ptr<ewol::widget::Sizer> mySizerHori = nullptr; ewol::widget::SizerShared mySizerHori = nullptr;
std::shared_ptr<ewol::widget::Spacer> mySpacer = nullptr; ewol::widget::SpacerShared mySpacer = nullptr;
#ifdef __TARGET_OS__Android #ifdef __TARGET_OS__Android
propertyMinSize.set(gale::Dimension(vec2(90, 90), gale::Dimension::Pourcent)); propertyMinSize.set(gale::Dimension(vec2(90, 90), gale::Dimension::Pourcent));
#else #else
@ -71,7 +71,7 @@ void ewol::widget::Parameter::init() {
mySizerHori->subWidgetAdd(mySpacer); mySizerHori->subWidgetAdd(mySpacer);
} }
std::shared_ptr<ewol::widget::Button> tmpButton = widget::Button::create(); ewol::widget::ButtonShared tmpButton = widget::Button::create();
if (tmpButton == nullptr) { if (tmpButton == nullptr) {
EWOL_ERROR("Can not allocate widget == > display might be in error"); EWOL_ERROR("Can not allocate widget == > display might be in error");
} else { } else {
@ -134,7 +134,7 @@ void ewol::widget::Parameter::init() {
mySizerHori->subWidgetAdd(mySpacer); mySizerHori->subWidgetAdd(mySpacer);
} }
std::shared_ptr<ewol::widget::Sizer> mySizerVert2 = widget::Sizer::create(); ewol::widget::SizerShared mySizerVert2 = widget::Sizer::create();
if (mySizerVert2 == nullptr) { if (mySizerVert2 == nullptr) {
EWOL_ERROR("Can not allocate widget == > display might be in error"); EWOL_ERROR("Can not allocate widget == > display might be in error");
} else { } else {
@ -212,7 +212,7 @@ void ewol::widget::Parameter::onCallbackMenuSelected(const int32_t& _value) {
} }
} }
void ewol::widget::Parameter::menuAdd(std::string _label, std::string _image, std::shared_ptr<ewol::Widget> _associateWidget) { void ewol::widget::Parameter::menuAdd(std::string _label, std::string _image, ewol::WidgetShared _associateWidget) {
if (nullptr != m_paramList) { if (nullptr != m_paramList) {
m_paramList->menuAdd(_label, m_currentIdList, _image); m_paramList->menuAdd(_label, m_currentIdList, _image);
if (nullptr != m_wSlider) { if (nullptr != m_wSlider) {
@ -220,7 +220,7 @@ void ewol::widget::Parameter::menuAdd(std::string _label, std::string _image, st
m_wSlider->subWidgetAdd(_associateWidget); m_wSlider->subWidgetAdd(_associateWidget);
} else { } else {
EWOL_DEBUG("Associate an empty widget on it ..."); EWOL_DEBUG("Associate an empty widget on it ...");
std::shared_ptr<ewol::widget::Label> myLabel = widget::Label::create(); ewol::widget::LabelShared myLabel = widget::Label::create();
if (nullptr == myLabel) { if (nullptr == myLabel) {
EWOL_ERROR("Can not allocate widget == > display might be in error"); EWOL_ERROR("Can not allocate widget == > display might be in error");
} else { } else {

View File

@ -21,6 +21,9 @@
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class Parameter;
using ParameterShared = ewol::SharedPtr<ewol::widget::Parameter>;
using ParameterWeak = ewol::WeakPtr<ewol::widget::Parameter>;
/** /**
* @ingroup ewolWidgetGroup * @ingroup ewolWidgetGroup
*/ */
@ -36,15 +39,15 @@ namespace ewol {
DECLARE_WIDGET_FACTORY(Parameter, "Parameter"); DECLARE_WIDGET_FACTORY(Parameter, "Parameter");
virtual ~Parameter(); virtual ~Parameter();
public: public:
void menuAdd(std::string _label, std::string _image, std::shared_ptr<ewol::Widget> _associateWidget); void menuAdd(std::string _label, std::string _image, ewol::WidgetShared _associateWidget);
void menuAddGroup(std::string _label); void menuAddGroup(std::string _label);
void menuClear(); void menuClear();
void menuSeparator(); void menuSeparator();
private: private:
int32_t m_currentIdList; int32_t m_currentIdList;
std::shared_ptr<ewol::widget::Label> m_widgetTitle; ewol::widget::LabelShared m_widgetTitle;
std::shared_ptr<ewol::widget::ParameterList> m_paramList; ewol::widget::ParameterListShared m_paramList;
std::shared_ptr<ewol::widget::WSlider> m_wSlider; ewol::widget::WSliderShared m_wSlider;
private: //callback functions: private: //callback functions:
void onCallbackMenuclosed(); void onCallbackMenuclosed();
void onCallbackParameterSave(); void onCallbackParameterSave();

View File

@ -12,8 +12,6 @@
#include <ewol/debug.h> #include <ewol/debug.h>
#include <ewol/widget/WidgetScrolled.h> #include <ewol/widget/WidgetScrolled.h>
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class elementPL { class elementPL {
@ -31,7 +29,9 @@ namespace ewol {
}; };
virtual ~elementPL() {}; virtual ~elementPL() {};
}; };
class ParameterList;
using ParameterListShared = ewol::SharedPtr<ewol::widget::ParameterList>;
using ParameterListWeak = ewol::WeakPtr<ewol::widget::ParameterList>;
/** /**
* @ingroup ewolWidgetGroup * @ingroup ewolWidgetGroup
*/ */

View File

@ -96,7 +96,7 @@ void ewol::widget::SpinBase::updateGui() {
m_widgetButtonDown->propertyExpand.set(bvec2(false,false)); m_widgetButtonDown->propertyExpand.set(bvec2(false,false));
m_widgetButtonDown->propertyFill.set(bvec2(true,true)); m_widgetButtonDown->propertyFill.set(bvec2(true,true));
std::string data = m_config->getString(m_confIdDownData); std::string data = m_config->getString(m_confIdDownData);
std::shared_ptr<ewol::Widget> widget = ewol::widget::composerGenerateString(data); ewol::WidgetShared widget = ewol::widget::composerGenerateString(data);
m_widgetButtonDown->setSubWidget(widget); m_widgetButtonDown->setSubWidget(widget);
} }
} }
@ -111,7 +111,7 @@ void ewol::widget::SpinBase::updateGui() {
m_widgetButtonUp->propertyExpand.set(bvec2(false,false)); m_widgetButtonUp->propertyExpand.set(bvec2(false,false));
m_widgetButtonUp->propertyFill.set(bvec2(true,true)); m_widgetButtonUp->propertyFill.set(bvec2(true,true));
std::string data = m_config->getString(m_confIdUpData); std::string data = m_config->getString(m_confIdUpData);
std::shared_ptr<ewol::Widget> widget = ewol::widget::composerGenerateString(data); ewol::WidgetShared widget = ewol::widget::composerGenerateString(data);
m_widgetButtonUp->setSubWidget(widget); m_widgetButtonUp->setSubWidget(widget);
} }
} }

View File

@ -57,6 +57,9 @@ namespace ewol {
*/ */
spinPosition_RightRight spinPosition_RightRight
}; };
class SpinBase;
using SpinBaseShared = ewol::SharedPtr<ewol::widget::SpinBase>;
using SpinBaseWeak = ewol::WeakPtr<ewol::widget::SpinBase>;
/** /**
* @ingroup ewolWidgetGroup * @ingroup ewolWidgetGroup
*/ */
@ -86,9 +89,9 @@ namespace ewol {
*/ */
virtual ~SpinBase(); virtual ~SpinBase();
protected: protected:
std::shared_ptr<ewol::widget::Entry> m_widgetEntry; ewol::widget::EntryShared m_widgetEntry;
std::shared_ptr<ewol::widget::Button> m_widgetButtonDown; ewol::widget::ButtonShared m_widgetButtonDown;
std::shared_ptr<ewol::widget::Button> m_widgetButtonUp; ewol::widget::ButtonShared m_widgetButtonUp;
virtual void updateGui(); virtual void updateGui();
public: // Derived function public: // Derived function
virtual bool loadXML(const std::shared_ptr<const exml::Element>& _node); virtual bool loadXML(const std::shared_ptr<const exml::Element>& _node);

View File

@ -26,8 +26,8 @@ ewol::widget::StdPopUp::StdPopUp() :
void ewol::widget::StdPopUp::init() { void ewol::widget::StdPopUp::init() {
ewol::widget::PopUp::init(); ewol::widget::PopUp::init();
propertyMinSize.set(gale::Dimension(vec2(20,10),gale::Dimension::Pourcent)); propertyMinSize.set(gale::Dimension(vec2(20,10),gale::Dimension::Pourcent));
std::shared_ptr<ewol::widget::Sizer> mySizerVert; ewol::widget::SizerShared mySizerVert;
std::shared_ptr<ewol::widget::Spacer> mySpacer; ewol::widget::SpacerShared mySpacer;
mySizerVert = ewol::widget::Sizer::create(); mySizerVert = ewol::widget::Sizer::create();
// set it in the pop-up-system : // set it in the pop-up-system :
@ -96,12 +96,12 @@ void ewol::widget::StdPopUp::setComment(const std::string& _text) {
markToRedraw(); markToRedraw();
} }
std::shared_ptr<ewol::widget::Button> ewol::widget::StdPopUp::addButton(const std::string& _text, bool _autoExit) { ewol::widget::ButtonShared ewol::widget::StdPopUp::addButton(const std::string& _text, bool _autoExit) {
if (m_subBar == nullptr) { if (m_subBar == nullptr) {
EWOL_ERROR("button-bar does not existed ..."); EWOL_ERROR("button-bar does not existed ...");
return nullptr; return nullptr;
} }
std::shared_ptr<ewol::widget::Button> myButton = widget::Button::create(); ewol::widget::ButtonShared myButton = widget::Button::create();
if (myButton == nullptr) { if (myButton == nullptr) {
EWOL_ERROR("Can not allocate new button ..."); EWOL_ERROR("Can not allocate new button ...");
return nullptr; return nullptr;

View File

@ -13,6 +13,9 @@
#include <ewol/widget/Sizer.h> #include <ewol/widget/Sizer.h>
namespace ewol { namespace ewol {
namespace widget { namespace widget {
class StdPopUp;
using StdPopUpShared = ewol::SharedPtr<ewol::widget::StdPopUp>;
using StdPopUpWeak = ewol::WeakPtr<ewol::widget::StdPopUp>;
/** /**
* @brief The std pop up widget is a siple message widget to notify user of some simple things, like: * @brief The std pop up widget is a siple message widget to notify user of some simple things, like:
* *
@ -53,7 +56,7 @@ namespace ewol {
*/ */
virtual ~StdPopUp(); virtual ~StdPopUp();
protected: protected:
std::shared_ptr<ewol::widget::Label> m_title; //!< Title Label widget ewol::widget::LabelShared m_title; //!< Title Label widget
public: public:
/** /**
* @brief Set the title string. * @brief Set the title string.
@ -61,7 +64,7 @@ namespace ewol {
*/ */
void setTitle(const std::string& _text); void setTitle(const std::string& _text);
protected: protected:
std::shared_ptr<ewol::widget::Label> m_comment; //!< Comment label widget ewol::widget::LabelShared m_comment; //!< Comment label widget
public: public:
/** /**
* @brief Set the commentary string. * @brief Set the commentary string.
@ -69,13 +72,13 @@ namespace ewol {
*/ */
void setComment(const std::string& _text); void setComment(const std::string& _text);
protected: protected:
std::shared_ptr<ewol::widget::Sizer> m_subBar; //!< subwidget bar containing all the button. ewol::widget::SizerShared m_subBar; //!< subwidget bar containing all the button.
public: public:
/** /**
* @brief Add a buttom button. * @brief Add a buttom button.
* @param[in] _text Decorated text to diplay in button. * @param[in] _text Decorated text to diplay in button.
*/ */
std::shared_ptr<ewol::widget::Button> addButton(const std::string& _text, bool _autoExit=false); ewol::widget::ButtonShared addButton(const std::string& _text, bool _autoExit=false);
public: // callback function public: // callback function
void onCallBackButtonExit(); void onCallBackButtonExit();
}; };

View File

@ -48,7 +48,8 @@ def create(target, module_name):
'ewol/Padding.h', 'ewol/Padding.h',
'ewol/translate.h', 'ewol/translate.h',
'ewol/DrawProperty.h', 'ewol/DrawProperty.h',
'ewol/gravity.h' 'ewol/gravity.h',
'ewol/memory.h'
]) ])
# compositing: # compositing: