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