[DEV] start abstraction of using shared_ptr and weak_ptr to bench some other implementation thread safe ...
This commit is contained in:
parent
9371f59962
commit
9e7d41f266
@ -52,13 +52,13 @@ void ewol::Context::setInitImage(const std::string& _fileName) {
|
||||
|
||||
|
||||
|
||||
void ewol::Context::inputEventTransfertWidget(std::shared_ptr<ewol::Widget> _source,
|
||||
std::shared_ptr<ewol::Widget> _destination) {
|
||||
void ewol::Context::inputEventTransfertWidget(ewol::WidgetShared _source,
|
||||
ewol::WidgetShared _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);
|
||||
}
|
||||
|
||||
@ -138,7 +138,7 @@ void ewol::Context::onResume(gale::Context& _context) {
|
||||
void ewol::Context::onRegenerateDisplay(gale::Context& _context) {
|
||||
//EWOL_INFO("REGENERATE_DISPLAY");
|
||||
// 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) {
|
||||
EWOL_DEBUG("No windows ...");
|
||||
return;
|
||||
@ -156,7 +156,7 @@ void ewol::Context::onDraw(gale::Context& _context) {
|
||||
// clean internal data...
|
||||
m_objectManager.cleanInternalRemoved();
|
||||
// real draw...
|
||||
std::shared_ptr<ewol::widget::Windows> window = m_windowsCurrent;
|
||||
ewol::widget::WindowsShared window = m_windowsCurrent;
|
||||
if (window == nullptr) {
|
||||
return;
|
||||
}
|
||||
@ -249,7 +249,7 @@ void ewol::Context::onKeyboard(const gale::key::Special& _special,
|
||||
return;
|
||||
}
|
||||
// get the current focused Widget :
|
||||
std::shared_ptr<ewol::Widget> tmpWidget = m_widgetManager.focusGet();
|
||||
ewol::WidgetShared tmpWidget = m_widgetManager.focusGet();
|
||||
if (tmpWidget == nullptr) {
|
||||
// no Widget ...
|
||||
return;
|
||||
@ -301,7 +301,7 @@ void ewol::Context::processEvents() {
|
||||
*/
|
||||
|
||||
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) {
|
||||
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");
|
||||
// remove current focus :
|
||||
m_widgetManager.focusSetDefault(nullptr);
|
||||
@ -447,7 +447,7 @@ void ewol::Context::setWindows(const std::shared_ptr<ewol::widget::Windows>& _wi
|
||||
forceRedrawAll();
|
||||
}
|
||||
|
||||
std::shared_ptr<ewol::widget::Windows> ewol::Context::getWindows() {
|
||||
ewol::widget::WindowsShared ewol::Context::getWindows() {
|
||||
return m_windowsCurrent;
|
||||
};
|
||||
void ewol::Context::onResize(const ivec2& _size) {
|
||||
|
@ -92,18 +92,18 @@ namespace ewol {
|
||||
*/
|
||||
virtual void stop();
|
||||
private:
|
||||
std::shared_ptr<ewol::widget::Windows> m_windowsCurrent; //!< curent displayed windows
|
||||
ewol::widget::WindowsShared m_windowsCurrent; //!< curent displayed windows
|
||||
public:
|
||||
/**
|
||||
* @brief set the current windows to display :
|
||||
* @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
|
||||
* @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
|
||||
@ -116,12 +116,12 @@ namespace ewol {
|
||||
* @param source the widget where the event came from
|
||||
* @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
|
||||
* @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
|
||||
*/
|
||||
|
@ -42,7 +42,7 @@ void ewol::context::InputManager::setDpi(int32_t newDPI) {
|
||||
}
|
||||
|
||||
bool ewol::context::InputManager::localEventInput(enum gale::key::type _type,
|
||||
std::shared_ptr<ewol::Widget> _destWidget,
|
||||
ewol::WidgetShared _destWidget,
|
||||
int32_t _IdInput,
|
||||
enum gale::key::status _status,
|
||||
vec2 _pos) {
|
||||
@ -93,14 +93,14 @@ void ewol::context::InputManager::cleanElement(InputPoperty *_eventTable,
|
||||
_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
|
||||
|| _destination == nullptr) {
|
||||
// prevent errors ...
|
||||
return;
|
||||
}
|
||||
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) {
|
||||
// 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);
|
||||
@ -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) {
|
||||
return;
|
||||
}
|
||||
@ -171,13 +171,13 @@ ewol::context::InputManager::~InputManager() {
|
||||
}
|
||||
|
||||
int32_t ewol::context::InputManager::localGetDestinationId(enum gale::key::type _type,
|
||||
std::shared_ptr<ewol::Widget> _destWidget,
|
||||
ewol::WidgetShared _destWidget,
|
||||
int32_t _realInputId) {
|
||||
if (_type == gale::key::type_finger) {
|
||||
int32_t lastMinimum = 0;
|
||||
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
|
||||
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 (iii != _realInputId) {
|
||||
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
|
||||
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 :
|
||||
if (_type == gale::key::type_mouse && _pointerID == 0) {
|
||||
// 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 :
|
||||
std::shared_ptr<ewol::Widget> tmpWidget;
|
||||
ewol::WidgetShared tmpWidget;
|
||||
if (m_grabWidget.lock() != nullptr) {
|
||||
// grab all events ...
|
||||
tmpWidget = m_grabWidget.lock();
|
||||
@ -349,7 +349,7 @@ void ewol::context::InputManager::state(enum gale::key::type _type,
|
||||
}
|
||||
// get the curent time ...
|
||||
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) {
|
||||
EVENT_DEBUG("GUI : Input ID=" << _pointerID
|
||||
@ -386,7 +386,7 @@ void ewol::context::InputManager::state(enum gale::key::type _type,
|
||||
eventTable[_pointerID].lastTimeEvent = currentTime;
|
||||
// set the element inside ...
|
||||
eventTable[_pointerID].isInside = true;
|
||||
std::shared_ptr<ewol::Widget> tmpWidget = m_grabWidget.lock();
|
||||
ewol::WidgetShared tmpWidget = m_grabWidget.lock();
|
||||
// get destination widget :
|
||||
if(nullptr != tmpWindows) {
|
||||
if ( tmpWidget != nullptr
|
||||
@ -429,7 +429,7 @@ void ewol::context::InputManager::state(enum gale::key::type _type,
|
||||
// revove the widget ...
|
||||
eventTable[_pointerID].curentWidgetEvent.reset();
|
||||
} else {
|
||||
std::shared_ptr<ewol::Widget> tmpWidget = eventTable[_pointerID].curentWidgetEvent.lock();
|
||||
ewol::WidgetShared tmpWidget = eventTable[_pointerID].curentWidgetEvent.lock();
|
||||
// generate UP Event
|
||||
EVENT_DEBUG("GUI : Input ID=" << _pointerID
|
||||
<< " == >" << eventTable[_pointerID].destinationInputId
|
||||
|
@ -21,7 +21,7 @@ namespace ewol {
|
||||
bool isUsed;
|
||||
int32_t destinationInputId;
|
||||
int64_t lastTimeEvent;
|
||||
std::weak_ptr<ewol::Widget> curentWidgetEvent;
|
||||
ewol::WidgetWeak curentWidgetEvent;
|
||||
vec2 origin;
|
||||
vec2 size;
|
||||
vec2 downStart;
|
||||
@ -44,7 +44,7 @@ namespace ewol {
|
||||
class InputManager{
|
||||
// special grab pointer mode :
|
||||
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:
|
||||
int32_t m_dpi;
|
||||
InputLimit m_eventInputLimit;
|
||||
@ -64,7 +64,7 @@ namespace ewol {
|
||||
* @return true if event has been greped
|
||||
*/
|
||||
bool localEventInput(enum gale::key::type _type,
|
||||
std::shared_ptr<ewol::Widget> _destWidget,
|
||||
ewol::WidgetShared _destWidget,
|
||||
int32_t _IdInput,
|
||||
enum gale::key::status _typeEvent,
|
||||
vec2 _pos);
|
||||
@ -78,7 +78,7 @@ namespace ewol {
|
||||
* @return the ewol input id
|
||||
*/
|
||||
int32_t localGetDestinationId(enum gale::key::type _type,
|
||||
std::shared_ptr<ewol::Widget> _destWidget,
|
||||
ewol::WidgetShared _destWidget,
|
||||
int32_t _realInputId);
|
||||
private:
|
||||
ewol::Context& m_context;
|
||||
@ -100,12 +100,12 @@ namespace ewol {
|
||||
* @param _source the widget where the event came from
|
||||
* @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
|
||||
* @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
|
||||
*/
|
||||
|
@ -76,7 +76,7 @@ namespace ewol {
|
||||
enum gale::key::status _status,
|
||||
uint8_t _id,
|
||||
const vec2& _pos,
|
||||
std::shared_ptr<ewol::Widget> _dest,
|
||||
ewol::WidgetShared _dest,
|
||||
int32_t _realIdEvent,
|
||||
gale::key::Special _specialKey) :
|
||||
m_event(_type, _status, _id, _pos, _specialKey),
|
||||
@ -84,13 +84,13 @@ namespace ewol {
|
||||
m_realIdEvent(_realIdEvent) { };
|
||||
ewol::event::Input m_event;
|
||||
private:
|
||||
std::shared_ptr<ewol::Widget> m_dest;
|
||||
ewol::WidgetShared m_dest;
|
||||
int32_t m_realIdEvent;
|
||||
public:
|
||||
void setDestWidget(std::shared_ptr<ewol::Widget> _dest) {
|
||||
void setDestWidget(ewol::WidgetShared _dest) {
|
||||
m_dest = _dest;
|
||||
};
|
||||
inline std::shared_ptr<ewol::Widget> getDestWidget() const {
|
||||
inline ewol::WidgetShared getDestWidget() const {
|
||||
return m_dest;
|
||||
};
|
||||
void setRealId(int32_t _realIdEvent) {
|
||||
|
28
ewol/memory.h
Normal file
28
ewol/memory.h
Normal 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>;
|
||||
*/
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ ewol::object::Manager::~Manager() {
|
||||
void ewol::object::Manager::displayListObject() {
|
||||
EWOL_INFO("List loaded object : ");
|
||||
for (auto &it : m_eObjectList) {
|
||||
std::shared_ptr<ewol::Object> element = it.lock();
|
||||
ewol::ObjectShared element = it.lock();
|
||||
if (element != nullptr) {
|
||||
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();
|
||||
}
|
||||
for (auto &it : m_eObjectList) {
|
||||
std::shared_ptr<ewol::Object> element = it.lock();
|
||||
ewol::ObjectShared element = it.lock();
|
||||
if (element != nullptr) {
|
||||
//it->removeObject();
|
||||
}
|
||||
@ -67,7 +67,7 @@ void ewol::object::Manager::unInit() {
|
||||
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) {
|
||||
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 == "") {
|
||||
return nullptr;
|
||||
}
|
||||
for (auto &it : m_eObjectList) {
|
||||
std::shared_ptr<ewol::Object> element = it.lock();
|
||||
ewol::ObjectShared element = it.lock();
|
||||
if ( element != nullptr
|
||||
&& element->propertyName.get() == _name) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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());
|
||||
while (it != m_workerList.end()) {
|
||||
if (*it == _worker) {
|
||||
|
@ -17,7 +17,7 @@ namespace ewol {
|
||||
namespace object {
|
||||
class Manager : public esignal::Interface {
|
||||
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;
|
||||
public:
|
||||
Manager(Context& _context);
|
||||
@ -43,7 +43,7 @@ namespace ewol {
|
||||
* @note The manager remove the object when the refecence Low down 1 (last keeper)
|
||||
* @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:
|
||||
/**
|
||||
* @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
|
||||
* @return Pointer on the finded Object.
|
||||
*/
|
||||
std::shared_ptr<ewol::Object> get(const std::string& _name);
|
||||
ewol::ObjectShared get(const std::string& _name);
|
||||
public:
|
||||
/**
|
||||
* @brief retrive an object with his name
|
||||
* @param[in] _name Name of the object
|
||||
* @return the requested object or nullptr
|
||||
*/
|
||||
std::shared_ptr<ewol::Object> getObjectNamed(const std::string& _name);
|
||||
ewol::ObjectShared getObjectNamed(const std::string& _name);
|
||||
private:
|
||||
std::vector<std::shared_ptr<ewol::Object>> m_workerList;
|
||||
std::vector<ewol::ObjectShared> m_workerList;
|
||||
public:
|
||||
/**
|
||||
* @brief Add a worker on the system 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.
|
||||
* @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:
|
||||
esignal::ISignal<ewol::event::Time> periodicCall;
|
||||
private:
|
||||
|
@ -22,7 +22,7 @@ void ewol::Object::autoDestroy() {
|
||||
return;
|
||||
}
|
||||
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 ...
|
||||
if (parent != nullptr) {
|
||||
parent->requestDestroyFromChild(shared_from_this());
|
||||
@ -31,12 +31,12 @@ void ewol::Object::autoDestroy() {
|
||||
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_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 ...
|
||||
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) {
|
||||
std::shared_ptr<ewol::Object> object = getObjectManager().get(_objectName);
|
||||
ewol::ObjectShared object = getObjectManager().get(_objectName);
|
||||
if (object == nullptr) {
|
||||
return false;
|
||||
}
|
||||
@ -149,11 +149,11 @@ ewol::Context& ewol::Object::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);
|
||||
}
|
||||
|
||||
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());
|
||||
if (_objectName == propertyName.get()) {
|
||||
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) {
|
||||
std::shared_ptr<ewol::Object> object = ewol::getContext().getEObjectManager().get(_objectName);
|
||||
ewol::ObjectShared object = ewol::getContext().getEObjectManager().get(_objectName);
|
||||
if (object == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
@ -15,27 +15,29 @@
|
||||
#include <unordered_map>
|
||||
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/memory.h>
|
||||
#include <eproperty/Interface.h>
|
||||
#include <eproperty/Value.h>
|
||||
#include <eproperty/Range.h>
|
||||
#include <eproperty/List.h>
|
||||
#include <esignal/Interface.h>
|
||||
|
||||
|
||||
namespace ewol {
|
||||
// some class need to define element befor other ...
|
||||
class Object;
|
||||
namespace object {
|
||||
class Manager;
|
||||
};
|
||||
}
|
||||
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
|
||||
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::PropertyType<TYPE_VAL>* propType(nullptr);
|
||||
if (_object == nullptr) {
|
||||
@ -59,11 +61,11 @@ exit_on_error:
|
||||
}
|
||||
|
||||
#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) \
|
||||
template<typename ... TYPE> static std::shared_ptr<className> create(const TYPE& ... _all) { \
|
||||
std::shared_ptr<className> object(new className()); \
|
||||
template<class ... TYPE> static ewol::SharedPtr<className> create(const TYPE& ... _all) { \
|
||||
ewol::SharedPtr<className> object(new className()); \
|
||||
if (object == nullptr) { \
|
||||
EWOL_ERROR("Factory error"); \
|
||||
return nullptr; \
|
||||
@ -79,9 +81,9 @@ exit_on_error:
|
||||
}
|
||||
|
||||
#define DECLARE_SINGLE_FACTORY(className, uniqueName) \
|
||||
template<typename ... TYPE> static std::shared_ptr<className> create(const TYPE& ... _all) { \
|
||||
std::shared_ptr<className> object; \
|
||||
std::shared_ptr<ewol::Object> object2 = getObjectNamed(uniqueName); \
|
||||
template<class ... TYPE> static ewol::SharedPtr<className> create(const TYPE& ... _all) { \
|
||||
ewol::SharedPtr<className> object; \
|
||||
ewol::SharedPtr<ewol::Object> object2 = getObjectNamed(uniqueName); \
|
||||
if (object2 != nullptr) { \
|
||||
object = std::dynamic_pointer_cast<className>(object2); \
|
||||
if (object == nullptr) { \
|
||||
@ -96,11 +98,13 @@ exit_on_error:
|
||||
}
|
||||
|
||||
namespace ewol {
|
||||
using ObjectShared = ewol::SharedPtr<ewol::Object>;
|
||||
using ObjectWeak = ewol::WeakPtr<ewol::Object>;
|
||||
/**
|
||||
* @brief Basic message classes for ewol system
|
||||
* 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 esignal::Interface {
|
||||
public: // Event list
|
||||
@ -130,7 +134,7 @@ namespace ewol {
|
||||
return m_objectHasBeenInit;
|
||||
}
|
||||
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.
|
||||
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
|
||||
* @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.
|
||||
* @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.
|
||||
*/
|
||||
@ -264,20 +268,20 @@ namespace ewol {
|
||||
* @param[in] _name Name of the object
|
||||
* @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)
|
||||
* @param[in] _name Name of the object
|
||||
* @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:
|
||||
// TODO : Create a template ...
|
||||
/**
|
||||
* @brief link on an signal in the subwiget with his name
|
||||
*/
|
||||
#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) { \
|
||||
myObject->_event.connect(_shared_ptr, _func, ##__VA_ARGS__); \
|
||||
} else { \
|
||||
@ -285,13 +289,13 @@ namespace ewol {
|
||||
} \
|
||||
} while (false)
|
||||
/*
|
||||
template<class TYPE> void subBind(std::shared_ptr<ewol::Object> _obj, void (TYPE::*_func)()) {
|
||||
std::shared_ptr<TYPE> obj2 = std::dynamic_pointer_cast<TYPE>(_obj);
|
||||
template<class TYPE> void subBind(ewol::SharedPtr<ewol::Object> _obj, void (TYPE::*_func)()) {
|
||||
ewol::SharedPtr<TYPE> obj2 = std::dynamic_pointer_cast<TYPE>(_obj);
|
||||
if (obj2 == nullptr) {
|
||||
EWOL_ERROR("Can not connect signal ...");
|
||||
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
|
||||
*/
|
||||
#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) { \
|
||||
myObject->_event.connect(_obj, _func, ##__VA_ARGS__); \
|
||||
} else { \
|
||||
@ -314,7 +318,7 @@ namespace ewol {
|
||||
* @brief link on an signal in the subWidget of an object with his name
|
||||
*/
|
||||
#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) { \
|
||||
myObject->_event.connect(_obj, _func, ##__VA_ARGS__); \
|
||||
} else { \
|
||||
|
@ -12,6 +12,9 @@
|
||||
|
||||
namespace ewol {
|
||||
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.
|
||||
*/
|
||||
|
@ -20,6 +20,9 @@
|
||||
|
||||
namespace ewol {
|
||||
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
|
||||
* ==> this permit to generate standard element simple
|
||||
|
@ -171,12 +171,12 @@ bool ewol::widget::ButtonColor::onEventInput(const ewol::event::Input& _event) {
|
||||
tmpPos.setX( tmpPos.x() - m_minSize.x()/2.0);
|
||||
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());
|
||||
// set it in the pop-up-system :
|
||||
m_widgetContextMenu->setSubWidget(myColorChooser);
|
||||
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) {
|
||||
EWOL_ERROR("Can not get the curent Windows...");
|
||||
m_widgetContextMenu.reset();
|
||||
|
@ -19,6 +19,9 @@
|
||||
|
||||
namespace ewol {
|
||||
namespace widget {
|
||||
class ButtonColor;
|
||||
using ButtonColorShared = ewol::SharedPtr<ewol::widget::ButtonColor>;
|
||||
using ButtonColorWeak = ewol::WeakPtr<ewol::widget::ButtonColor>;
|
||||
class ButtonColor : public ewol::Widget {
|
||||
public: // signals
|
||||
esignal::ISignal<etk::Color<>> signalChange;
|
||||
@ -28,7 +31,7 @@ namespace ewol {
|
||||
private:
|
||||
ewol::compositing::Shaper m_shaper; //!< Compositing theme.
|
||||
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_buttonPressed; //!< Flag to know if the button is curently pressed.
|
||||
// hover area :
|
||||
|
@ -17,6 +17,9 @@
|
||||
|
||||
namespace ewol {
|
||||
namespace widget {
|
||||
class CheckBox;
|
||||
using CheckBoxShared = ewol::SharedPtr<ewol::widget::CheckBox>;
|
||||
using CheckBoxWeak = ewol::WeakPtr<ewol::widget::CheckBox>;
|
||||
class CheckBox : public ewol::widget::Container2 {
|
||||
public: // Event list
|
||||
esignal::ISignal<> signalPressed;
|
||||
|
@ -17,6 +17,9 @@
|
||||
|
||||
namespace ewol {
|
||||
namespace widget {
|
||||
class ColorBar;
|
||||
using ColorBarShared = ewol::SharedPtr<ewol::widget::ColorBar>;
|
||||
using ColorBarWeak = ewol::WeakPtr<ewol::widget::ColorBar>;
|
||||
class ColorBar : public ewol::Widget {
|
||||
public: // signals
|
||||
esignal::ISignal<etk::Color<>> signalChange;
|
||||
|
@ -21,7 +21,7 @@ ewol::widget::Composer::Composer() {
|
||||
// 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();
|
||||
if (_data == "") {
|
||||
return nullptr;
|
||||
@ -57,7 +57,7 @@ static std::shared_ptr<ewol::Widget> composerGenerate(bool _modeFile, const std:
|
||||
return nullptr;
|
||||
}
|
||||
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) {
|
||||
EWOL_ERROR ("(l "<<pNode->getPos()<<") Can not create the widget : \"" << widgetName << "\"");
|
||||
return nullptr;
|
||||
@ -68,11 +68,11 @@ static std::shared_ptr<ewol::Widget> composerGenerate(bool _modeFile, const std:
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,9 @@
|
||||
|
||||
namespace ewol {
|
||||
namespace widget {
|
||||
class Composer;
|
||||
using ComposerShared = ewol::SharedPtr<ewol::widget::Composer>;
|
||||
using ComposerWeak = ewol::WeakPtr<ewol::widget::Composer>;
|
||||
/**
|
||||
* @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
|
||||
@ -44,7 +47,7 @@ namespace ewol {
|
||||
*/
|
||||
bool loadFromString(const std::string& _composerXmlString);
|
||||
};
|
||||
std::shared_ptr<ewol::Widget> composerGenerateString(const std::string& _data = "");
|
||||
std::shared_ptr<ewol::Widget> composerGenerateFile(const std::string& _data = "");
|
||||
ewol::WidgetShared composerGenerateString(const std::string& _data = "");
|
||||
ewol::WidgetShared composerGenerateFile(const std::string& _data = "");
|
||||
};
|
||||
};
|
||||
|
@ -25,11 +25,11 @@ ewol::widget::Container::~Container() {
|
||||
subWidgetRemove();
|
||||
}
|
||||
|
||||
std::shared_ptr<ewol::Widget> ewol::widget::Container::getSubWidget() {
|
||||
ewol::WidgetShared ewol::widget::Container::getSubWidget() {
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
@ -42,8 +42,8 @@ void ewol::widget::Container::setSubWidget(std::shared_ptr<ewol::Widget> _newWid
|
||||
requestUpdateSize();
|
||||
}
|
||||
|
||||
void ewol::widget::Container::subWidgetReplace(const std::shared_ptr<ewol::Widget>& _oldWidget,
|
||||
const std::shared_ptr<ewol::Widget>& _newWidget) {
|
||||
void ewol::widget::Container::subWidgetReplace(const ewol::WidgetShared& _oldWidget,
|
||||
const ewol::WidgetShared& _newWidget) {
|
||||
if (m_subWidget != _oldWidget) {
|
||||
EWOL_WARNING("Request replace with a wrong old widget");
|
||||
return;
|
||||
@ -74,8 +74,8 @@ void ewol::widget::Container::subWidgetUnLink() {
|
||||
m_subWidget.reset();
|
||||
}
|
||||
|
||||
std::shared_ptr<ewol::Object> ewol::widget::Container::getSubObjectNamed(const std::string& _objectName) {
|
||||
std::shared_ptr<ewol::Object> tmpObject = ewol::Widget::getSubObjectNamed(_objectName);
|
||||
ewol::ObjectShared ewol::widget::Container::getSubObjectNamed(const std::string& _objectName) {
|
||||
ewol::ObjectShared tmpObject = ewol::Widget::getSubObjectNamed(_objectName);
|
||||
if (tmpObject != nullptr) {
|
||||
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 (m_subWidget != nullptr) {
|
||||
return m_subWidget->getWidgetAtPos(_pos);
|
||||
@ -164,7 +164,7 @@ bool ewol::widget::Container::loadXML(const std::shared_ptr<const exml::Element>
|
||||
continue;
|
||||
}
|
||||
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) {
|
||||
EWOL_ERROR ("(l "<<pNode->getPos()<<") Can not create the widget : \"" << widgetName << "\"");
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
|
@ -13,13 +13,16 @@
|
||||
|
||||
namespace ewol {
|
||||
namespace widget {
|
||||
class Container;
|
||||
using ContainerShared = ewol::SharedPtr<ewol::widget::Container>;
|
||||
using ContainerWeak = ewol::WeakPtr<ewol::widget::Container>;
|
||||
/**
|
||||
* @ingroup ewolWidgetGroup
|
||||
* @brief the Cotainer widget is a widget that have an only one subWidget
|
||||
*/
|
||||
class Container : public ewol::Widget {
|
||||
protected:
|
||||
std::shared_ptr<ewol::Widget> m_subWidget;
|
||||
ewol::WidgetShared m_subWidget;
|
||||
protected:
|
||||
/**
|
||||
* @brief Constructor
|
||||
@ -35,19 +38,19 @@ namespace ewol {
|
||||
* @brief get the main node widget
|
||||
* @return the requested pointer on the node
|
||||
*/
|
||||
std::shared_ptr<ewol::Widget> getSubWidget();
|
||||
ewol::WidgetShared getSubWidget();
|
||||
/**
|
||||
* @brief set the subWidget node widget.
|
||||
* @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.
|
||||
* @param[in] _oldWidget The widget to replace.
|
||||
* @param[in] _newWidget The widget to set.
|
||||
*/
|
||||
virtual void subWidgetReplace(const std::shared_ptr<ewol::Widget>& _oldWidget,
|
||||
const std::shared_ptr<ewol::Widget>& _newWidget);
|
||||
virtual void subWidgetReplace(const ewol::WidgetShared& _oldWidget,
|
||||
const ewol::WidgetShared& _newWidget);
|
||||
/**
|
||||
* @brief remove the subWidget node (async).
|
||||
*/
|
||||
@ -61,11 +64,11 @@ namespace ewol {
|
||||
virtual void onRegenerateDisplay();
|
||||
virtual void onChangeSize();
|
||||
virtual void calculateMinMaxSize();
|
||||
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos);
|
||||
virtual std::shared_ptr<ewol::Object> getSubObjectNamed(const std::string& _objectName);
|
||||
virtual ewol::WidgetShared getWidgetAtPos(const vec2& _pos);
|
||||
virtual ewol::ObjectShared getSubObjectNamed(const std::string& _objectName);
|
||||
virtual bool loadXML(const std::shared_ptr<const exml::Element>& _node);
|
||||
virtual void setOffset(const vec2& _newVal);
|
||||
virtual void requestDestroyFromChild(const std::shared_ptr<Object>& _child);
|
||||
virtual void requestDestroyFromChild(const ewol::ObjectShared& _child);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -26,7 +26,7 @@ ewol::widget::Container2::~Container2() {
|
||||
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);
|
||||
m_subWidget[_idWidget] = _newWidget;
|
||||
if (m_subWidget[_idWidget] != nullptr) {
|
||||
@ -37,8 +37,8 @@ void ewol::widget::Container2::setSubWidget(std::shared_ptr<ewol::Widget> _newWi
|
||||
requestUpdateSize();
|
||||
}
|
||||
|
||||
void ewol::widget::Container2::subWidgetReplace(const std::shared_ptr<ewol::Widget>& _oldWidget,
|
||||
const std::shared_ptr<ewol::Widget>& _newWidget) {
|
||||
void ewol::widget::Container2::subWidgetReplace(const ewol::WidgetShared& _oldWidget,
|
||||
const ewol::WidgetShared& _newWidget) {
|
||||
bool haveChange = false;
|
||||
for (size_t iii=0; iii<2; ++iii) {
|
||||
if (m_subWidget[iii] != _oldWidget) {
|
||||
@ -79,8 +79,8 @@ void ewol::widget::Container2::subWidgetUnLink(int32_t _idWidget) {
|
||||
m_subWidget[_idWidget].reset();
|
||||
}
|
||||
|
||||
std::shared_ptr<ewol::Object> ewol::widget::Container2::getSubObjectNamed(const std::string& _widgetName) {
|
||||
std::shared_ptr<ewol::Object> tmpObject = ewol::Widget::getSubObjectNamed(_widgetName);
|
||||
ewol::ObjectShared ewol::widget::Container2::getSubObjectNamed(const std::string& _widgetName) {
|
||||
ewol::ObjectShared tmpObject = ewol::Widget::getSubObjectNamed(_widgetName);
|
||||
if (tmpObject != nullptr) {
|
||||
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 (m_subWidget[m_idWidgetDisplayed] != nullptr) {
|
||||
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 << "'");
|
||||
std::shared_ptr<ewol::Widget> tmpWidget = getWidgetManager().create(widgetName);
|
||||
ewol::WidgetShared tmpWidget = getWidgetManager().create(widgetName);
|
||||
if (tmpWidget == nullptr) {
|
||||
EWOL_ERROR ("(l "<<pNode->getPos()<<") Can not create the widget : \"" << widgetName << "\"");
|
||||
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] == nullptr) {
|
||||
return;
|
||||
|
@ -14,13 +14,16 @@
|
||||
|
||||
namespace ewol {
|
||||
namespace widget {
|
||||
class Container2;
|
||||
using Container2Shared = ewol::SharedPtr<ewol::widget::Container2>;
|
||||
using Container2Weak = ewol::WeakPtr<ewol::widget::Container2>;
|
||||
/**
|
||||
* @ingroup ewolWidgetGroup
|
||||
* @brief the Cotainer widget is a widget that have an only one subWidget
|
||||
*/
|
||||
class Container2 : public ewol::Widget {
|
||||
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
|
||||
protected:
|
||||
/**
|
||||
@ -40,20 +43,20 @@ namespace ewol {
|
||||
* @param[in] _subWidget Widget to add normal
|
||||
* @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:
|
||||
/**
|
||||
* @brief Specify the current widget
|
||||
* @param[in] _subWidget Widget to add normal
|
||||
*/
|
||||
void setSubWidget(std::shared_ptr<ewol::Widget> _subWidget) {
|
||||
void setSubWidget(ewol::WidgetShared _subWidget) {
|
||||
setSubWidget(_subWidget, 0);
|
||||
}
|
||||
/**
|
||||
* @brief Specify the current toggle widget
|
||||
* @param[in] _subWidget Widget to add Toggle
|
||||
*/
|
||||
void setSubWidgetToggle(std::shared_ptr<ewol::Widget> _subWidget) {
|
||||
void setSubWidgetToggle(ewol::WidgetShared _subWidget) {
|
||||
setSubWidget(_subWidget, 1);
|
||||
}
|
||||
private:
|
||||
@ -62,7 +65,7 @@ namespace ewol {
|
||||
* @param[in] _idWidget Id of the widget to set
|
||||
* @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];
|
||||
};
|
||||
public:
|
||||
@ -70,14 +73,14 @@ namespace ewol {
|
||||
* @brief get the current displayed composition
|
||||
* @return The base widget
|
||||
*/
|
||||
std::shared_ptr<ewol::Widget> getSubWidget() const {
|
||||
ewol::WidgetShared getSubWidget() const {
|
||||
return getSubWidget(0);
|
||||
};
|
||||
/**
|
||||
* @brief get the current displayed composition
|
||||
* @return The toggle widget
|
||||
*/
|
||||
std::shared_ptr<ewol::Widget> getSubWidgetToggle() const {
|
||||
ewol::WidgetShared getSubWidgetToggle() const {
|
||||
return getSubWidget(1);
|
||||
};
|
||||
private:
|
||||
@ -152,8 +155,8 @@ namespace ewol {
|
||||
* @param[in] _oldWidget The widget to replace.
|
||||
* @param[in] _newWidget The widget to set.
|
||||
*/
|
||||
virtual void subWidgetReplace(const std::shared_ptr<ewol::Widget>& _oldWidget,
|
||||
const std::shared_ptr<ewol::Widget>& _newWidget);
|
||||
virtual void subWidgetReplace(const ewol::WidgetShared& _oldWidget,
|
||||
const ewol::WidgetShared& _newWidget);
|
||||
public: // Derived function
|
||||
virtual void systemDraw(const ewol::DrawProperty& _displayProp);
|
||||
virtual void onRegenerateDisplay();
|
||||
@ -163,11 +166,11 @@ namespace ewol {
|
||||
virtual void calculateMinMaxSize() {
|
||||
calculateMinMaxSizePadded();
|
||||
}
|
||||
//virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos);
|
||||
virtual std::shared_ptr<ewol::Object> getSubObjectNamed(const std::string& _objectName);
|
||||
//virtual ewol::WidgetShared getWidgetAtPos(const vec2& _pos);
|
||||
virtual ewol::ObjectShared getSubObjectNamed(const std::string& _objectName);
|
||||
virtual bool loadXML(const std::shared_ptr<const exml::Element>& _node);
|
||||
virtual void setOffset(const vec2& _newVal);
|
||||
virtual void requestDestroyFromChild(const std::shared_ptr<Object>& _child);
|
||||
virtual void requestDestroyFromChild(const ewol::ObjectShared& _child);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -51,8 +51,8 @@ void ewol::widget::ContainerN::onChangePropertyLockExpand() {
|
||||
requestUpdateSize();
|
||||
}
|
||||
|
||||
void ewol::widget::ContainerN::subWidgetReplace(const std::shared_ptr<ewol::Widget>& _oldWidget,
|
||||
const std::shared_ptr<ewol::Widget>& _newWidget) {
|
||||
void ewol::widget::ContainerN::subWidgetReplace(const ewol::WidgetShared& _oldWidget,
|
||||
const ewol::WidgetShared& _newWidget) {
|
||||
bool haveChange = false;
|
||||
for (auto &it : m_subWidget) {
|
||||
if (it != _oldWidget) {
|
||||
@ -74,7 +74,7 @@ void ewol::widget::ContainerN::subWidgetReplace(const std::shared_ptr<ewol::Widg
|
||||
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) {
|
||||
EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} Try to add An empty Widget ... ");
|
||||
return -1;
|
||||
@ -87,7 +87,7 @@ int32_t ewol::widget::ContainerN::subWidgetAdd(std::shared_ptr<ewol::Widget> _ne
|
||||
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) {
|
||||
EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} Try to add start An empty Widget ... ");
|
||||
return -1;
|
||||
@ -101,7 +101,7 @@ int32_t ewol::widget::ContainerN::subWidgetAddStart(std::shared_ptr<ewol::Widget
|
||||
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) {
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
@ -154,8 +154,8 @@ void ewol::widget::ContainerN::subWidgetRemoveAllDelayed() {
|
||||
subWidgetRemoveAll();
|
||||
}
|
||||
|
||||
std::shared_ptr<ewol::Object> ewol::widget::ContainerN::getSubObjectNamed(const std::string& _objectName) {
|
||||
std::shared_ptr<ewol::Object> tmpObject = ewol::Widget::getSubObjectNamed(_objectName);
|
||||
ewol::ObjectShared ewol::widget::ContainerN::getSubObjectNamed(const std::string& _objectName) {
|
||||
ewol::ObjectShared tmpObject = ewol::Widget::getSubObjectNamed(_objectName);
|
||||
if (tmpObject != nullptr) {
|
||||
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) {
|
||||
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())
|
||||
&& (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) {
|
||||
return tmpWidget;
|
||||
}
|
||||
@ -285,7 +285,7 @@ bool ewol::widget::ContainerN::loadXML(const std::shared_ptr<const exml::Element
|
||||
continue;
|
||||
}
|
||||
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) {
|
||||
EWOL_ERROR ("[" << getId() << "] {" << getObjectType() << "} (l "<<pNode->getPos()<<") Can not create the widget : \"" << widgetName << "\"");
|
||||
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();
|
||||
while (it != m_subWidget.end()) {
|
||||
if (*it == _child) {
|
||||
|
@ -14,6 +14,9 @@
|
||||
|
||||
namespace ewol {
|
||||
namespace widget {
|
||||
class ContainerN;
|
||||
using ContainerNShared = ewol::SharedPtr<ewol::widget::ContainerN>;
|
||||
using ContainerNWeak = ewol::WeakPtr<ewol::widget::ContainerN>;
|
||||
/**
|
||||
* @ingroup ewolWidgetGroup
|
||||
* @brief the Cotainer widget is a widget that have an only one subWidget
|
||||
@ -22,7 +25,7 @@ namespace ewol {
|
||||
public: // properties:
|
||||
eproperty::Value<bvec2> propertyLockExpand; //!< Lock the expend of the sub widget to this one == > this permit to limit bigger subWidget
|
||||
protected:
|
||||
std::list<std::shared_ptr<ewol::Widget>> m_subWidget;
|
||||
std::list<ewol::WidgetShared> m_subWidget;
|
||||
protected:
|
||||
/**
|
||||
* @brief Constructor
|
||||
@ -51,20 +54,20 @@ namespace ewol {
|
||||
* @param[in] _oldWidget The widget to replace.
|
||||
* @param[in] _newWidget The widget to set.
|
||||
*/
|
||||
virtual void subWidgetReplace(const std::shared_ptr<ewol::Widget>& _oldWidget,
|
||||
const std::shared_ptr<ewol::Widget>& _newWidget);
|
||||
virtual void subWidgetReplace(const ewol::WidgetShared& _oldWidget,
|
||||
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)
|
||||
* @param[in] _newWidget the element pointer
|
||||
* @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
|
||||
inline int32_t subWidgetAddBack(std::shared_ptr<ewol::Widget> _newWidget) {
|
||||
inline int32_t subWidgetAddBack(ewol::WidgetShared _newWidget) {
|
||||
return subWidgetAdd(_newWidget);
|
||||
};
|
||||
//! @previous
|
||||
inline int32_t subWidgetAddEnd(std::shared_ptr<ewol::Widget> _newWidget) {
|
||||
inline int32_t subWidgetAddEnd(ewol::WidgetShared _newWidget) {
|
||||
return subWidgetAdd(_newWidget);
|
||||
};
|
||||
/**
|
||||
@ -72,31 +75,31 @@ namespace ewol {
|
||||
* @param[in] _newWidget the element pointer
|
||||
* @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
|
||||
inline int32_t subWidgetAddFront(std::shared_ptr<ewol::Widget> _newWidget) {
|
||||
inline int32_t subWidgetAddFront(ewol::WidgetShared _newWidget) {
|
||||
return subWidgetAddStart(_newWidget);
|
||||
};
|
||||
/**
|
||||
* @brief remove definitly a widget from the system and this layer.
|
||||
* @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 ...)
|
||||
* @param[in] _newWidget the element pointer.
|
||||
*/
|
||||
virtual void subWidgetUnLink(std::shared_ptr<ewol::Widget> _newWidget);
|
||||
virtual void subWidgetUnLink(ewol::WidgetShared _newWidget);
|
||||
public:// Derived function
|
||||
virtual void systemDraw(const ewol::DrawProperty& _displayProp);
|
||||
virtual void onRegenerateDisplay();
|
||||
virtual void onChangeSize();
|
||||
virtual void calculateMinMaxSize();
|
||||
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos);
|
||||
virtual std::shared_ptr<ewol::Object> getSubObjectNamed(const std::string& _objectName);
|
||||
virtual ewol::WidgetShared getWidgetAtPos(const vec2& _pos);
|
||||
virtual ewol::ObjectShared getSubObjectNamed(const std::string& _objectName);
|
||||
virtual bool loadXML(const std::shared_ptr<const exml::Element>& _node);
|
||||
virtual void setOffset(const vec2& _newVal);
|
||||
virtual void requestDestroyFromChild(const std::shared_ptr<Object>& _child);
|
||||
virtual void requestDestroyFromChild(const ewol::ObjectShared& _child);
|
||||
protected:
|
||||
virtual void onChangePropertyLockExpand();
|
||||
};
|
||||
|
@ -225,8 +225,8 @@ bool ewol::widget::ContextMenu::onEventInput(const ewol::event::Input& _event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::shared_ptr<ewol::Widget> ewol::widget::ContextMenu::getWidgetAtPos(const vec2& _pos) {
|
||||
std::shared_ptr<ewol::Widget> val = ewol::widget::Container::getWidgetAtPos(_pos);
|
||||
ewol::WidgetShared ewol::widget::ContextMenu::getWidgetAtPos(const vec2& _pos) {
|
||||
ewol::WidgetShared val = ewol::widget::Container::getWidgetAtPos(_pos);
|
||||
if (val != nullptr) {
|
||||
return val;
|
||||
}
|
||||
@ -248,7 +248,7 @@ void ewol::widget::ContextMenu::onChangePropertyShape() {
|
||||
|
||||
|
||||
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();
|
||||
// TODO : Support left and right
|
||||
float upperSize = globalSize.y() - (_origin.y() + _size.y());
|
||||
|
@ -17,6 +17,9 @@
|
||||
|
||||
namespace ewol {
|
||||
namespace widget {
|
||||
class ContextMenu;
|
||||
using ContextMenuShared = ewol::SharedPtr<ewol::widget::ContextMenu>;
|
||||
using ContextMenuWeak = ewol::WeakPtr<ewol::widget::ContextMenu>;
|
||||
/**
|
||||
* @ingroup ewolWidgetGroup
|
||||
*/
|
||||
@ -58,7 +61,7 @@ namespace ewol {
|
||||
virtual bool onEventInput(const ewol::event::Input& _event);
|
||||
virtual void onChangeSize();
|
||||
virtual void calculateMinMaxSize();
|
||||
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos);
|
||||
virtual ewol::WidgetShared getWidgetAtPos(const vec2& _pos);
|
||||
protected:
|
||||
virtual void onChangePropertyArrowPos();
|
||||
virtual void onChangePropertyArrawBorder();
|
||||
|
@ -20,6 +20,9 @@
|
||||
|
||||
namespace ewol {
|
||||
namespace widget {
|
||||
class Entry;
|
||||
using EntryShared = ewol::SharedPtr<ewol::widget::Entry>;
|
||||
using EntryWeak = ewol::WeakPtr<ewol::widget::Entry>;
|
||||
/**
|
||||
* @ingroup ewolWidgetGroup
|
||||
* @brief Entry box display :
|
||||
|
@ -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) {
|
||||
return;
|
||||
}
|
||||
@ -233,7 +233,7 @@ void ewol::widget::Gird::subWidgetAdd(int32_t _colId, int32_t _rowId, std::share
|
||||
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++) {
|
||||
if (_newWidget == m_subWidget[iii].widget) {
|
||||
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");
|
||||
}
|
||||
|
||||
void ewol::widget::Gird::subWidgetUnLink(std::shared_ptr<ewol::Widget> _newWidget) {
|
||||
void ewol::widget::Gird::subWidgetUnLink(ewol::WidgetShared _newWidget) {
|
||||
if (_newWidget == nullptr) {
|
||||
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) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -320,7 +320,7 @@ std::shared_ptr<ewol::Widget> ewol::widget::Gird::getWidgetAtPos(const vec2& _po
|
||||
vec2 tmpOrigin = it.widget->getOrigin();
|
||||
if( (tmpOrigin.x() <= _pos.x() && tmpOrigin.x() + tmpSize.x() >= _pos.x())
|
||||
&& (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) {
|
||||
return tmpWidget;
|
||||
}
|
||||
|
@ -15,6 +15,9 @@
|
||||
|
||||
namespace ewol {
|
||||
namespace widget {
|
||||
class Gird;
|
||||
using GirdShared = ewol::SharedPtr<ewol::widget::Gird>;
|
||||
using GirdWeak = ewol::WeakPtr<ewol::widget::Gird>;
|
||||
/**
|
||||
* @ingroup ewolWidgetGroup
|
||||
*/
|
||||
@ -22,7 +25,7 @@ namespace ewol {
|
||||
private:
|
||||
class GirdProperties {
|
||||
public:
|
||||
std::shared_ptr<ewol::Widget> widget;
|
||||
ewol::WidgetShared widget;
|
||||
int32_t row;
|
||||
int32_t col;
|
||||
};
|
||||
@ -30,7 +33,7 @@ namespace ewol {
|
||||
int32_t m_uniformSizeRow;
|
||||
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::shared_ptr<ewol::Widget> m_tmpWidget; //!< use when replace a widget ...
|
||||
ewol::WidgetShared m_tmpWidget; //!< use when replace a widget ...
|
||||
bool m_gavityButtom;
|
||||
protected:
|
||||
/**
|
||||
@ -95,12 +98,12 @@ namespace ewol {
|
||||
* @param[in] _rowId Id of the row [0..y].
|
||||
* @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.
|
||||
* @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.
|
||||
* @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 ...).
|
||||
* @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 ...).
|
||||
* @param[in] _colId Id of the colomn [0..x].
|
||||
@ -136,7 +139,7 @@ namespace ewol {
|
||||
public: // Derived function
|
||||
virtual void systemDraw(const ewol::DrawProperty& _displayProp);
|
||||
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 calculateMinMaxSize();
|
||||
};
|
||||
|
@ -17,6 +17,9 @@
|
||||
|
||||
namespace ewol {
|
||||
namespace widget {
|
||||
class Image;
|
||||
using ImageShared = ewol::SharedPtr<ewol::widget::Image>;
|
||||
using ImageWeak = ewol::WeakPtr<ewol::widget::Image>;
|
||||
/**
|
||||
* @ingroup ewolWidgetGroup
|
||||
*/
|
||||
|
@ -17,6 +17,9 @@
|
||||
|
||||
namespace ewol {
|
||||
namespace widget {
|
||||
class Joystick;
|
||||
using JoystickShared = ewol::SharedPtr<ewol::widget::Joystick>;
|
||||
using JoystickWeak = ewol::WeakPtr<ewol::widget::Joystick>;
|
||||
/**
|
||||
* @ingroup ewolWidgetGroup
|
||||
*/
|
||||
|
@ -17,6 +17,9 @@
|
||||
|
||||
namespace ewol {
|
||||
namespace widget {
|
||||
class Label;
|
||||
using LabelShared = ewol::SharedPtr<ewol::widget::Label>;
|
||||
using LabelWeak = ewol::WeakPtr<ewol::widget::Label>;
|
||||
/**
|
||||
* @ingroup ewolWidgetGroup
|
||||
*/
|
||||
|
@ -21,7 +21,7 @@ ewol::widget::Layer::~Layer() {
|
||||
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) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -34,7 +34,7 @@ std::shared_ptr<ewol::Widget> ewol::widget::Layer::getWidgetAtPos(const vec2& _p
|
||||
vec2 tmpOrigin = it->getOrigin();
|
||||
if( (tmpOrigin.x() <= _pos.x() && tmpOrigin.x() + tmpSize.x() >= _pos.x())
|
||||
&& (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) {
|
||||
return tmpWidget;
|
||||
}
|
||||
|
@ -14,6 +14,9 @@
|
||||
|
||||
namespace ewol {
|
||||
namespace widget {
|
||||
class Layer;
|
||||
using LayerShared = ewol::SharedPtr<ewol::widget::Layer>;
|
||||
using LayerWeak = ewol::WeakPtr<ewol::widget::Layer>;
|
||||
/**
|
||||
* @ingroup ewolWidgetGroup
|
||||
*/
|
||||
@ -30,7 +33,7 @@ namespace ewol {
|
||||
*/
|
||||
virtual ~Layer();
|
||||
public: // Derived function
|
||||
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos);
|
||||
virtual ewol::WidgetShared getWidgetAtPos(const vec2& _pos);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -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());
|
||||
if (true == isUsed) {
|
||||
// TODO : this generate bugs ... I did not understand why ..
|
||||
//std::shared_ptr<ewol::Widget>Manager::focusKeep(this);
|
||||
//ewol::WidgetSharedManager::focusKeep(this);
|
||||
}
|
||||
return isUsed;
|
||||
}
|
||||
|
@ -15,6 +15,9 @@
|
||||
|
||||
namespace ewol {
|
||||
namespace widget {
|
||||
class List;
|
||||
using ListShared = ewol::SharedPtr<ewol::widget::List>;
|
||||
using ListWeak = ewol::WeakPtr<ewol::widget::List>;
|
||||
/**
|
||||
* @ingroup ewolWidgetGroup
|
||||
*/
|
||||
|
@ -14,6 +14,9 @@
|
||||
|
||||
namespace ewol {
|
||||
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 :
|
||||
*/
|
||||
|
@ -74,7 +74,7 @@ ewol::widget::Manager::~Manager() {
|
||||
* 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) {
|
||||
// nothing to do ...
|
||||
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
|
||||
&& _newWidget->propertyCanFocus.get() == false) {
|
||||
EWOL_VERBOSE("Widget can not have focus, id=" << _newWidget->getId() );
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<ewol::Widget> focusWidgetDefault = m_focusWidgetDefault.lock();
|
||||
std::shared_ptr<ewol::Widget> focusWidgetCurrent = m_focusWidgetCurrent.lock();
|
||||
ewol::WidgetShared focusWidgetDefault = m_focusWidgetDefault.lock();
|
||||
ewol::WidgetShared focusWidgetCurrent = m_focusWidgetCurrent.lock();
|
||||
if (focusWidgetDefault == focusWidgetCurrent) {
|
||||
if (focusWidgetCurrent != nullptr) {
|
||||
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() {
|
||||
std::shared_ptr<ewol::Widget> focusWidgetDefault = m_focusWidgetDefault.lock();
|
||||
std::shared_ptr<ewol::Widget> focusWidgetCurrent = m_focusWidgetCurrent.lock();
|
||||
ewol::WidgetShared focusWidgetDefault = m_focusWidgetDefault.lock();
|
||||
ewol::WidgetShared focusWidgetCurrent = m_focusWidgetCurrent.lock();
|
||||
if (focusWidgetDefault == focusWidgetCurrent) {
|
||||
// nothink to do ...
|
||||
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();
|
||||
}
|
||||
|
||||
void ewol::widget::Manager::focusRemoveIfRemove(const std::shared_ptr<ewol::Widget>& _newWidget) {
|
||||
std::shared_ptr<ewol::Widget> focusWidgetDefault = m_focusWidgetDefault.lock();
|
||||
std::shared_ptr<ewol::Widget> focusWidgetCurrent = m_focusWidgetCurrent.lock();
|
||||
void ewol::widget::Manager::focusRemoveIfRemove(const ewol::WidgetShared& _newWidget) {
|
||||
ewol::WidgetShared focusWidgetDefault = m_focusWidgetDefault.lock();
|
||||
ewol::WidgetShared focusWidgetCurrent = m_focusWidgetCurrent.lock();
|
||||
if (focusWidgetCurrent == _newWidget) {
|
||||
EWOL_WARNING("Release focus when remove widget");
|
||||
focusRelease();
|
||||
@ -198,7 +198,7 @@ void ewol::widget::Manager::addWidgetCreator(const std::string& _name,
|
||||
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);
|
||||
if (m_creatorList.exist(nameLower) == true) {
|
||||
ewol::widget::Manager::creator_tf pointerFunction = m_creatorList[nameLower];
|
||||
|
@ -17,11 +17,11 @@ namespace ewol {
|
||||
namespace widget {
|
||||
class Manager {
|
||||
public:
|
||||
typedef std::shared_ptr<ewol::Widget> (*creator_tf)();
|
||||
using creator_tf = std::function<ewol::WidgetShared()>;
|
||||
private:
|
||||
// For the focus Management
|
||||
std::weak_ptr<ewol::Widget> m_focusWidgetDefault;
|
||||
std::weak_ptr<ewol::Widget> m_focusWidgetCurrent;
|
||||
ewol::WidgetWeak m_focusWidgetDefault;
|
||||
ewol::WidgetWeak m_focusWidgetCurrent;
|
||||
bool m_havePeriodic;
|
||||
bool m_haveRedraw;
|
||||
etk::Hash<creator_tf> m_creatorList;
|
||||
@ -29,11 +29,11 @@ namespace ewol {
|
||||
Manager();
|
||||
virtual ~Manager();
|
||||
|
||||
void focusKeep(const std::shared_ptr<ewol::Widget>& _newWidget); // set the focus at the specific widget
|
||||
void focusSetDefault(const std::shared_ptr<ewol::Widget>& _newWidget); // select the default focus getter
|
||||
void focusKeep(const ewol::WidgetShared& _newWidget); // set the focus at the specific widget
|
||||
void focusSetDefault(const ewol::WidgetShared& _newWidget); // select the default focus getter
|
||||
void focusRelease(); // release focus from the current widget to the default
|
||||
std::shared_ptr<ewol::Widget> focusGet();
|
||||
void focusRemoveIfRemove(const std::shared_ptr<ewol::Widget>& _newWidget);
|
||||
ewol::WidgetShared focusGet();
|
||||
void focusRemoveIfRemove(const ewol::WidgetShared& _newWidget);
|
||||
private:
|
||||
std::function<void()> m_funcRedrawNeeded;
|
||||
public:
|
||||
@ -43,7 +43,7 @@ namespace ewol {
|
||||
|
||||
// element that generate the list of elements
|
||||
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);
|
||||
std::string list();
|
||||
private:
|
||||
|
@ -33,16 +33,16 @@ void ewol::widget::Menu::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");
|
||||
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");
|
||||
}
|
||||
|
||||
void ewol::widget::Menu::subWidgetUnLink(std::shared_ptr<ewol::Widget> _newWidget) {
|
||||
void ewol::widget::Menu::subWidgetUnLink(ewol::WidgetShared _newWidget) {
|
||||
EWOL_ERROR("Not availlable");
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ int32_t ewol::widget::Menu::add(int32_t _parent,
|
||||
tmpObject.m_image = _image;
|
||||
tmpObject.m_message = _message;
|
||||
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) {
|
||||
EWOL_ERROR("Allocation button error");
|
||||
return tmpObject.m_localId;
|
||||
@ -104,7 +104,7 @@ int32_t ewol::widget::Menu::add(int32_t _parent,
|
||||
// add it in the widget list
|
||||
ewol::widget::Sizer::subWidgetAdd(myButton);
|
||||
// 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;
|
||||
}
|
||||
m_listElement.push_back(tmpObject);
|
||||
@ -121,8 +121,8 @@ int32_t ewol::widget::Menu::addSpacer() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
void ewol::widget::Menu::onButtonPressed(std::weak_ptr<ewol::widget::Button> _button) {
|
||||
std::shared_ptr<ewol::widget::Button> caller = _button.lock();
|
||||
void ewol::widget::Menu::onButtonPressed(ewol::widget::ButtonWeak _button) {
|
||||
ewol::widget::ButtonShared caller = _button.lock();
|
||||
if (caller == nullptr) {
|
||||
return;
|
||||
}
|
||||
@ -135,7 +135,7 @@ void ewol::widget::Menu::onButtonPressed(std::weak_ptr<ewol::widget::Button> _bu
|
||||
EWOL_DEBUG("Menu == > generate Event");
|
||||
// Send a multicast event ...
|
||||
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) {
|
||||
EWOL_DEBUG("Mark the menu to remove ...");
|
||||
tmpContext->destroy();
|
||||
@ -155,7 +155,7 @@ void ewol::widget::Menu::onButtonPressed(std::weak_ptr<ewol::widget::Button> _bu
|
||||
return;
|
||||
}
|
||||
// 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;
|
||||
if (tmpContext == nullptr) {
|
||||
EWOL_ERROR("Allocation Error");
|
||||
@ -163,7 +163,7 @@ void ewol::widget::Menu::onButtonPressed(std::weak_ptr<ewol::widget::Button> _bu
|
||||
}
|
||||
// get the button widget:
|
||||
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) {
|
||||
vec2 tmpOri = eventFromWidget->getOrigin();
|
||||
vec2 tmpSize = eventFromWidget->getSize();
|
||||
@ -172,8 +172,8 @@ void ewol::widget::Menu::onButtonPressed(std::weak_ptr<ewol::widget::Button> _bu
|
||||
tmpOri.y() );
|
||||
}
|
||||
tmpContext->setPositionMark(ewol::widget::ContextMenu::markTop, newPosition);
|
||||
std::shared_ptr<ewol::widget::Sizer> mySizer;
|
||||
std::shared_ptr<ewol::widget::Button> myButton;
|
||||
ewol::widget::SizerShared mySizer;
|
||||
ewol::widget::ButtonShared myButton;
|
||||
mySizer = ewol::widget::Sizer::create("mode", widget::Sizer::modeVert);
|
||||
if (mySizer != nullptr) {
|
||||
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->propertyFill.set(bvec2(true,true));
|
||||
// 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
|
||||
mySizer->subWidgetAdd(myButton);
|
||||
if (it2->m_image.size() != 0) {
|
||||
@ -226,7 +226,7 @@ void ewol::widget::Menu::onButtonPressed(std::weak_ptr<ewol::widget::Button> _bu
|
||||
" </sizer>\n")
|
||||
);
|
||||
} else {
|
||||
std::shared_ptr<ewol::widget::Label> tmpLabel = widget::Label::create();
|
||||
ewol::widget::LabelShared tmpLabel = widget::Label::create();
|
||||
if (tmpLabel != nullptr) {
|
||||
tmpLabel->propertyValue.set(std::string("<left>") + it2->m_label + "</left>\n");
|
||||
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;
|
||||
}
|
||||
}
|
||||
std::shared_ptr<ewol::widget::Windows> currentWindows = getWindows();
|
||||
ewol::widget::WindowsShared currentWindows = getWindows();
|
||||
if (currentWindows == nullptr) {
|
||||
EWOL_ERROR("Can not get the curent Windows...");
|
||||
} else {
|
||||
|
@ -22,11 +22,14 @@ namespace ewol {
|
||||
MenuElement() { };
|
||||
int32_t m_localId;
|
||||
int32_t m_parentId;
|
||||
std::weak_ptr<ewol::Widget> m_widgetPointer;
|
||||
ewol::WidgetWeak m_widgetPointer;
|
||||
std::string m_label;
|
||||
std::string m_image;
|
||||
std::string m_message;
|
||||
};
|
||||
class Menu;
|
||||
using MenuShared = ewol::SharedPtr<ewol::widget::Menu>;
|
||||
using MenuWeak = ewol::WeakPtr<ewol::widget::Menu>;
|
||||
/**
|
||||
* @ingroup ewolWidgetGroup
|
||||
*/
|
||||
@ -40,13 +43,13 @@ namespace ewol {
|
||||
virtual ~Menu();
|
||||
private:
|
||||
virtual void subWidgetRemoveAll();
|
||||
virtual int32_t subWidgetAdd(std::shared_ptr<ewol::Widget> _newWidget);
|
||||
virtual void subWidgetRemove(std::shared_ptr<ewol::Widget> _newWidget);
|
||||
virtual void subWidgetUnLink(std::shared_ptr<ewol::Widget> _newWidget);
|
||||
virtual int32_t subWidgetAdd(ewol::WidgetShared _newWidget);
|
||||
virtual void subWidgetRemove(ewol::WidgetShared _newWidget);
|
||||
virtual void subWidgetUnLink(ewol::WidgetShared _newWidget);
|
||||
private:
|
||||
std::vector<ewol::widget::MenuElement> m_listElement;
|
||||
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);
|
||||
public:
|
||||
void clear();
|
||||
@ -55,7 +58,7 @@ namespace ewol {
|
||||
int32_t addSpacer();
|
||||
void remove(int32_t _id);
|
||||
private:
|
||||
void onButtonPressed(std::weak_ptr<ewol::widget::Button> _button);
|
||||
void onButtonPressed(ewol::widget::ButtonWeak _button);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -130,8 +130,8 @@ void ewol::widget::PopUp::onRegenerateDisplay() {
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<ewol::Widget> ewol::widget::PopUp::getWidgetAtPos(const vec2& _pos) {
|
||||
std::shared_ptr<ewol::Widget> val = ewol::widget::Container::getWidgetAtPos(_pos);
|
||||
ewol::WidgetShared ewol::widget::PopUp::getWidgetAtPos(const vec2& _pos) {
|
||||
ewol::WidgetShared val = ewol::widget::Container::getWidgetAtPos(_pos);
|
||||
if (val != nullptr) {
|
||||
return val;
|
||||
}
|
||||
|
@ -17,6 +17,9 @@
|
||||
|
||||
namespace ewol {
|
||||
namespace widget {
|
||||
class PopUp;
|
||||
using PopUpShared = ewol::SharedPtr<ewol::widget::PopUp>;
|
||||
using PopUpWeak = ewol::WeakPtr<ewol::widget::PopUp>;
|
||||
/**
|
||||
* @ingroup ewolWidgetGroup
|
||||
*/
|
||||
@ -48,7 +51,7 @@ namespace ewol {
|
||||
virtual void onRegenerateDisplay();
|
||||
virtual void onChangeSize();
|
||||
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:
|
||||
virtual bool onStartAnnimation(enum ewol::Widget::annimationMode _mode);
|
||||
virtual void onStopAnnimation();
|
||||
|
@ -16,6 +16,9 @@
|
||||
|
||||
namespace ewol {
|
||||
namespace widget {
|
||||
class ProgressBar;
|
||||
using ProgressBarShared = ewol::SharedPtr<ewol::widget::ProgressBar>;
|
||||
using ProgressBarWeak = ewol::WeakPtr<ewol::widget::ProgressBar>;
|
||||
/**
|
||||
* @ingroup ewolWidgetGroup
|
||||
*/
|
||||
|
@ -349,8 +349,8 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::shared_ptr<ewol::Widget> ewol::widget::Scroll::getWidgetAtPos(const vec2& _pos) {
|
||||
std::shared_ptr<ewol::Widget> tmpWidget = ewol::widget::Container::getWidgetAtPos(_pos);
|
||||
ewol::WidgetShared ewol::widget::Scroll::getWidgetAtPos(const vec2& _pos) {
|
||||
ewol::WidgetShared tmpWidget = ewol::widget::Container::getWidgetAtPos(_pos);
|
||||
if (tmpWidget != nullptr) {
|
||||
return tmpWidget;
|
||||
}
|
||||
|
@ -16,6 +16,9 @@
|
||||
|
||||
namespace ewol {
|
||||
namespace widget {
|
||||
class Scroll;
|
||||
using ScrollShared = ewol::SharedPtr<ewol::widget::Scroll>;
|
||||
using ScrollWeak = ewol::WeakPtr<ewol::widget::Scroll>;
|
||||
class Scroll : public ewol::widget::Container {
|
||||
public: // properties
|
||||
eproperty::Range<vec2> propertyLimit; //!< Set the limitation of the ratio in the sreen
|
||||
@ -50,7 +53,7 @@ namespace ewol {
|
||||
virtual void onRegenerateDisplay();
|
||||
virtual bool onEventInput(const ewol::event::Input& _event);
|
||||
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
|
||||
virtual void onDraw();
|
||||
protected:
|
||||
|
@ -164,14 +164,14 @@ void ewol::widget::Select::onCallbackLabelPressed(int32_t _value) {
|
||||
|
||||
void ewol::widget::Select::onCallbackOpenMenu() {
|
||||
// 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) {
|
||||
EWOL_ERROR("Allocation Error");
|
||||
return;
|
||||
}
|
||||
// auto-select mark position:
|
||||
tmpContext->setPositionMarkAuto(m_origin, m_size);
|
||||
std::shared_ptr<ewol::widget::Sizer> mySizer;
|
||||
ewol::widget::SizerShared mySizer;
|
||||
mySizer = ewol::widget::Sizer::create();
|
||||
if (mySizer == nullptr) {
|
||||
EWOL_ERROR("Allocation Error or sizer");
|
||||
@ -183,7 +183,7 @@ void ewol::widget::Select::onCallbackOpenMenu() {
|
||||
// set it in the pop-up-system:
|
||||
tmpContext->setSubWidget(mySizer);
|
||||
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) {
|
||||
EWOL_ERROR("Allocation Error");
|
||||
continue;
|
||||
@ -201,7 +201,7 @@ void ewol::widget::Select::onCallbackOpenMenu() {
|
||||
// add it in the widget list
|
||||
mySizer->subWidgetAddStart(myLabel);
|
||||
}
|
||||
std::shared_ptr<ewol::widget::Windows> currentWindows = getWindows();
|
||||
ewol::widget::WindowsShared currentWindows = getWindows();
|
||||
if (currentWindows == nullptr) {
|
||||
EWOL_ERROR("Can not get the curent Windows...");
|
||||
} else {
|
||||
|
@ -13,6 +13,9 @@
|
||||
|
||||
namespace ewol {
|
||||
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
|
||||
* ==> this permit to generate standard element simple
|
||||
|
@ -257,7 +257,7 @@ void ewol::widget::Sizer::calculateMinMaxSize() {
|
||||
//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) {
|
||||
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);
|
||||
}
|
||||
|
||||
int32_t ewol::widget::Sizer::subWidgetAddStart(std::shared_ptr<ewol::Widget> _newWidget) {
|
||||
int32_t ewol::widget::Sizer::subWidgetAddStart(ewol::WidgetShared _newWidget) {
|
||||
if (*propertyAnimation == animationNone) {
|
||||
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);
|
||||
}
|
||||
|
||||
void ewol::widget::Sizer::subWidgetRemove(std::shared_ptr<ewol::Widget> _newWidget) {
|
||||
void ewol::widget::Sizer::subWidgetRemove(ewol::WidgetShared _newWidget) {
|
||||
if (*propertyAnimation == animationNone) {
|
||||
ewol::widget::ContainerN::subWidgetRemove(_newWidget);
|
||||
return;
|
||||
@ -282,7 +282,7 @@ void ewol::widget::Sizer::subWidgetRemove(std::shared_ptr<ewol::Widget> _newWidg
|
||||
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) {
|
||||
ewol::widget::ContainerN::subWidgetUnLink(_newWidget);
|
||||
return;
|
||||
|
@ -16,6 +16,9 @@
|
||||
|
||||
namespace ewol {
|
||||
namespace widget {
|
||||
class Sizer;
|
||||
using SizerShared = ewol::SharedPtr<ewol::widget::Sizer>;
|
||||
using SizerWeak = ewol::WeakPtr<ewol::widget::Sizer>;
|
||||
/**
|
||||
* @ingroup ewolWidgetGroup
|
||||
*/
|
||||
@ -54,10 +57,10 @@ namespace ewol {
|
||||
virtual void onChangeSize();
|
||||
virtual void calculateMinMaxSize();
|
||||
// overwrite the set fuction to start annimations ...
|
||||
virtual int32_t subWidgetAdd(std::shared_ptr<ewol::Widget> _newWidget);
|
||||
virtual int32_t subWidgetAddStart(std::shared_ptr<ewol::Widget> _newWidget);
|
||||
virtual void subWidgetRemove(std::shared_ptr<ewol::Widget> _newWidget);
|
||||
virtual void subWidgetUnLink(std::shared_ptr<ewol::Widget> _newWidget);
|
||||
virtual int32_t subWidgetAdd(ewol::WidgetShared _newWidget);
|
||||
virtual int32_t subWidgetAddStart(ewol::WidgetShared _newWidget);
|
||||
virtual void subWidgetRemove(ewol::WidgetShared _newWidget);
|
||||
virtual void subWidgetUnLink(ewol::WidgetShared _newWidget);
|
||||
protected:
|
||||
virtual void onChangePropertyMode();
|
||||
virtual void onChangePropertyBorderSize();
|
||||
|
@ -16,6 +16,9 @@
|
||||
|
||||
namespace ewol {
|
||||
namespace widget {
|
||||
class Slider;
|
||||
using SliderShared = ewol::SharedPtr<ewol::widget::Slider>;
|
||||
using SliderWeak = ewol::WeakPtr<ewol::widget::Slider>;
|
||||
/**
|
||||
* @ingroup ewolWidgetGroup
|
||||
*/
|
||||
|
@ -16,6 +16,9 @@
|
||||
|
||||
namespace ewol {
|
||||
namespace widget {
|
||||
class Spacer;
|
||||
using SpacerShared = ewol::SharedPtr<ewol::widget::Spacer>;
|
||||
using SpacerWeak = ewol::WeakPtr<ewol::widget::Spacer>;
|
||||
/**
|
||||
* @ingroup ewolWidgetGroup
|
||||
*/
|
||||
@ -36,7 +39,7 @@ namespace ewol {
|
||||
private:
|
||||
ewol::compositing::Drawing m_draw; //!< Compositing drawing element
|
||||
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 onDraw();
|
||||
protected:
|
||||
|
@ -13,6 +13,9 @@
|
||||
|
||||
namespace ewol {
|
||||
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
|
||||
* ==> this permit to generate standard element simple
|
||||
|
@ -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) {
|
||||
EWOL_ERROR("Can not change to a widget nullptr");
|
||||
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) {
|
||||
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())
|
||||
&& (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) {
|
||||
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())
|
||||
&& (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) {
|
||||
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())
|
||||
&& (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) {
|
||||
return tmpWidget;
|
||||
}
|
||||
|
@ -15,6 +15,9 @@
|
||||
|
||||
namespace ewol {
|
||||
namespace widget {
|
||||
class WSlider;
|
||||
using WSliderShared = ewol::SharedPtr<ewol::widget::WSlider>;
|
||||
using WSliderWeak = ewol::WeakPtr<ewol::widget::WSlider>;
|
||||
/**
|
||||
* @ingroup ewolWidgetGroup
|
||||
*/
|
||||
@ -58,7 +61,7 @@ namespace ewol {
|
||||
* @brief Select a new subwidget to display
|
||||
* @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
|
||||
* @param[in] _widgetName Name of the subwidget name
|
||||
@ -68,7 +71,7 @@ namespace ewol {
|
||||
virtual void onChangeSize();
|
||||
virtual void systemDraw(const ewol::DrawProperty& _displayProp);
|
||||
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);
|
||||
protected:
|
||||
virtual void onChangePropertySelectWidget();
|
||||
|
@ -547,7 +547,7 @@ bool ewol::Widget::loadXML(const std::shared_ptr<const exml::Element>& _node) {
|
||||
}
|
||||
|
||||
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->systemEventEntry(_event) == true) {
|
||||
return true;
|
||||
@ -557,7 +557,7 @@ bool ewol::Widget::systemEventEntry(ewol::event::EntrySystem& _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->systemEventInput(_event) == true) {
|
||||
return true;
|
||||
@ -636,7 +636,7 @@ ewol::widget::Manager& ewol::Widget::getWidgetManager() {
|
||||
return getContext().getWidgetManager();
|
||||
}
|
||||
|
||||
std::shared_ptr<ewol::widget::Windows> ewol::Widget::getWindows() {
|
||||
ewol::widget::WindowsShared ewol::Widget::getWindows() {
|
||||
return getContext().getWindows();
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,8 @@ namespace ewol {
|
||||
class Manager;
|
||||
class Windows;
|
||||
};
|
||||
using WidgetShared = ewol::SharedPtr<ewol::Widget>;
|
||||
using WidgetWeak = ewol::WeakPtr<ewol::Widget>;
|
||||
};
|
||||
#include <gale/context/clipBoard.h>
|
||||
#include <gale/key/key.h>
|
||||
@ -39,7 +41,7 @@ namespace ewol {
|
||||
#define DECLARE_WIDGET_FACTORY(className, name) \
|
||||
DECLARE_FACTORY(className); \
|
||||
static void createManagerWidget(ewol::widget::Manager& _widgetManager) { \
|
||||
_widgetManager.addWidgetCreator(name, []() -> std::shared_ptr<ewol::Widget> { \
|
||||
_widgetManager.addWidgetCreator(name, []() -> ewol::WidgetShared { \
|
||||
return className::create(); \
|
||||
}); \
|
||||
}
|
||||
@ -348,7 +350,7 @@ namespace ewol {
|
||||
* @return pointer on the widget found
|
||||
* @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) {
|
||||
return std::dynamic_pointer_cast<ewol::Widget>(shared_from_this());
|
||||
}
|
||||
@ -526,7 +528,7 @@ namespace ewol {
|
||||
/**
|
||||
* @brief get the curent Windows
|
||||
*/
|
||||
std::shared_ptr<ewol::widget::Windows> getWindows();
|
||||
ewol::SharedPtr<ewol::widget::Windows> getWindows();
|
||||
/*
|
||||
* Annimation section :
|
||||
*/
|
||||
|
@ -17,6 +17,9 @@
|
||||
|
||||
namespace ewol {
|
||||
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.
|
||||
*/
|
||||
|
@ -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
|
||||
vec2 relativePos = relativePosition(_pos);
|
||||
// event go directly on the pop-up
|
||||
@ -160,7 +160,7 @@ void ewol::widget::Windows::systemDraw(const ewol::DrawProperty& _displayProp) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void ewol::widget::Windows::setSubWidget(std::shared_ptr<ewol::Widget> _widget) {
|
||||
void ewol::widget::Windows::setSubWidget(ewol::WidgetShared _widget) {
|
||||
if (m_subWidget != nullptr) {
|
||||
EWOL_INFO("Remove current main windows Widget...");
|
||||
m_subWidget->removeParent();
|
||||
@ -175,7 +175,7 @@ void ewol::widget::Windows::setSubWidget(std::shared_ptr<ewol::Widget> _widget)
|
||||
onChangeSize();
|
||||
}
|
||||
|
||||
void ewol::widget::Windows::popUpWidgetPush(std::shared_ptr<ewol::Widget> _widget) {
|
||||
void ewol::widget::Windows::popUpWidgetPush(ewol::WidgetShared _widget) {
|
||||
if (_widget == nullptr) {
|
||||
// nothing to do an error appear :
|
||||
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) {
|
||||
std::shared_ptr<ewol::widget::StdPopUp> tmpPopUp = widget::StdPopUp::create();
|
||||
ewol::widget::StdPopUpShared tmpPopUp = widget::StdPopUp::create();
|
||||
if (tmpPopUp == nullptr) {
|
||||
EWOL_ERROR("Can not create a simple pop-up");
|
||||
return;
|
||||
@ -238,7 +238,7 @@ void ewol::widget::Windows::createPopUpMessage(enum popUpMessageType _type, cons
|
||||
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();
|
||||
while (it != m_popUpWidgetList.end()) {
|
||||
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) {
|
||||
std::shared_ptr<ewol::Object> tmpObject = ewol::Widget::getSubObjectNamed(_objectName);
|
||||
ewol::ObjectShared ewol::widget::Windows::getSubObjectNamed(const std::string& _objectName) {
|
||||
ewol::ObjectShared tmpObject = ewol::Widget::getSubObjectNamed(_objectName);
|
||||
if (tmpObject != nullptr) {
|
||||
return tmpObject;
|
||||
}
|
||||
|
@ -16,6 +16,9 @@
|
||||
|
||||
namespace ewol {
|
||||
namespace widget {
|
||||
class Windows;
|
||||
using WindowsShared = ewol::SharedPtr<ewol::widget::Windows>;
|
||||
using WindowsWeak = ewol::WeakPtr<ewol::widget::Windows>;
|
||||
/**
|
||||
* @brief Windows basic interface
|
||||
*/
|
||||
@ -46,11 +49,11 @@ namespace ewol {
|
||||
virtual void onStateSuspend() {};
|
||||
virtual void onStateResume() {};
|
||||
private:
|
||||
std::shared_ptr<ewol::Widget> m_subWidget;
|
||||
std::list<std::shared_ptr<ewol::Widget>> m_popUpWidgetList;
|
||||
ewol::WidgetShared m_subWidget;
|
||||
std::list<ewol::WidgetShared> m_popUpWidgetList;
|
||||
public:
|
||||
void setSubWidget(std::shared_ptr<ewol::Widget> _widget);
|
||||
void popUpWidgetPush(std::shared_ptr<ewol::Widget> _widget);
|
||||
void setSubWidget(ewol::WidgetShared _widget);
|
||||
void popUpWidgetPush(ewol::WidgetShared _widget);
|
||||
void popUpWidgetPop();
|
||||
size_t popUpCount() {
|
||||
return m_popUpWidgetList.size();
|
||||
@ -75,9 +78,9 @@ namespace ewol {
|
||||
public: // Derived function
|
||||
virtual void onRegenerateDisplay();
|
||||
virtual void onChangeSize();
|
||||
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos);
|
||||
virtual void requestDestroyFromChild(const std::shared_ptr<Object>& _child);
|
||||
virtual std::shared_ptr<ewol::Object> getSubObjectNamed(const std::string& _objectName);
|
||||
virtual ewol::WidgetShared getWidgetAtPos(const vec2& _pos);
|
||||
virtual void requestDestroyFromChild(const ewol::ObjectShared& _child);
|
||||
virtual ewol::ObjectShared getSubObjectNamed(const std::string& _objectName);
|
||||
void setTitle(const std::string& _title);
|
||||
public:
|
||||
enum popUpMessageType {
|
||||
|
@ -20,6 +20,9 @@
|
||||
|
||||
namespace ewol {
|
||||
namespace widget {
|
||||
class ColorChooser;
|
||||
using ColorChooserShared = ewol::SharedPtr<ewol::widget::ColorChooser>;
|
||||
using ColorChooserWeak = ewol::WeakPtr<ewol::widget::ColorChooser>;
|
||||
/**
|
||||
* @ingroup ewolWidgetGroup
|
||||
*/
|
||||
@ -35,11 +38,11 @@ namespace ewol {
|
||||
DECLARE_WIDGET_FACTORY(ColorChooser, "ColorChooser");
|
||||
virtual ~ColorChooser();
|
||||
private:
|
||||
std::shared_ptr<ewol::widget::ColorBar> m_widgetColorBar;
|
||||
std::shared_ptr<ewol::widget::Slider> m_widgetRed;
|
||||
std::shared_ptr<ewol::widget::Slider> m_widgetGreen;
|
||||
std::shared_ptr<ewol::widget::Slider> m_widgetBlue;
|
||||
std::shared_ptr<ewol::widget::Slider> m_widgetAlpha;
|
||||
ewol::widget::ColorBarShared m_widgetColorBar;
|
||||
ewol::widget::SliderShared m_widgetRed;
|
||||
ewol::widget::SliderShared m_widgetGreen;
|
||||
ewol::widget::SliderShared m_widgetBlue;
|
||||
ewol::widget::SliderShared m_widgetAlpha;
|
||||
void onCallbackColorChangeRed(const float& _newColor);
|
||||
void onCallbackColorChangeGreen(const float& _newColor);
|
||||
void onCallbackColorChangeBlue(const float& _newColor);
|
||||
|
@ -14,6 +14,9 @@
|
||||
|
||||
namespace ewol {
|
||||
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 ...
|
||||
*
|
||||
@ -26,7 +29,7 @@ namespace ewol {
|
||||
*
|
||||
* The first step is to create the file chooser pop-up : (never in the constructor!!!)
|
||||
* [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) {
|
||||
* APPL_ERROR("Can not open File chooser !!! ");
|
||||
* return -1;
|
||||
@ -42,7 +45,7 @@ namespace ewol {
|
||||
* // simply set a folder (by default this is the home folder)
|
||||
* //tmpWidget->setFolder("/home/me");
|
||||
* // add the widget as windows pop-up ...
|
||||
* std::shared_ptr<ewol::widget::Windows> tmpWindows = getWindows();
|
||||
* ewol::widget::WindowsShared tmpWindows = getWindows();
|
||||
* if (tmpWindows == nullptr) {
|
||||
* APPL_ERROR("Can not get the current windows !!! ");
|
||||
* return -1;
|
||||
|
@ -36,9 +36,9 @@ ewol::widget::Parameter::Parameter() :
|
||||
void ewol::widget::Parameter::init() {
|
||||
ewol::widget::PopUp::init();
|
||||
|
||||
std::shared_ptr<ewol::widget::Sizer> mySizerVert = nullptr;
|
||||
std::shared_ptr<ewol::widget::Sizer> mySizerHori = nullptr;
|
||||
std::shared_ptr<ewol::widget::Spacer> mySpacer = nullptr;
|
||||
ewol::widget::SizerShared mySizerVert = nullptr;
|
||||
ewol::widget::SizerShared mySizerHori = nullptr;
|
||||
ewol::widget::SpacerShared mySpacer = nullptr;
|
||||
#ifdef __TARGET_OS__Android
|
||||
propertyMinSize.set(gale::Dimension(vec2(90, 90), gale::Dimension::Pourcent));
|
||||
#else
|
||||
@ -71,7 +71,7 @@ void ewol::widget::Parameter::init() {
|
||||
mySizerHori->subWidgetAdd(mySpacer);
|
||||
}
|
||||
|
||||
std::shared_ptr<ewol::widget::Button> tmpButton = widget::Button::create();
|
||||
ewol::widget::ButtonShared tmpButton = widget::Button::create();
|
||||
if (tmpButton == nullptr) {
|
||||
EWOL_ERROR("Can not allocate widget == > display might be in error");
|
||||
} else {
|
||||
@ -134,7 +134,7 @@ void ewol::widget::Parameter::init() {
|
||||
mySizerHori->subWidgetAdd(mySpacer);
|
||||
}
|
||||
|
||||
std::shared_ptr<ewol::widget::Sizer> mySizerVert2 = widget::Sizer::create();
|
||||
ewol::widget::SizerShared mySizerVert2 = widget::Sizer::create();
|
||||
if (mySizerVert2 == nullptr) {
|
||||
EWOL_ERROR("Can not allocate widget == > display might be in error");
|
||||
} 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) {
|
||||
m_paramList->menuAdd(_label, m_currentIdList, _image);
|
||||
if (nullptr != m_wSlider) {
|
||||
@ -220,7 +220,7 @@ void ewol::widget::Parameter::menuAdd(std::string _label, std::string _image, st
|
||||
m_wSlider->subWidgetAdd(_associateWidget);
|
||||
} else {
|
||||
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) {
|
||||
EWOL_ERROR("Can not allocate widget == > display might be in error");
|
||||
} else {
|
||||
|
@ -21,6 +21,9 @@
|
||||
|
||||
namespace ewol {
|
||||
namespace widget {
|
||||
class Parameter;
|
||||
using ParameterShared = ewol::SharedPtr<ewol::widget::Parameter>;
|
||||
using ParameterWeak = ewol::WeakPtr<ewol::widget::Parameter>;
|
||||
/**
|
||||
* @ingroup ewolWidgetGroup
|
||||
*/
|
||||
@ -36,15 +39,15 @@ namespace ewol {
|
||||
DECLARE_WIDGET_FACTORY(Parameter, "Parameter");
|
||||
virtual ~Parameter();
|
||||
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 menuClear();
|
||||
void menuSeparator();
|
||||
private:
|
||||
int32_t m_currentIdList;
|
||||
std::shared_ptr<ewol::widget::Label> m_widgetTitle;
|
||||
std::shared_ptr<ewol::widget::ParameterList> m_paramList;
|
||||
std::shared_ptr<ewol::widget::WSlider> m_wSlider;
|
||||
ewol::widget::LabelShared m_widgetTitle;
|
||||
ewol::widget::ParameterListShared m_paramList;
|
||||
ewol::widget::WSliderShared m_wSlider;
|
||||
private: //callback functions:
|
||||
void onCallbackMenuclosed();
|
||||
void onCallbackParameterSave();
|
||||
|
@ -12,8 +12,6 @@
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/widget/WidgetScrolled.h>
|
||||
|
||||
|
||||
|
||||
namespace ewol {
|
||||
namespace widget {
|
||||
class elementPL {
|
||||
@ -31,7 +29,9 @@ namespace ewol {
|
||||
};
|
||||
virtual ~elementPL() {};
|
||||
};
|
||||
|
||||
class ParameterList;
|
||||
using ParameterListShared = ewol::SharedPtr<ewol::widget::ParameterList>;
|
||||
using ParameterListWeak = ewol::WeakPtr<ewol::widget::ParameterList>;
|
||||
/**
|
||||
* @ingroup ewolWidgetGroup
|
||||
*/
|
||||
|
@ -96,7 +96,7 @@ void ewol::widget::SpinBase::updateGui() {
|
||||
m_widgetButtonDown->propertyExpand.set(bvec2(false,false));
|
||||
m_widgetButtonDown->propertyFill.set(bvec2(true,true));
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -111,7 +111,7 @@ void ewol::widget::SpinBase::updateGui() {
|
||||
m_widgetButtonUp->propertyExpand.set(bvec2(false,false));
|
||||
m_widgetButtonUp->propertyFill.set(bvec2(true,true));
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -57,6 +57,9 @@ namespace ewol {
|
||||
*/
|
||||
spinPosition_RightRight
|
||||
};
|
||||
class SpinBase;
|
||||
using SpinBaseShared = ewol::SharedPtr<ewol::widget::SpinBase>;
|
||||
using SpinBaseWeak = ewol::WeakPtr<ewol::widget::SpinBase>;
|
||||
/**
|
||||
* @ingroup ewolWidgetGroup
|
||||
*/
|
||||
@ -86,9 +89,9 @@ namespace ewol {
|
||||
*/
|
||||
virtual ~SpinBase();
|
||||
protected:
|
||||
std::shared_ptr<ewol::widget::Entry> m_widgetEntry;
|
||||
std::shared_ptr<ewol::widget::Button> m_widgetButtonDown;
|
||||
std::shared_ptr<ewol::widget::Button> m_widgetButtonUp;
|
||||
ewol::widget::EntryShared m_widgetEntry;
|
||||
ewol::widget::ButtonShared m_widgetButtonDown;
|
||||
ewol::widget::ButtonShared m_widgetButtonUp;
|
||||
virtual void updateGui();
|
||||
public: // Derived function
|
||||
virtual bool loadXML(const std::shared_ptr<const exml::Element>& _node);
|
||||
|
@ -26,8 +26,8 @@ ewol::widget::StdPopUp::StdPopUp() :
|
||||
void ewol::widget::StdPopUp::init() {
|
||||
ewol::widget::PopUp::init();
|
||||
propertyMinSize.set(gale::Dimension(vec2(20,10),gale::Dimension::Pourcent));
|
||||
std::shared_ptr<ewol::widget::Sizer> mySizerVert;
|
||||
std::shared_ptr<ewol::widget::Spacer> mySpacer;
|
||||
ewol::widget::SizerShared mySizerVert;
|
||||
ewol::widget::SpacerShared mySpacer;
|
||||
|
||||
mySizerVert = ewol::widget::Sizer::create();
|
||||
// set it in the pop-up-system :
|
||||
@ -96,12 +96,12 @@ void ewol::widget::StdPopUp::setComment(const std::string& _text) {
|
||||
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) {
|
||||
EWOL_ERROR("button-bar does not existed ...");
|
||||
return nullptr;
|
||||
}
|
||||
std::shared_ptr<ewol::widget::Button> myButton = widget::Button::create();
|
||||
ewol::widget::ButtonShared myButton = widget::Button::create();
|
||||
if (myButton == nullptr) {
|
||||
EWOL_ERROR("Can not allocate new button ...");
|
||||
return nullptr;
|
||||
|
@ -13,6 +13,9 @@
|
||||
#include <ewol/widget/Sizer.h>
|
||||
namespace ewol {
|
||||
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:
|
||||
*
|
||||
@ -53,7 +56,7 @@ namespace ewol {
|
||||
*/
|
||||
virtual ~StdPopUp();
|
||||
protected:
|
||||
std::shared_ptr<ewol::widget::Label> m_title; //!< Title Label widget
|
||||
ewol::widget::LabelShared m_title; //!< Title Label widget
|
||||
public:
|
||||
/**
|
||||
* @brief Set the title string.
|
||||
@ -61,7 +64,7 @@ namespace ewol {
|
||||
*/
|
||||
void setTitle(const std::string& _text);
|
||||
protected:
|
||||
std::shared_ptr<ewol::widget::Label> m_comment; //!< Comment label widget
|
||||
ewol::widget::LabelShared m_comment; //!< Comment label widget
|
||||
public:
|
||||
/**
|
||||
* @brief Set the commentary string.
|
||||
@ -69,13 +72,13 @@ namespace ewol {
|
||||
*/
|
||||
void setComment(const std::string& _text);
|
||||
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:
|
||||
/**
|
||||
* @brief Add a buttom 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
|
||||
void onCallBackButtonExit();
|
||||
};
|
||||
|
@ -48,7 +48,8 @@ def create(target, module_name):
|
||||
'ewol/Padding.h',
|
||||
'ewol/translate.h',
|
||||
'ewol/DrawProperty.h',
|
||||
'ewol/gravity.h'
|
||||
'ewol/gravity.h',
|
||||
'ewol/memory.h'
|
||||
])
|
||||
|
||||
# compositing:
|
||||
|
Loading…
Reference in New Issue
Block a user