[DEV] try variant implementation
This commit is contained in:
parent
c2bc4c553c
commit
d1caa7cb3b
@ -68,6 +68,11 @@ void ewol::Object::init() {
|
|||||||
m_objectHasBeenInit = true;
|
m_objectHasBeenInit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ewol::Object::init(const std::unordered_map<std::string,eproperty::Variant>& _listProperty) {
|
||||||
|
init();
|
||||||
|
// TODO ...
|
||||||
|
}
|
||||||
|
|
||||||
void ewol::Object::init(const std::string& _name) {
|
void ewol::Object::init(const std::string& _name) {
|
||||||
init();
|
init();
|
||||||
propertyName.set(_name);
|
propertyName.set(_name);
|
||||||
|
@ -12,12 +12,14 @@
|
|||||||
#include <exml/exml.h>
|
#include <exml/exml.h>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <eproperty/Interface.h>
|
#include <eproperty/Interface.h>
|
||||||
#include <eproperty/Value.h>
|
#include <eproperty/Value.h>
|
||||||
#include <eproperty/Range.h>
|
#include <eproperty/Range.h>
|
||||||
#include <eproperty/List.h>
|
#include <eproperty/List.h>
|
||||||
|
#include <eproperty/Variant.h>
|
||||||
#include <esignal/Interface.h>
|
#include <esignal/Interface.h>
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
@ -93,6 +95,7 @@ namespace ewol {
|
|||||||
void init();
|
void init();
|
||||||
//! @previous
|
//! @previous
|
||||||
void init(const std::string& _name);
|
void init(const std::string& _name);
|
||||||
|
void init(const std::unordered_map<std::string,eproperty::Variant>& _listProperty);
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Factory
|
* @brief Factory
|
||||||
|
@ -25,6 +25,10 @@ ewol::widget::ContainerN::ContainerN() :
|
|||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ewol::widget::ContainerN::init(const std::unordered_map<std::string,eproperty::Variant>& _listProperty) {
|
||||||
|
ewol::Widget::init(_listProperty);
|
||||||
|
}
|
||||||
|
|
||||||
void ewol::widget::ContainerN::init() {
|
void ewol::widget::ContainerN::init() {
|
||||||
ewol::Widget::init();
|
ewol::Widget::init();
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ namespace ewol {
|
|||||||
*/
|
*/
|
||||||
ContainerN();
|
ContainerN();
|
||||||
void init();
|
void init();
|
||||||
|
void init(const std::unordered_map<std::string,eproperty::Variant>& _listProperty);
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Destructor
|
* @brief Destructor
|
||||||
|
@ -38,6 +38,10 @@ ewol::widget::Sizer::Sizer() :
|
|||||||
propertyAnimation.add(animationRight, "right");
|
propertyAnimation.add(animationRight, "right");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ewol::widget::Sizer::init(const std::unordered_map<std::string,eproperty::Variant>& _listProperty) {
|
||||||
|
ewol::widget::ContainerN::init(_listProperty);
|
||||||
|
}
|
||||||
|
|
||||||
void ewol::widget::Sizer::init(enum displayMode _mode) {
|
void ewol::widget::Sizer::init(enum displayMode _mode) {
|
||||||
ewol::widget::ContainerN::init();
|
ewol::widget::ContainerN::init();
|
||||||
propertyMode.set(_mode);
|
propertyMode.set(_mode);
|
||||||
|
@ -43,6 +43,7 @@ namespace ewol {
|
|||||||
* @brief Main call of recording the widget on the List of "widget named creator"
|
* @brief Main call of recording the widget on the List of "widget named creator"
|
||||||
*/
|
*/
|
||||||
static void init(ewol::widget::Manager& _widgetManager);
|
static void init(ewol::widget::Manager& _widgetManager);
|
||||||
|
void init(const std::unordered_map<std::string,eproperty::Variant>& _listProperty);
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
|
@ -43,6 +43,10 @@ ewol::widget::Spin::Spin() :
|
|||||||
addObjectType("ewol::widget::Spin");
|
addObjectType("ewol::widget::Spin");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ewol::widget::Spin::init(const std::unordered_map<std::string,eproperty::Variant>& _listProperty) {
|
||||||
|
ewol::widget::SpinBase::init(_listProperty);
|
||||||
|
}
|
||||||
|
|
||||||
void ewol::widget::Spin::init(enum ewol::widget::spinPosition _mode,
|
void ewol::widget::Spin::init(enum ewol::widget::spinPosition _mode,
|
||||||
const std::string& _shaperName) {
|
const std::string& _shaperName) {
|
||||||
EWOL_WARNING("init [START]");
|
EWOL_WARNING("init [START]");
|
||||||
|
@ -37,6 +37,7 @@ namespace ewol {
|
|||||||
Spin();
|
Spin();
|
||||||
void init(enum ewol::widget::spinPosition _mode=ewol::widget::spinPosition_RightRight,
|
void init(enum ewol::widget::spinPosition _mode=ewol::widget::spinPosition_RightRight,
|
||||||
const std::string& _shaperName="{ewol}THEME:GUI:Spin.json");
|
const std::string& _shaperName="{ewol}THEME:GUI:Spin.json");
|
||||||
|
void init(const std::unordered_map<std::string,eproperty::Variant>& _listProperty);
|
||||||
public:
|
public:
|
||||||
DECLARE_WIDGET_FACTORY(Spin, "Spin");
|
DECLARE_WIDGET_FACTORY(Spin, "Spin");
|
||||||
/**
|
/**
|
||||||
|
@ -92,6 +92,9 @@ void ewol::Widget::init() {
|
|||||||
void ewol::Widget::init(const std::string& _name) {
|
void ewol::Widget::init(const std::string& _name) {
|
||||||
ewol::Object::init(_name);
|
ewol::Object::init(_name);
|
||||||
}
|
}
|
||||||
|
void ewol::Widget::init(const std::unordered_map<std::string,eproperty::Variant>& _listProperty) {
|
||||||
|
ewol::Object::init(_listProperty);
|
||||||
|
}
|
||||||
|
|
||||||
ewol::Widget::~Widget() {
|
ewol::Widget::~Widget() {
|
||||||
// clean all the short-cut ...
|
// clean all the short-cut ...
|
||||||
|
@ -88,6 +88,7 @@ namespace ewol {
|
|||||||
|
|
||||||
void init();
|
void init();
|
||||||
void init(const std::string& _name);
|
void init(const std::string& _name);
|
||||||
|
void init(const std::unordered_map<std::string,eproperty::Variant>& _listProperty);
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Destructor of the widget classes
|
* @brief Destructor of the widget classes
|
||||||
|
@ -41,6 +41,11 @@ ewol::widget::SpinBase::SpinBase() :
|
|||||||
propertySpinMode.add(ewol::widget::spinPosition_RightRight, "right-right");
|
propertySpinMode.add(ewol::widget::spinPosition_RightRight, "right-right");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ewol::widget::SpinBase::init(const std::unordered_map<std::string,eproperty::Variant>& _listProperty) {
|
||||||
|
ewol::widget::Sizer::init(_listProperty);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void ewol::widget::SpinBase::init(enum ewol::widget::spinPosition _mode,
|
void ewol::widget::SpinBase::init(enum ewol::widget::spinPosition _mode,
|
||||||
const std::string& _shaperName) {
|
const std::string& _shaperName) {
|
||||||
ewol::widget::Sizer::init(ewol::widget::Sizer::modeHori);
|
ewol::widget::Sizer::init(ewol::widget::Sizer::modeHori);
|
||||||
|
@ -85,6 +85,7 @@ namespace ewol {
|
|||||||
SpinBase();
|
SpinBase();
|
||||||
void init(enum ewol::widget::spinPosition _mode,
|
void init(enum ewol::widget::spinPosition _mode,
|
||||||
const std::string& _shaperName);
|
const std::string& _shaperName);
|
||||||
|
void init(const std::unordered_map<std::string,eproperty::Variant>& _listProperty);
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Destructor
|
* @brief Destructor
|
||||||
|
@ -182,6 +182,11 @@ void appl::MainWindows::onCallbackWidgetChange(int32_t _increment) {
|
|||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_subWidget = ewol::widget::SpinBase::create(std::unordered_map<std::string,eproperty::Variant>({{std::string("name"), eproperty::Variant(std::string("plop"))}}));
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
// create the widget with a xml generator (readable for test ...):
|
// create the widget with a xml generator (readable for test ...):
|
||||||
m_subWidget = ewol::widget::composerGenerate(ewol::widget::Composer::String, tmpConstruct);
|
m_subWidget = ewol::widget::composerGenerate(ewol::widget::Composer::String, tmpConstruct);
|
||||||
if (m_subWidget != nullptr) {
|
if (m_subWidget != nullptr) {
|
||||||
|
@ -13,11 +13,11 @@
|
|||||||
#define __class__ "SizerColor"
|
#define __class__ "SizerColor"
|
||||||
|
|
||||||
appl::widget::SizerColor::SizerColor() :
|
appl::widget::SizerColor::SizerColor() :
|
||||||
m_borderColor(*this, "border-color", etk::color::none, "Color of the border"),
|
propertyBorderColor(this, "border-color", etk::color::none, "Color of the border"),
|
||||||
m_leftColor(*this, "color-left", etk::color::purple),
|
propertyLeftColor(this, "color-left", etk::color::purple),
|
||||||
m_rightColor(*this, "color-right", etk::color::orange),
|
propertyRightColor(this, "color-right", etk::color::orange),
|
||||||
m_topColor(*this, "color-top", etk::color::cyan),
|
propertyTopColor(this, "color-top", etk::color::cyan),
|
||||||
m_buttomColor(*this, "color-buttom", etk::color::brown) {
|
propertyButtomColor(this, "color-buttom", etk::color::brown) {
|
||||||
addObjectType("appl::widget::SizerColor");
|
addObjectType("appl::widget::SizerColor");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,10 +36,10 @@ void appl::widget::SizerColor::onRegenerateDisplay() {
|
|||||||
if (tmpBorderSize == vec2(0.0f, 0.0f)) {
|
if (tmpBorderSize == vec2(0.0f, 0.0f)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_borderColor->a() == 0) {
|
if (propertyBorderColor->a() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_draw.setColor(m_borderColor);
|
m_draw.setColor(*propertyBorderColor);
|
||||||
m_draw.setPos(vec3(0, 0, 0) );
|
m_draw.setPos(vec3(0, 0, 0) );
|
||||||
m_draw.rectangleWidth(vec3(tmpBorderSize.x(), m_size.y(),0) );
|
m_draw.rectangleWidth(vec3(tmpBorderSize.x(), m_size.y(),0) );
|
||||||
m_draw.setPos(vec3(m_size.x() - tmpBorderSize.x(), 0, 0) );
|
m_draw.setPos(vec3(m_size.x() - tmpBorderSize.x(), 0, 0) );
|
||||||
@ -55,7 +55,7 @@ void appl::widget::SizerColor::onRegenerateDisplay() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
vec2 size = it->getSize();
|
vec2 size = it->getSize();
|
||||||
if (propertyMode == ewol::widget::Sizer::modeVert) {
|
if (*propertyMode == ewol::widget::Sizer::modeVert) {
|
||||||
underSize += vec2(0.0f, size.y());
|
underSize += vec2(0.0f, size.y());
|
||||||
underSize.setX(std::max(underSize.x(), size.x()));
|
underSize.setX(std::max(underSize.x(), size.x()));
|
||||||
} else {
|
} else {
|
||||||
@ -74,17 +74,17 @@ void appl::widget::SizerColor::onRegenerateDisplay() {
|
|||||||
vec2 origin = it->getOrigin();
|
vec2 origin = it->getOrigin();
|
||||||
vec2 size = it->getSize();
|
vec2 size = it->getSize();
|
||||||
// now we display around the widget every element needed
|
// now we display around the widget every element needed
|
||||||
if (propertyMode == ewol::widget::Sizer::modeHori) {
|
if (*propertyMode == ewol::widget::Sizer::modeHori) {
|
||||||
if (size.y() < localWidgetSize.y()) {
|
if (size.y() < localWidgetSize.y()) {
|
||||||
// under
|
// under
|
||||||
if ((uint32_t(propertyGravity) & uint32_t(ewol::gravity_buttom)) == 0) {
|
if ((uint32_t(*propertyGravity) & uint32_t(ewol::gravity_buttom)) == 0) {
|
||||||
m_draw.setColor(m_buttomColor);
|
m_draw.setColor(*propertyButtomColor);
|
||||||
m_draw.setPos(vec2(origin.x(), localWidgetOrigin.y()) - m_origin);
|
m_draw.setPos(vec2(origin.x(), localWidgetOrigin.y()) - m_origin);
|
||||||
m_draw.rectangleWidth(vec2(it->getSize().x(), origin.y()-localWidgetOrigin.y()) );
|
m_draw.rectangleWidth(vec2(it->getSize().x(), origin.y()-localWidgetOrigin.y()) );
|
||||||
}
|
}
|
||||||
// upper
|
// upper
|
||||||
if ((uint32_t(propertyGravity) & uint32_t(ewol::gravity_top)) == 0) {
|
if ((uint32_t(*propertyGravity) & uint32_t(ewol::gravity_top)) == 0) {
|
||||||
m_draw.setColor(m_topColor);
|
m_draw.setColor(*propertyTopColor);
|
||||||
float startDraw = origin.y()+it->getSize().y() - m_origin.y();
|
float startDraw = origin.y()+it->getSize().y() - m_origin.y();
|
||||||
m_draw.setPos(vec2(origin.x()-m_origin.x(), startDraw));
|
m_draw.setPos(vec2(origin.x()-m_origin.x(), startDraw));
|
||||||
m_draw.rectangleWidth(vec2(it->getSize().x(), localWidgetSize.y()-startDraw+tmpBorderSize.y()) );
|
m_draw.rectangleWidth(vec2(it->getSize().x(), localWidgetSize.y()-startDraw+tmpBorderSize.y()) );
|
||||||
@ -93,14 +93,14 @@ void appl::widget::SizerColor::onRegenerateDisplay() {
|
|||||||
} else {
|
} else {
|
||||||
if (size.x() < localWidgetSize.x()) {
|
if (size.x() < localWidgetSize.x()) {
|
||||||
// left
|
// left
|
||||||
if ((uint32_t(propertyGravity) & uint32_t(ewol::gravity_left)) == 0) {
|
if ((uint32_t(*propertyGravity) & uint32_t(ewol::gravity_left)) == 0) {
|
||||||
m_draw.setColor(m_leftColor);
|
m_draw.setColor(*propertyLeftColor);
|
||||||
m_draw.setPos(vec2(localWidgetOrigin.x(), origin.y()) - m_origin);
|
m_draw.setPos(vec2(localWidgetOrigin.x(), origin.y()) - m_origin);
|
||||||
m_draw.rectangleWidth(vec2(origin.x()-localWidgetOrigin.x(), it->getSize().y()) );
|
m_draw.rectangleWidth(vec2(origin.x()-localWidgetOrigin.x(), it->getSize().y()) );
|
||||||
}
|
}
|
||||||
// right
|
// right
|
||||||
if ((uint32_t(propertyGravity) & uint32_t(ewol::gravity_right)) == 0) {
|
if ((uint32_t(*propertyGravity) & uint32_t(ewol::gravity_right)) == 0) {
|
||||||
m_draw.setColor(m_rightColor);
|
m_draw.setColor(*propertyRightColor);
|
||||||
float startDraw = origin.x()+it->getSize().x() - m_origin.x();
|
float startDraw = origin.x()+it->getSize().x() - m_origin.x();
|
||||||
m_draw.setPos(vec2(startDraw, origin.y()-m_origin.y()));
|
m_draw.setPos(vec2(startDraw, origin.y()-m_origin.y()));
|
||||||
m_draw.rectangleWidth(vec2(localWidgetSize.x()-startDraw+tmpBorderSize.x(), it->getSize().y()) );
|
m_draw.rectangleWidth(vec2(localWidgetSize.x()-startDraw+tmpBorderSize.x(), it->getSize().y()) );
|
||||||
@ -109,17 +109,17 @@ void appl::widget::SizerColor::onRegenerateDisplay() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// now we do the rest of the sizer:
|
// now we do the rest of the sizer:
|
||||||
if (propertyMode == ewol::widget::Sizer::modeHori) {
|
if (*propertyMode == ewol::widget::Sizer::modeHori) {
|
||||||
if (underSize.x() < localWidgetSize.x()) {
|
if (underSize.x() < localWidgetSize.x()) {
|
||||||
// left
|
// left
|
||||||
if ((uint32_t(propertyGravity) & uint32_t(ewol::gravity_left)) == 0) {
|
if ((uint32_t(*propertyGravity) & uint32_t(ewol::gravity_left)) == 0) {
|
||||||
m_draw.setColor(m_leftColor);
|
m_draw.setColor(*propertyLeftColor);
|
||||||
m_draw.setPos(localWidgetOrigin - m_origin);
|
m_draw.setPos(localWidgetOrigin - m_origin);
|
||||||
m_draw.rectangleWidth(vec2(underOrigin.x()-localWidgetOrigin.x(), localWidgetSize.y()) );
|
m_draw.rectangleWidth(vec2(underOrigin.x()-localWidgetOrigin.x(), localWidgetSize.y()) );
|
||||||
}
|
}
|
||||||
// right
|
// right
|
||||||
if ((uint32_t(propertyGravity) & uint32_t(ewol::gravity_right)) == 0) {
|
if ((uint32_t(*propertyGravity) & uint32_t(ewol::gravity_right)) == 0) {
|
||||||
m_draw.setColor(m_rightColor);
|
m_draw.setColor(*propertyRightColor);
|
||||||
float startDraw = underOrigin.x() + underSize.x() - m_origin.x();
|
float startDraw = underOrigin.x() + underSize.x() - m_origin.x();
|
||||||
m_draw.setPos(vec2(startDraw, localWidgetOrigin.y()-m_origin.y()));
|
m_draw.setPos(vec2(startDraw, localWidgetOrigin.y()-m_origin.y()));
|
||||||
m_draw.rectangleWidth(vec2(localWidgetSize.x()-startDraw+tmpBorderSize.x(), localWidgetSize.y()) );
|
m_draw.rectangleWidth(vec2(localWidgetSize.x()-startDraw+tmpBorderSize.x(), localWidgetSize.y()) );
|
||||||
@ -128,14 +128,14 @@ void appl::widget::SizerColor::onRegenerateDisplay() {
|
|||||||
} else {
|
} else {
|
||||||
if (underSize.y() < localWidgetSize.y()) {
|
if (underSize.y() < localWidgetSize.y()) {
|
||||||
// under
|
// under
|
||||||
if ((uint32_t(propertyGravity) & uint32_t(ewol::gravity_buttom)) == 0) {
|
if ((uint32_t(*propertyGravity) & uint32_t(ewol::gravity_buttom)) == 0) {
|
||||||
m_draw.setColor(m_buttomColor);
|
m_draw.setColor(*propertyButtomColor);
|
||||||
m_draw.setPos(localWidgetOrigin - m_origin);
|
m_draw.setPos(localWidgetOrigin - m_origin);
|
||||||
m_draw.rectangleWidth(vec2(localWidgetSize.x(), underOrigin.y()-localWidgetOrigin.y()) );
|
m_draw.rectangleWidth(vec2(localWidgetSize.x(), underOrigin.y()-localWidgetOrigin.y()) );
|
||||||
}
|
}
|
||||||
// upper
|
// upper
|
||||||
if ((uint32_t(propertyGravity) & uint32_t(ewol::gravity_top)) == 0) {
|
if ((uint32_t(*propertyGravity) & uint32_t(ewol::gravity_top)) == 0) {
|
||||||
m_draw.setColor(m_topColor);
|
m_draw.setColor(*propertyTopColor);
|
||||||
float startDraw = underOrigin.y() + underSize.y() - m_origin.y();
|
float startDraw = underOrigin.y() + underSize.y() - m_origin.y();
|
||||||
m_draw.setPos(vec2(localWidgetOrigin.x()-m_origin.x(), startDraw));
|
m_draw.setPos(vec2(localWidgetOrigin.x()-m_origin.x(), startDraw));
|
||||||
m_draw.rectangleWidth(vec2(localWidgetSize.x(), localWidgetSize.y()-startDraw+tmpBorderSize.y()) );
|
m_draw.rectangleWidth(vec2(localWidgetSize.x(), localWidgetSize.y()-startDraw+tmpBorderSize.y()) );
|
||||||
|
@ -34,11 +34,11 @@ namespace appl {
|
|||||||
*/
|
*/
|
||||||
virtual ~SizerColor();
|
virtual ~SizerColor();
|
||||||
private:
|
private:
|
||||||
eproperty::Value<etk::Color<>> m_borderColor; //!< Border color.
|
eproperty::Value<etk::Color<>> propertyBorderColor; //!< Border color.
|
||||||
eproperty::Value<etk::Color<>> m_leftColor; //!< Left color.
|
eproperty::Value<etk::Color<>> propertyLeftColor; //!< Left color.
|
||||||
eproperty::Value<etk::Color<>> m_rightColor; //!< Right color.
|
eproperty::Value<etk::Color<>> propertyRightColor; //!< Right color.
|
||||||
eproperty::Value<etk::Color<>> m_topColor; //!< Top color.
|
eproperty::Value<etk::Color<>> propertyTopColor; //!< Top color.
|
||||||
eproperty::Value<etk::Color<>> m_buttomColor; //!< Buttom color.
|
eproperty::Value<etk::Color<>> propertyButtomColor; //!< Buttom color.
|
||||||
private:
|
private:
|
||||||
ewol::compositing::Drawing m_draw; //!< Compositing drawing element for display the border.
|
ewol::compositing::Drawing m_draw; //!< Compositing drawing element for display the border.
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user