[DEV] simplify factory

This commit is contained in:
Edouard DUPIN 2016-03-07 21:50:25 +01:00
parent d1caa7cb3b
commit 9371f59962
68 changed files with 209 additions and 364 deletions

View File

@ -68,16 +68,6 @@ 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) {
init();
propertyName.set(_name);
}
const char * const ewol::Object::getObjectType() { const char * const ewol::Object::getObjectType() {
if (m_listType.size() == 0) { if (m_listType.size() == 0) {
return "ewol::Object"; return "ewol::Object";

View File

@ -19,7 +19,6 @@
#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 {
@ -31,22 +30,56 @@ namespace ewol {
class Context; class Context;
}; };
template<class TYPE_OBJECT> static void baseInit(const std::shared_ptr<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 ) {
eproperty::Property* prop(nullptr);
eproperty::PropertyType<TYPE_VAL>* propType(nullptr);
if (_object == nullptr) {
EWOL_ERROR("EMPTY pointer");
return;
}
prop = _object->getPropertyRaw(_name);
if (prop == nullptr) {
EWOL_ERROR("property does not exit ... '" << _name << "'");
goto exit_on_error;
}
propType = dynamic_cast<eproperty::PropertyType<TYPE_VAL>*>(prop);
if (propType == nullptr) {
EWOL_ERROR("property does not cast in requested type ... '" << _name << "' require type : " << typeid(_val).name() << "' instead of '" << prop->getType() << "'");
goto exit_on_error;
}
propType->setDirectCheck(_val);
exit_on_error:
baseInit(_object, std::forward<TYPE>(_all)... );
return;
}
#define UN_DECLARE_FACTORY(className) \
template<typename ... TYPE> static std::shared_ptr<className> create(const TYPE& ... _all) = delete;
#define DECLARE_FACTORY(className) \ #define DECLARE_FACTORY(className) \
template<typename ... T> static std::shared_ptr<className> create( T&& ... all ) { \ template<typename ... TYPE> static std::shared_ptr<className> create(const TYPE& ... _all) { \
std::shared_ptr<className> object(new className()); \ std::shared_ptr<className> object(new className()); \
if (object == nullptr) { \ if (object == nullptr) { \
EWOL_ERROR("Factory error"); \ EWOL_ERROR("Factory error"); \
return nullptr; \ return nullptr; \
} \ } \
object->init(std::forward<T>(all)... ); \ /*object->initNoValue();*/ \
/*baseInit(object, std::forward<TYPE>(_all)... ); */ \
baseInit(object, _all... ); \
object->init(); \
if (object->objectHasBeenCorectlyInit() == false) { \ if (object->objectHasBeenCorectlyInit() == false) { \
EWOL_CRITICAL("Object Is not correctly init : " << #className ); \ EWOL_CRITICAL("Object Is not correctly init : " << #className ); \
} \ } \
return object; \ return object; \
} }
#define DECLARE_SINGLE_FACTORY(className,uniqueName) \ #define DECLARE_SINGLE_FACTORY(className, uniqueName) \
template<typename ... T> static std::shared_ptr<className> create( T&& ... all ) { \ template<typename ... TYPE> static std::shared_ptr<className> create(const TYPE& ... _all) { \
std::shared_ptr<className> object; \ std::shared_ptr<className> object; \
std::shared_ptr<ewol::Object> object2 = getObjectNamed(uniqueName); \ std::shared_ptr<ewol::Object> object2 = getObjectNamed(uniqueName); \
if (object2 != nullptr) { \ if (object2 != nullptr) { \
@ -59,16 +92,7 @@ namespace ewol {
if (object != nullptr) { \ if (object != nullptr) { \
return object; \ return object; \
} \ } \
object = std::shared_ptr<className>(new className()); \ return create("name", std::string(uniqueName), _all...); \
if (object == nullptr) { \
EWOL_ERROR("Factory error"); \
return nullptr; \
} \
object->init(uniqueName, std::forward<T>(all)... ); \
if (object->objectHasBeenCorectlyInit() == false) { \
EWOL_CRITICAL("Object is not correctly init : " << #className ); \
} \
return object; \
} }
namespace ewol { namespace ewol {
@ -92,10 +116,7 @@ namespace ewol {
* @brief Constructor. * @brief Constructor.
*/ */
Object(); Object();
void init(); virtual void init();
//! @previous
void init(const std::string& _name);
void init(const std::unordered_map<std::string,eproperty::Variant>& _listProperty);
public: public:
/** /**
* @brief Factory * @brief Factory

View File

@ -18,11 +18,6 @@ void ewol::object::Worker::init() {
ewol::Object::init(); ewol::Object::init();
getObjectManager().workerAdd(shared_from_this()); getObjectManager().workerAdd(shared_from_this());
} }
//! @previous
void ewol::object::Worker::init(const std::string& _name) {
ewol::Object::init(_name);
getObjectManager().workerAdd(shared_from_this());
}
ewol::object::Worker::~Worker() { ewol::object::Worker::~Worker() {
// nothing to do ... // nothing to do ...

View File

@ -22,8 +22,6 @@ namespace ewol {
*/ */
Worker(); Worker();
void init(); void init();
//! @previous
void init(const std::string& _name);
public: public:
/** /**
* @brief Factory * @brief Factory

View File

@ -27,7 +27,7 @@ ewol::widget::Button::Button() :
signalEnter(this, "enter", "The cursor enter inside the button"), signalEnter(this, "enter", "The cursor enter inside the button"),
signalLeave(this, "leave", "the cursor leave the button"), signalLeave(this, "leave", "the cursor leave the button"),
signalValue(this, "value", "button value change"), signalValue(this, "value", "button value change"),
propertyShape(this, "shaper", "", "The display name for config file", &ewol::widget::Button::onChangePropertyShape), propertyShape(this, "shaper", "{ewol}THEME:GUI:Button.json", "The display name for config file", &ewol::widget::Button::onChangePropertyShape),
propertyValue(this, "value", false, "Value of the Button", &ewol::widget::Button::onChangePropertyValue), propertyValue(this, "value", false, "Value of the Button", &ewol::widget::Button::onChangePropertyValue),
propertyLock(this, "lock", lockNone, "Lock the button in a special state to permit changing state only by the coder", &ewol::widget::Button::onChangePropertyLock), propertyLock(this, "lock", lockNone, "Lock the button in a special state to permit changing state only by the coder", &ewol::widget::Button::onChangePropertyLock),
propertyToggleMode(this, "toggle", false, "The Button can toogle", &ewol::widget::Button::onChangePropertyToggleMode), propertyToggleMode(this, "toggle", false, "The Button can toogle", &ewol::widget::Button::onChangePropertyToggleMode),
@ -44,16 +44,17 @@ ewol::widget::Button::Button() :
propertyLock.add(lockWhenReleased, "released"); propertyLock.add(lockWhenReleased, "released");
propertyLock.add(lockAccess, "access"); propertyLock.add(lockAccess, "access");
propertyCanFocus.setDirectCheck(true);
// shaper satatus update: // shaper satatus update:
CheckStatus(); CheckStatus();
// Limit event at 1: // Limit event at 1:
setMouseLimit(1); setMouseLimit(1);
} }
void ewol::widget::Button::init(const std::string& _shaperName) { void ewol::widget::Button::init() {
ewol::widget::Container2::init(); ewol::widget::Container2::init();
propertyCanFocus.set(true); propertyShape.notifyChange();
propertyShape.set(_shaperName);
} }
ewol::widget::Button::~Button() { ewol::widget::Button::~Button() {

View File

@ -53,7 +53,7 @@ namespace ewol {
* @param[in] _shaperName Shaper file properties * @param[in] _shaperName Shaper file properties
*/ */
Button(); Button();
void init(const std::string& _shaperName="{ewol}THEME:GUI:Button.json"); void init();
public: public:
DECLARE_WIDGET_FACTORY(Button, "Button"); DECLARE_WIDGET_FACTORY(Button, "Button");
/** /**

View File

@ -28,19 +28,19 @@
ewol::widget::ButtonColor::ButtonColor() : ewol::widget::ButtonColor::ButtonColor() :
signalChange(this, "change", "Button color change value"), signalChange(this, "change", "Button color change value"),
propertyValue(this, "color", etk::color::black, "Current color", &ewol::widget::ButtonColor::onChangePropertyValue), propertyValue(this, "color", etk::color::black, "Current color", &ewol::widget::ButtonColor::onChangePropertyValue),
propertyShape(this, "shape", "", "shape of the widget", &ewol::widget::ButtonColor::onChangePropertyShape), propertyShape(this, "shape", "{ewol}THEME:GUI:Button.json", "shape of the widget", &ewol::widget::ButtonColor::onChangePropertyShape),
m_widgetContextMenu(nullptr) { m_widgetContextMenu(nullptr) {
addObjectType("ewol::widget::ButtonColor"); addObjectType("ewol::widget::ButtonColor");
changeStatusIn(STATUS_UP); changeStatusIn(STATUS_UP);
// Limit event at 1: // Limit event at 1:
setMouseLimit(1); setMouseLimit(1);
propertyCanFocus.setDirectCheck(true);
} }
void ewol::widget::ButtonColor::init(etk::Color<> _baseColor, std::string _shaperName) { void ewol::widget::ButtonColor::init() {
ewol::Widget::init(); ewol::Widget::init();
propertyCanFocus.set(true); propertyShape.notifyChange();
propertyShape.set(_shaperName); propertyValue.notifyChange();
propertyValue.set(_baseColor);
} }
ewol::widget::ButtonColor::~ButtonColor() { ewol::widget::ButtonColor::~ButtonColor() {

View File

@ -41,7 +41,7 @@ namespace ewol {
* @param[in] _shaperName The new shaper filename. * @param[in] _shaperName The new shaper filename.
*/ */
ButtonColor(); ButtonColor();
void init(etk::Color<> _baseColor=etk::color::black, std::string _shaperName="{ewol}THEME:GUI:Button.json"); void init();
public: public:
DECLARE_WIDGET_FACTORY(ButtonColor, "ButtonColor"); DECLARE_WIDGET_FACTORY(ButtonColor, "ButtonColor");
/** /**

View File

@ -29,7 +29,7 @@ ewol::widget::CheckBox::CheckBox() :
"Basic value of the widget", "Basic value of the widget",
&ewol::widget::CheckBox::onChangePropertyValue), &ewol::widget::CheckBox::onChangePropertyValue),
propertyShape(this, "shape", propertyShape(this, "shape",
"", "{ewol}THEME:GUI:CheckBox.json",
"The display name for config file", "The display name for config file",
&ewol::widget::CheckBox::onChangePropertyShape), &ewol::widget::CheckBox::onChangePropertyShape),
m_mouseHover(false), m_mouseHover(false),
@ -41,17 +41,15 @@ ewol::widget::CheckBox::CheckBox() :
addObjectType("ewol::widget::CheckBox"); addObjectType("ewol::widget::CheckBox");
// shaper satatus update: // shaper satatus update:
CheckStatus(); CheckStatus();
propertyCanFocus.setDirectCheck(true);
// Limit event at 1: // Limit event at 1:
setMouseLimit(1); setMouseLimit(1);
} }
void ewol::widget::CheckBox::init(const std::string& _shaperName) { void ewol::widget::CheckBox::init() {
ewol::widget::Container2::init(); ewol::widget::Container2::init();
propertyCanFocus.set(true); propertyShape.notifyChange();
propertyShape.set(_shaperName);
m_shaperIdSize = m_shaper.requestConfig("box-size");
m_shaperIdSizeInsize = m_shaper.requestConfig("box-inside");
} }
ewol::widget::CheckBox::~CheckBox() { ewol::widget::CheckBox::~CheckBox() {
@ -203,6 +201,8 @@ void ewol::widget::CheckBox::periodicCall(const ewol::event::Time& _event) {
void ewol::widget::CheckBox::onChangePropertyShape() { void ewol::widget::CheckBox::onChangePropertyShape() {
m_shaper.setSource(*propertyShape); m_shaper.setSource(*propertyShape);
m_shaperIdSize = m_shaper.requestConfig("box-size");
m_shaperIdSizeInsize = m_shaper.requestConfig("box-inside");
markToRedraw(); markToRedraw();
} }

View File

@ -43,7 +43,7 @@ namespace ewol {
* @param[in] _shaperName Shaper file properties * @param[in] _shaperName Shaper file properties
*/ */
CheckBox(); CheckBox();
void init(const std::string& _shaperName="{ewol}THEME:GUI:CheckBox.json"); void init();
public: public:
DECLARE_WIDGET_FACTORY(CheckBox, "CheckBox"); DECLARE_WIDGET_FACTORY(CheckBox, "CheckBox");
/** /**

View File

@ -24,14 +24,10 @@ ewol::widget::ColorBar::ColorBar() :
&ewol::widget::ColorBar::onChangePropertyValue) { &ewol::widget::ColorBar::onChangePropertyValue) {
addObjectType("ewol::widget::ColorBar"); addObjectType("ewol::widget::ColorBar");
m_currentUserPos.setValue(0,0); m_currentUserPos.setValue(0,0);
propertyCanFocus.setDirectCheck(true);
setMouseLimit(1); setMouseLimit(1);
} }
void ewol::widget::ColorBar::init() {
ewol::Widget::init();
propertyCanFocus.set(true);
}
ewol::widget::ColorBar::~ColorBar() { ewol::widget::ColorBar::~ColorBar() {
} }

View File

@ -24,7 +24,6 @@ namespace ewol {
eproperty::Value<etk::Color<>> propertyValue; eproperty::Value<etk::Color<>> propertyValue;
protected: protected:
ColorBar(); ColorBar();
void init();
public: public:
DECLARE_WIDGET_FACTORY(ColorBar, "ColorBar"); DECLARE_WIDGET_FACTORY(ColorBar, "ColorBar");
virtual ~ColorBar(); virtual ~ColorBar();

View File

@ -21,28 +21,22 @@ ewol::widget::Composer::Composer() {
// nothing to do ... // nothing to do ...
} }
std::shared_ptr<ewol::Widget> ewol::widget::composerGenerate(enum ewol::widget::Composer::composerMode _mode, const std::string& _data) { static std::shared_ptr<ewol::Widget> composerGenerate(bool _modeFile, const std::string& _data) {
ewol::widget::Manager& widgetManager = ewol::getContext().getWidgetManager(); ewol::widget::Manager& widgetManager = ewol::getContext().getWidgetManager();
if (_data == "") { if (_data == "") {
return nullptr; return nullptr;
} }
std::shared_ptr<exml::Document> doc = exml::Document::create(); std::shared_ptr<exml::Document> doc = exml::Document::create();
switch(_mode) { if (_modeFile == true) {
case ewol::widget::Composer::None: if (doc->load(_data) == false) {
EWOL_ERROR("Not specify the type for compositing dynamic creation"); EWOL_ERROR(" can not load file XML : " << _data);
return nullptr; return nullptr;
case ewol::widget::Composer::String: }
if (doc->parse(_data) == false) { } else {
EWOL_ERROR(" can not load file XML string..."); if (doc->parse(_data) == false) {
return nullptr; EWOL_ERROR(" can not load file XML string...");
} return nullptr;
break; }
case ewol::widget::Composer::file:
if (doc->load(_data) == false) {
EWOL_ERROR(" can not load file XML : " << _data);
return nullptr;
}
break;
} }
std::shared_ptr<const exml::Element> root = doc->toElement(); std::shared_ptr<const exml::Element> root = doc->toElement();
if (root->size() == 0) { if (root->size() == 0) {
@ -74,20 +68,12 @@ std::shared_ptr<ewol::Widget> ewol::widget::composerGenerate(enum ewol::widget::
return tmpWidget; return tmpWidget;
} }
std::shared_ptr<ewol::Widget> ewol::widget::composerGenerateFile(const std::string& _data) {
return composerGenerate(true, _data);
}
void ewol::widget::Composer::init(enum composerMode _mode, const std::string& _fileName) { std::shared_ptr<ewol::Widget> ewol::widget::composerGenerateString(const std::string& _data) {
ewol::widget::Container::init(); return composerGenerate(false, _data);
switch(_mode) {
case ewol::widget::Composer::None:
// nothing to do ...
break;
case ewol::widget::Composer::String:
loadFromString(_fileName);
break;
case ewol::widget::Composer::file:
loadFromFile(_fileName);
break;
}
} }
ewol::widget::Composer::~Composer() { ewol::widget::Composer::~Composer() {

View File

@ -18,23 +18,11 @@ namespace ewol {
* @brief the composer widget is a widget that create a link on a string.file to parse the data and generate some widget tree * @brief the composer widget is a widget that create a link on a string.file to parse the data and generate some widget tree
*/ */
class Composer : public ewol::widget::Container { class Composer : public ewol::widget::Container {
public:
enum composerMode {
None,
String,
file
};
protected: protected:
/** /**
* @brief Constructor * @brief Constructor
*/ */
Composer(); Composer();
/**
* @brief Constructor
* @param[in] _mode mode of parsing the string
* @param[in] _data file/directString data to generate compositing of the widget..
*/
void init(enum ewol::widget::Composer::composerMode _mode = ewol::widget::Composer::None, const std::string& _data = "");
public: public:
DECLARE_WIDGET_FACTORY(Composer, "Composer"); DECLARE_WIDGET_FACTORY(Composer, "Composer");
/** /**
@ -56,6 +44,7 @@ namespace ewol {
*/ */
bool loadFromString(const std::string& _composerXmlString); bool loadFromString(const std::string& _composerXmlString);
}; };
std::shared_ptr<ewol::Widget> composerGenerate(enum ewol::widget::Composer::composerMode _mode = ewol::widget::Composer::None, const std::string& _data = ""); std::shared_ptr<ewol::Widget> composerGenerateString(const std::string& _data = "");
std::shared_ptr<ewol::Widget> composerGenerateFile(const std::string& _data = "");
}; };
}; };

View File

@ -21,12 +21,6 @@ ewol::widget::Container::Container() {
// nothing to do ... // nothing to do ...
} }
void ewol::widget::Container::init(std::shared_ptr<ewol::Widget> _subElement) {
ewol::Widget::init();
m_subWidget = _subElement;
}
ewol::widget::Container::~Container() { ewol::widget::Container::~Container() {
subWidgetRemove(); subWidgetRemove();
} }

View File

@ -25,7 +25,6 @@ namespace ewol {
* @brief Constructor * @brief Constructor
*/ */
Container(); Container();
void init(std::shared_ptr<ewol::Widget> _subElement=nullptr);
public: public:
/** /**
* @brief Destructor * @brief Destructor

View File

@ -19,13 +19,6 @@
ewol::widget::Container2::Container2() : ewol::widget::Container2::Container2() :
m_idWidgetDisplayed(0) { m_idWidgetDisplayed(0) {
addObjectType("ewol::widget::Container2"); addObjectType("ewol::widget::Container2");
// nothing to do ...
}
void ewol::widget::Container2::init(std::shared_ptr<ewol::Widget> _subElement, std::shared_ptr<ewol::Widget> _subElementToggle) {
ewol::Widget::init();
m_subWidget[0] = _subElement;
m_subWidget[1] = _subElementToggle;
} }
ewol::widget::Container2::~Container2() { ewol::widget::Container2::~Container2() {

View File

@ -29,7 +29,6 @@ namespace ewol {
* @param[in] _subElementToggle Widget to set on the toggle position * @param[in] _subElementToggle Widget to set on the toggle position
*/ */
Container2(); Container2();
void init(std::shared_ptr<ewol::Widget> _subElement = nullptr, std::shared_ptr<ewol::Widget> _subElementToggle = nullptr);
public: public:
/** /**
* @brief Destructor * @brief Destructor

View File

@ -25,14 +25,6 @@ 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() {
ewol::Widget::init();
}
ewol::widget::ContainerN::~ContainerN() { ewol::widget::ContainerN::~ContainerN() {
subWidgetRemoveAll(); subWidgetRemoveAll();
} }

View File

@ -28,8 +28,6 @@ namespace ewol {
* @brief Constructor * @brief Constructor
*/ */
ContainerN(); ContainerN();
void init();
void init(const std::unordered_map<std::string,eproperty::Variant>& _listProperty);
public: public:
/** /**
* @brief Destructor * @brief Destructor

View File

@ -19,7 +19,7 @@
ewol::widget::ContextMenu::ContextMenu(): ewol::widget::ContextMenu::ContextMenu():
propertyShape(this, "shape", propertyShape(this, "shape",
"", "{ewol}THEME:GUI:ContextMenu.json",
"the display name for config file", "the display name for config file",
&ewol::widget::ContextMenu::onChangePropertyShape), &ewol::widget::ContextMenu::onChangePropertyShape),
propertyArrowPos(this, "arrow-position", propertyArrowPos(this, "arrow-position",
@ -47,10 +47,9 @@ ewol::widget::ContextMenu::ContextMenu():
setMouseLimit(1); setMouseLimit(1);
} }
void ewol::widget::ContextMenu::init(const std::string& _shaperName) { void ewol::widget::ContextMenu::init() {
ewol::widget::Container::init(); ewol::widget::Container::init();
propertyShape.set(_shaperName); propertyShape.notifyChange();
propertyExpand.set(bvec2(false,false));
} }
ewol::widget::ContextMenu::~ContextMenu() { ewol::widget::ContextMenu::~ContextMenu() {

View File

@ -35,7 +35,7 @@ namespace ewol {
eproperty::List<enum markPosition> propertyArrawBorder; eproperty::List<enum markPosition> propertyArrawBorder;
protected: protected:
ContextMenu(); ContextMenu();
void init(const std::string& _shaperName="{ewol}THEME:GUI:ContextMenu.json"); void init();
public: public:
DECLARE_WIDGET_FACTORY(ContextMenu, "ContextMenu"); DECLARE_WIDGET_FACTORY(ContextMenu, "ContextMenu");
virtual ~ContextMenu(); virtual ~ContextMenu();

View File

@ -25,10 +25,10 @@ ewol::widget::Entry::Entry() :
signalClick(this, "click", "the user Click on the Entry box"), signalClick(this, "click", "the user Click on the Entry box"),
signalEnter(this, "enter", "The cursor enter inside the button"), signalEnter(this, "enter", "The cursor enter inside the button"),
signalModify(this, "modify", "Entry box value change"), signalModify(this, "modify", "Entry box value change"),
propertyShaper(this, "shaper", propertyShape(this, "shape",
"", "{ewol}THEME:GUI:Entry.json",
"Shaper to display the background", "Shaper to display the background",
&ewol::widget::Entry::onChangePropertyShaper), &ewol::widget::Entry::onChangePropertyShaper),
propertyValue(this, "value", propertyValue(this, "value",
"", "",
"Value display in the entry (decorated text)", "Value display in the entry (decorated text)",
@ -51,13 +51,12 @@ ewol::widget::Entry::Entry() :
m_displayCursorPos(0), m_displayCursorPos(0),
m_displayCursorPosSelection(0) { m_displayCursorPosSelection(0) {
addObjectType("ewol::widget::Entry"); addObjectType("ewol::widget::Entry");
propertyCanFocus.setDirectCheck(true);
} }
void ewol::widget::Entry::init(const std::string& _newData, const std::string& _shaperName) { void ewol::widget::Entry::init() {
ewol::Widget::init(); ewol::Widget::init();
propertyValue.set(_newData); propertyShape.notifyChange();
propertyShaper.set(_shaperName);
propertyCanFocus.set(true);
try { try {
m_regex.assign(".*", std::regex_constants::optimize | std::regex_constants::ECMAScript); m_regex.assign(".*", std::regex_constants::optimize | std::regex_constants::ECMAScript);
@ -557,7 +556,7 @@ void ewol::widget::Entry::periodicCall(const ewol::event::Time& _event) {
} }
void ewol::widget::Entry::onChangePropertyShaper() { void ewol::widget::Entry::onChangePropertyShaper() {
m_shaper.setSource(propertyShaper.get()); m_shaper.setSource(propertyShape.get());
m_colorIdTextFg = m_shaper.requestColor("text-foreground"); m_colorIdTextFg = m_shaper.requestColor("text-foreground");
m_colorIdTextBg = m_shaper.requestColor("text-background"); m_colorIdTextBg = m_shaper.requestColor("text-background");
m_colorIdCursor = m_shaper.requestColor("text-cursor"); m_colorIdCursor = m_shaper.requestColor("text-cursor");

View File

@ -36,7 +36,7 @@ namespace ewol {
esignal::ISignal<std::string> signalEnter; //!< Enter key is pressed esignal::ISignal<std::string> signalEnter; //!< Enter key is pressed
esignal::ISignal<std::string> signalModify; //!< data change esignal::ISignal<std::string> signalModify; //!< data change
public: // propertie list public: // propertie list
eproperty::Value<std::string> propertyShaper; eproperty::Value<std::string> propertyShape;
eproperty::Value<std::string> propertyValue; //!< string that must be displayed eproperty::Value<std::string> propertyValue; //!< string that must be displayed
eproperty::Range<int32_t> propertyMaxCharacter; //!< number max of xharacter in the list eproperty::Range<int32_t> propertyMaxCharacter; //!< number max of xharacter in the list
eproperty::Value<std::string> propertyRegex; //!< regular expression value eproperty::Value<std::string> propertyRegex; //!< regular expression value
@ -54,8 +54,7 @@ namespace ewol {
* @param[in] _newData The USting that might be set in the Entry box (no event generation!!) * @param[in] _newData The USting that might be set in the Entry box (no event generation!!)
*/ */
Entry(); Entry();
void init(const std::string& _newData = "", void init();
const std::string& _shaperName="{ewol}THEME:GUI:Entry.json");
public: public:
DECLARE_WIDGET_FACTORY(Entry, "Entry"); DECLARE_WIDGET_FACTORY(Entry, "Entry");
/** /**

View File

@ -22,11 +22,6 @@ ewol::widget::Gird::Gird() :
addObjectType("ewol::widget::Gird"); addObjectType("ewol::widget::Gird");
requestUpdateSize(); requestUpdateSize();
} }
void ewol::widget::Gird::init(int32_t _colNumber) {
ewol::Widget::init();
setColNumber(_colNumber);
}
ewol::widget::Gird::~Gird() { ewol::widget::Gird::~Gird() {
EWOL_DEBUG("[" << getId() << "]={" << getObjectType() << "} Gird : destroy"); EWOL_DEBUG("[" << getId() << "]={" << getObjectType() << "} Gird : destroy");

View File

@ -37,7 +37,6 @@ namespace ewol {
* @brief Constructor * @brief Constructor
*/ */
Gird(); Gird();
void init(int32_t _colNumber=1);
public: public:
DECLARE_WIDGET_FACTORY(Gird, "Gird"); DECLARE_WIDGET_FACTORY(Gird, "Gird");
/** /**

View File

@ -35,12 +35,6 @@ ewol::widget::Image::Image() :
} }
} }
void ewol::widget::Image::init(const std::string& _file, const gale::Dimension& _border) {
ewol::Widget::init();
set(_file, _border);
}
ewol::widget::Image::~Image() { ewol::widget::Image::~Image() {
} }

View File

@ -41,8 +41,6 @@ namespace ewol {
* @brief * @brief
*/ */
Image(); Image();
void init(const std::string& _file="",
const gale::Dimension& _border=gale::Dimension(vec2(0,0),gale::Dimension::Millimeter));
public: public:
DECLARE_WIDGET_FACTORY(Image, "Image"); DECLARE_WIDGET_FACTORY(Image, "Image");
/** /**

View File

@ -43,14 +43,9 @@ ewol::widget::Joystick::Joystick() :
m_background = l_background; m_background = l_background;
m_foreground = l_foreground; m_foreground = l_foreground;
m_ratio = l_ratio; m_ratio = l_ratio;
propertyCanFocus.setDirectCheck(true);
} }
void ewol::widget::Joystick::init() {
ewol::Widget::init();
propertyCanFocus.set(true);
}
ewol::widget::Joystick::~Joystick() { ewol::widget::Joystick::~Joystick() {
} }

View File

@ -47,7 +47,6 @@ namespace ewol {
float m_ratio; float m_ratio;
protected: protected:
Joystick(); Joystick();
void init();
public: public:
DECLARE_WIDGET_FACTORY(Joystick, "Joystick"); DECLARE_WIDGET_FACTORY(Joystick, "Joystick");
virtual ~Joystick(); virtual ~Joystick();

View File

@ -33,12 +33,7 @@ ewol::widget::Label::Label() :
m_colorDefaultBgText = m_colorProperty->request("background"); m_colorDefaultBgText = m_colorProperty->request("background");
} }
setMouseLimit(1); setMouseLimit(1);
} propertyCanFocus.setDirectCheck(false);
void ewol::widget::Label::init(std::string _newLabel) {
ewol::Widget::init();
propertyCanFocus.set(false);
propertyValue.set(_newLabel);
} }
ewol::widget::Label::~Label() { ewol::widget::Label::~Label() {

View File

@ -37,7 +37,6 @@ namespace ewol {
* @param[in] _newLabel The displayed decorated text. * @param[in] _newLabel The displayed decorated text.
*/ */
Label(); Label();
void init(std::string _newLabel="---");
public: public:
DECLARE_WIDGET_FACTORY(Label, "Label"); DECLARE_WIDGET_FACTORY(Label, "Label");
/** /**

View File

@ -17,10 +17,6 @@ ewol::widget::Layer::Layer() {
addObjectType("ewol::widget::Layer"); addObjectType("ewol::widget::Layer");
} }
void ewol::widget::Layer::init() {
ewol::widget::ContainerN::init();
}
ewol::widget::Layer::~Layer() { ewol::widget::Layer::~Layer() {
EWOL_DEBUG("[" << getId() << "] Layer : destroy"); EWOL_DEBUG("[" << getId() << "] Layer : destroy");
} }

View File

@ -23,7 +23,6 @@ namespace ewol {
* @brief Constructor * @brief Constructor
*/ */
Layer(); Layer();
void init();
public: public:
DECLARE_WIDGET_FACTORY(Layer, "Layer"); DECLARE_WIDGET_FACTORY(Layer, "Layer");
/** /**

View File

@ -25,11 +25,7 @@ ewol::widget::List::List() {
m_paddingSizeY = 2; m_paddingSizeY = 2;
#endif #endif
m_nbVisibleRaw = 0; m_nbVisibleRaw = 0;
} propertyCanFocus.setDirectCheck(true);
void ewol::widget::List::init() {
ewol::widget::WidgetScrolled::init();
propertyCanFocus.set(true);
} }
ewol::widget::List::~List() { ewol::widget::List::~List() {

View File

@ -21,7 +21,6 @@ namespace ewol {
class List : public ewol::widget::WidgetScrolled { class List : public ewol::widget::WidgetScrolled {
protected: protected:
List(); List();
void init();
public: public:
virtual ~List(); virtual ~List();
virtual void calculateMinMaxSize(); virtual void calculateMinMaxSize();

View File

@ -57,11 +57,6 @@ ewol::widget::ListFileSystem::ListFileSystem() :
setMouseLimit(1); setMouseLimit(1);
} }
void ewol::widget::ListFileSystem::init() {
ewol::widget::List::init();
}
ewol::widget::ListFileSystem::~ListFileSystem() { ewol::widget::ListFileSystem::~ListFileSystem() {
clearList(); clearList();
} }

View File

@ -32,7 +32,6 @@ namespace ewol {
eproperty::Value<std::string> propertyFilter; //!< Regular expression to filter the view (for temporary file:".*(~|.bck|.pyc)\e") eproperty::Value<std::string> propertyFilter; //!< Regular expression to filter the view (for temporary file:".*(~|.bck|.pyc)\e")
protected: protected:
ListFileSystem(); ListFileSystem();
void init();
public: public:
DECLARE_WIDGET_FACTORY(ListFileSystem, "ListFileSystem"); DECLARE_WIDGET_FACTORY(ListFileSystem, "ListFileSystem");
virtual ~ListFileSystem(); virtual ~ListFileSystem();

View File

@ -24,10 +24,6 @@ ewol::widget::Menu::Menu() :
m_staticId = 666; m_staticId = 666;
} }
void ewol::widget::Menu::init() {
ewol::widget::Sizer::init();
}
ewol::widget::Menu::~Menu() { ewol::widget::Menu::~Menu() {
clear(); clear();
} }
@ -101,9 +97,9 @@ int32_t ewol::widget::Menu::add(int32_t _parent,
} }
composeString+=" <label><left>" + tmpObject.m_label + "</left></label>\n"; composeString+=" <label><left>" + tmpObject.m_label + "</left></label>\n";
composeString+="</sizer>\n"; composeString+="</sizer>\n";
myButton->setSubWidget(ewol::widget::Composer::create(widget::Composer::String, composeString)); myButton->setSubWidget(ewol::widget::composerGenerateString(composeString));
} else { } else {
myButton->setSubWidget(ewol::widget::Label::create("<left>" + tmpObject.m_label + "</left>") ); myButton->setSubWidget(ewol::widget::Label::create("value", "<left>" + tmpObject.m_label + "</left>") );
} }
// add it in the widget list // add it in the widget list
ewol::widget::Sizer::subWidgetAdd(myButton); ewol::widget::Sizer::subWidgetAdd(myButton);
@ -178,7 +174,7 @@ void ewol::widget::Menu::onButtonPressed(std::weak_ptr<ewol::widget::Button> _bu
tmpContext->setPositionMark(ewol::widget::ContextMenu::markTop, newPosition); tmpContext->setPositionMark(ewol::widget::ContextMenu::markTop, newPosition);
std::shared_ptr<ewol::widget::Sizer> mySizer; std::shared_ptr<ewol::widget::Sizer> mySizer;
std::shared_ptr<ewol::widget::Button> myButton; std::shared_ptr<ewol::widget::Button> myButton;
mySizer = ewol::widget::Sizer::create(widget::Sizer::modeVert); mySizer = ewol::widget::Sizer::create("mode", widget::Sizer::modeVert);
if (mySizer != nullptr) { if (mySizer != nullptr) {
mySizer->propertyLockExpand.set(vec2(true,true)); mySizer->propertyLockExpand.set(vec2(true,true));
mySizer->propertyFill.set(vec2(true,true)); mySizer->propertyFill.set(vec2(true,true));
@ -219,10 +215,10 @@ void ewol::widget::Menu::onButtonPressed(std::weak_ptr<ewol::widget::Button> _bu
} }
composeString+=" <label exand='true,true' fill='true,true'><left>" + it2->m_label + "</left></label>\n"; composeString+=" <label exand='true,true' fill='true,true'><left>" + it2->m_label + "</left></label>\n";
composeString+=" </sizer>\n"; composeString+=" </sizer>\n";
myButton->setSubWidget(ewol::widget::composerGenerate(widget::Composer::String, composeString)); myButton->setSubWidget(ewol::widget::composerGenerateString(composeString));
} else { } else {
if (menuHaveImage == true) { if (menuHaveImage == true) {
myButton->setSubWidget(ewol::widget::composerGenerate(widget::Composer::String, myButton->setSubWidget(ewol::widget::composerGenerateString(
std::string() + std::string() +
" <sizer mode='hori' expand='true,false' fill='true,true' lock='true'>\n" " <sizer mode='hori' expand='true,false' fill='true,true' lock='true'>\n"
" <spacer min-size='8,0mm'/>\n" " <spacer min-size='8,0mm'/>\n"
@ -230,8 +226,9 @@ void ewol::widget::Menu::onButtonPressed(std::weak_ptr<ewol::widget::Button> _bu
" </sizer>\n") " </sizer>\n")
); );
} else { } else {
std::shared_ptr<ewol::widget::Label> tmpLabel = widget::Label::create(std::string("<left>") + it2->m_label + "</left>\n"); std::shared_ptr<ewol::widget::Label> tmpLabel = widget::Label::create();
if (tmpLabel != nullptr) { if (tmpLabel != nullptr) {
tmpLabel->propertyValue.set(std::string("<left>") + it2->m_label + "</left>\n");
tmpLabel->propertyExpand.set(bvec2(true,false)); tmpLabel->propertyExpand.set(bvec2(true,false));
tmpLabel->propertyFill.set(bvec2(true,true)); tmpLabel->propertyFill.set(bvec2(true,true));
myButton->setSubWidget(tmpLabel); myButton->setSubWidget(tmpLabel);

View File

@ -35,7 +35,6 @@ namespace ewol {
esignal::ISignal<std::string> signalSelect; // event on a menu button or ... esignal::ISignal<std::string> signalSelect; // event on a menu button or ...
protected: protected:
Menu(); Menu();
void init();
public: public:
DECLARE_WIDGET_FACTORY(Menu, "Menu"); DECLARE_WIDGET_FACTORY(Menu, "Menu");
virtual ~Menu(); virtual ~Menu();

View File

@ -19,7 +19,7 @@ static const char* annimationIncrease = "increase";
ewol::widget::PopUp::PopUp() : ewol::widget::PopUp::PopUp() :
propertyShape(this, "shaper", propertyShape(this, "shaper",
"", "{ewol}THEME:GUI:PopUp.json",
"The shaper properties", "The shaper properties",
&ewol::widget::PopUp::onChangePropertyShape), &ewol::widget::PopUp::onChangePropertyShape),
propertyLockExpand(this, "lock", propertyLockExpand(this, "lock",
@ -34,10 +34,10 @@ ewol::widget::PopUp::PopUp() :
addAnnimationType(ewol::Widget::annimationModeEnableAdd, annimationIncrease); addAnnimationType(ewol::Widget::annimationModeEnableAdd, annimationIncrease);
} }
void ewol::widget::PopUp::init(const std::string& _shaperName) { void ewol::widget::PopUp::init() {
ewol::widget::Container::init(); ewol::widget::Container::init();
propertyFill.set(bvec2(false,false)); propertyFill.set(bvec2(false,false));
propertyShape.set(_shaperName); propertyShape.notifyChange();
propertyMinSize.set(gale::Dimension(vec2(80,80),gale::Dimension::Pourcent)); propertyMinSize.set(gale::Dimension(vec2(80,80),gale::Dimension::Pourcent));
propertyExpand.set(bvec2(false, false)); propertyExpand.set(bvec2(false, false));
} }

View File

@ -31,7 +31,7 @@ namespace ewol {
* @param[in] _shaperName Shaper file properties * @param[in] _shaperName Shaper file properties
*/ */
PopUp(); PopUp();
void init(const std::string& _shaperName="{ewol}THEME:GUI:PopUp.json"); void init();
public: public:
DECLARE_WIDGET_FACTORY(PopUp, "PopUp"); DECLARE_WIDGET_FACTORY(PopUp, "PopUp");
/** /**

View File

@ -20,11 +20,11 @@ ewol::widget::Scroll::Scroll() :
"Limit the scroll maximum position [0..1]% represent the free space in the scoll when arrive at the end", "Limit the scroll maximum position [0..1]% represent the free space in the scoll when arrive at the end",
&ewol::widget::Scroll::onChangePropertyLimit), &ewol::widget::Scroll::onChangePropertyLimit),
propertyShapeVert(this, "shape-vert", propertyShapeVert(this, "shape-vert",
"", "{ewol}THEME:GUI:WidgetScrolled.json",
"shape for the vertical display", "shape for the vertical display",
&ewol::widget::Scroll::onChangePropertyShapeVert), &ewol::widget::Scroll::onChangePropertyShapeVert),
propertyShapeHori(this, "shape-hori", propertyShapeHori(this, "shape-hori",
"", "{ewol}THEME:GUI:WidgetScrolled.json",
"shape for the horizonal display", "shape for the horizonal display",
&ewol::widget::Scroll::onChangePropertyShapeHori), &ewol::widget::Scroll::onChangePropertyShapeHori),
m_pixelScrolling(20), m_pixelScrolling(20),
@ -35,10 +35,10 @@ ewol::widget::Scroll::Scroll() :
addObjectType("ewol::widget::Scroll"); addObjectType("ewol::widget::Scroll");
} }
void ewol::widget::Scroll::init(const std::string& _shaperName) { void ewol::widget::Scroll::init() {
ewol::widget::Container::init(); ewol::widget::Container::init();
propertyShapeVert.set(_shaperName); propertyShapeVert.notifyChange();
propertyShapeHori.set(_shaperName); propertyShapeHori.notifyChange();
} }

View File

@ -41,7 +41,7 @@ namespace ewol {
enum gale::key::type m_highSpeedType; enum gale::key::type m_highSpeedType;
protected: protected:
Scroll(); Scroll();
void init(const std::string& _shaperName="{ewol}THEME:GUI:WidgetScrolled.json"); void init();
public: public:
DECLARE_WIDGET_FACTORY(Scroll, "Scroll"); DECLARE_WIDGET_FACTORY(Scroll, "Scroll");
virtual ~Scroll(); virtual ~Scroll();

View File

@ -34,13 +34,14 @@ ewol::widget::Select::Select() :
"Value of the Select", "Value of the Select",
&ewol::widget::Select::onChangePropertyValue) { &ewol::widget::Select::onChangePropertyValue) {
addObjectType("ewol::widget::Select"); addObjectType("ewol::widget::Select");
} // override the basic parameter:
propertyShape.setDirectCheck("{ewol}THEME:GUI:Select.json");
void ewol::widget::Select::init(const std::string& _shaperName) { propertySpinMode.rename("none-none", "none");
ewol::widget::SpinBase::init(ewol::widget::spinPosition_noneRight, _shaperName); propertySpinMode.rename("none-right", "right");
//m_shaper->setSource(_shaperName); propertySpinMode.rename("left-none", "left");
//m_shaperIdSize = m_shaper->requestConfig("box-size"); propertySpinMode.remove("left-right");
//m_shaperIdSizeInsize = m_shaper->requestConfig("box-inside"); propertySpinMode.remove("left-left");
propertySpinMode.remove("right-right");
} }
ewol::widget::Select::~Select() { ewol::widget::Select::~Select() {
@ -171,26 +172,27 @@ void ewol::widget::Select::onCallbackOpenMenu() {
// auto-select mark position: // auto-select mark position:
tmpContext->setPositionMarkAuto(m_origin, m_size); tmpContext->setPositionMarkAuto(m_origin, m_size);
std::shared_ptr<ewol::widget::Sizer> mySizer; std::shared_ptr<ewol::widget::Sizer> mySizer;
mySizer = ewol::widget::Sizer::create(widget::Sizer::modeVert); mySizer = ewol::widget::Sizer::create();
if (mySizer == nullptr) { if (mySizer == nullptr) {
EWOL_ERROR("Allocation Error or sizer"); EWOL_ERROR("Allocation Error or sizer");
return; return;
} }
mySizer->propertyMode.set(widget::Sizer::modeVert);
mySizer->propertyLockExpand.set(vec2(true,true)); mySizer->propertyLockExpand.set(vec2(true,true));
mySizer->propertyFill.set(vec2(true,true)); mySizer->propertyFill.set(vec2(true,true));
// set it in the pop-up-system: // set it in the pop-up-system:
tmpContext->setSubWidget(mySizer); tmpContext->setSubWidget(mySizer);
for (auto &it : m_listElement) { for (auto &it : m_listElement) {
std::shared_ptr<ewol::widget::Label> myLabel; std::shared_ptr<ewol::widget::Label> myLabel = ewol::widget::Label::create();
if (it.m_selected == true) {
myLabel = ewol::widget::Label::create(std::string("<b>") + it.m_name + "</b>");
} else {
myLabel = ewol::widget::Label::create(it.m_name);
}
if (myLabel == nullptr) { if (myLabel == nullptr) {
EWOL_ERROR("Allocation Error"); EWOL_ERROR("Allocation Error");
continue; continue;
} }
if (it.m_selected == true) {
myLabel->propertyValue.set(std::string("<b>") + it.m_name + "</b>");
} else {
myLabel->propertyValue.set(it.m_name);
}
myLabel->propertyExpand.set(bvec2(true,true)); myLabel->propertyExpand.set(bvec2(true,true));
myLabel->propertyFill.set(bvec2(true,true)); myLabel->propertyFill.set(bvec2(true,true));
// set callback // set callback

View File

@ -28,7 +28,6 @@ namespace ewol {
* @param[in] _shaperName Shaper file properties * @param[in] _shaperName Shaper file properties
*/ */
Select(); Select();
void init(const std::string& _shaperName="{ewol}THEME:GUI:Select.json");
public: public:
DECLARE_WIDGET_FACTORY(Select, "Select"); DECLARE_WIDGET_FACTORY(Select, "Select");
/** /**

View File

@ -38,15 +38,6 @@ 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) {
ewol::widget::ContainerN::init();
propertyMode.set(_mode);
}
ewol::widget::Sizer::~Sizer() { ewol::widget::Sizer::~Sizer() {
//EWOL_DEBUG("[" << getId() << "]={" << getObjectType() << "} sizer : destroy (mode=" << (propertyMode == ewol::widget::Sizer::modeVert?"Vert":"Hori") << ")"); //EWOL_DEBUG("[" << getId() << "]={" << getObjectType() << "} sizer : destroy (mode=" << (propertyMode == ewol::widget::Sizer::modeVert?"Vert":"Hori") << ")");
} }

View File

@ -38,19 +38,12 @@ namespace ewol {
eproperty::Value<gale::Dimension> propertyBorderSize; //!< Border size needed for all the display eproperty::Value<gale::Dimension> propertyBorderSize; //!< Border size needed for all the display
eproperty::List<enum animation> propertyAnimation; //!< Methode add and remove element (animation) eproperty::List<enum animation> propertyAnimation; //!< Methode add and remove element (animation)
eproperty::Value<float> propertyAnimationTime; //!< Time in second to generate animation eproperty::Value<float> propertyAnimationTime; //!< Time in second to generate animation
public:
/**
* @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: protected:
/** /**
* @brief Constructor * @brief Constructor
* @param[in] _mode The mode to display the elements * @param[in] _mode The mode to display the elements
*/ */
Sizer(); Sizer();
void init(enum displayMode _mode=ewol::widget::Sizer::modeHori);
public: public:
DECLARE_WIDGET_FACTORY(Sizer, "Sizer"); DECLARE_WIDGET_FACTORY(Sizer, "Sizer");
/** /**

View File

@ -39,15 +39,12 @@ ewol::widget::Slider::Slider() :
m_textColorBg = etk::color::black; m_textColorBg = etk::color::black;
m_textColorBg.setA(0x3F); m_textColorBg.setA(0x3F);
propertyCanFocus.setDirectCheck(true);
// Limit event at 1: // Limit event at 1:
setMouseLimit(1); setMouseLimit(1);
} }
void ewol::widget::Slider::init() {
ewol::Widget::init();
propertyCanFocus.set(true);
}
ewol::widget::Slider::~Slider() { ewol::widget::Slider::~Slider() {
} }

View File

@ -30,7 +30,6 @@ namespace ewol {
eproperty::Value<float> propertyStep; //!< step of every iteration of the slider (increment/precision) eproperty::Value<float> propertyStep; //!< step of every iteration of the slider (increment/precision)
protected: protected:
Slider(); Slider();
void init();
public: public:
DECLARE_WIDGET_FACTORY(Slider, "Slider"); DECLARE_WIDGET_FACTORY(Slider, "Slider");
virtual ~Slider(); virtual ~Slider();

View File

@ -20,12 +20,8 @@ ewol::widget::Spacer::Spacer() :
"background of the spacer", "background of the spacer",
&ewol::widget::Spacer::onChangePropertyColor) { &ewol::widget::Spacer::onChangePropertyColor) {
addObjectType("ewol::widget::Spacer"); addObjectType("ewol::widget::Spacer");
} propertyMinSize.setDirectCheck(gale::Dimension(vec2(10,10)));
propertyCanFocus.setDirectCheck(true);
void ewol::widget::Spacer::init() {
ewol::Widget::init();
propertyMinSize.set(gale::Dimension(vec2(10,10)));
propertyCanFocus.set(true);
} }
ewol::widget::Spacer::~Spacer() { ewol::widget::Spacer::~Spacer() {

View File

@ -27,7 +27,6 @@ namespace ewol {
* @brief Main constructer * @brief Main constructer
*/ */
Spacer(); Spacer();
void init();
public: public:
DECLARE_WIDGET_FACTORY(Spacer, "Spacer"); DECLARE_WIDGET_FACTORY(Spacer, "Spacer");
/** /**

View File

@ -41,18 +41,7 @@ ewol::widget::Spin::Spin() :
"fix-point mantis", "fix-point mantis",
&ewol::widget::Spin::onChangePropertyMantis) { &ewol::widget::Spin::onChangePropertyMantis) {
addObjectType("ewol::widget::Spin"); addObjectType("ewol::widget::Spin");
} propertyShape.setDirectCheck("{ewol}THEME:GUI:Spin.json");
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]");
ewol::widget::SpinBase::init(_mode, _shaperName);
markToRedraw();
EWOL_WARNING("init [STOP]");
} }
ewol::widget::Spin::~Spin() { ewol::widget::Spin::~Spin() {

View File

@ -35,9 +35,6 @@ namespace ewol {
* @param[in] _shaperName Shaper file properties * @param[in] _shaperName Shaper file properties
*/ */
Spin(); 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: public:
DECLARE_WIDGET_FACTORY(Spin, "Spin"); DECLARE_WIDGET_FACTORY(Spin, "Spin");
/** /**

View File

@ -34,9 +34,6 @@ namespace ewol {
eproperty::Value<std::string> propertySelectWidget; //!< current select configuration eproperty::Value<std::string> propertySelectWidget; //!< current select configuration
protected: protected:
WSlider(); WSlider();
void init() {
ewol::widget::ContainerN::init();
};
public: public:
DECLARE_WIDGET_FACTORY(WSlider, "WSlider"); DECLARE_WIDGET_FACTORY(WSlider, "WSlider");
virtual ~WSlider(); virtual ~WSlider();

View File

@ -85,17 +85,6 @@ ewol::Widget::Widget() :
propertyAnnimationTypeStop.add(0, "none"); propertyAnnimationTypeStop.add(0, "none");
} }
void ewol::Widget::init() {
ewol::Object::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() { ewol::Widget::~Widget() {
// clean all the short-cut ... // clean all the short-cut ...
shortCutClean(); shortCutClean();

View File

@ -39,7 +39,9 @@ namespace ewol {
#define DECLARE_WIDGET_FACTORY(className, name) \ #define DECLARE_WIDGET_FACTORY(className, name) \
DECLARE_FACTORY(className); \ DECLARE_FACTORY(className); \
static void createManagerWidget(ewol::widget::Manager& _widgetManager) { \ static void createManagerWidget(ewol::widget::Manager& _widgetManager) { \
_widgetManager.addWidgetCreator(name,[]() -> std::shared_ptr<ewol::Widget> { return className::create(); }); \ _widgetManager.addWidgetCreator(name, []() -> std::shared_ptr<ewol::Widget> { \
return className::create(); \
}); \
} }
namespace ewol { namespace ewol {
@ -85,10 +87,6 @@ namespace ewol {
* @return (no execption generated (not managed in embended platform)) * @return (no execption generated (not managed in embended platform))
*/ */
Widget(); Widget();
void init();
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

View File

@ -15,11 +15,11 @@
ewol::widget::WidgetScrolled::WidgetScrolled() : ewol::widget::WidgetScrolled::WidgetScrolled() :
propertyShapeVert(this, "shape-vert", propertyShapeVert(this, "shape-vert",
"", "{ewol}THEME:GUI:WidgetScrolled.json",
"shape for the vertical display", "shape for the vertical display",
&ewol::widget::WidgetScrolled::onChangePropertyShapeVert), &ewol::widget::WidgetScrolled::onChangePropertyShapeVert),
propertyShapeHori(this, "shape-hori", propertyShapeHori(this, "shape-hori",
"", "{ewol}THEME:GUI:WidgetScrolled.json",
"shape for the horizonal display", "shape for the horizonal display",
&ewol::widget::WidgetScrolled::onChangePropertyShapeHori), &ewol::widget::WidgetScrolled::onChangePropertyShapeHori),
m_shaperH(), m_shaperH(),
@ -40,10 +40,10 @@ ewol::widget::WidgetScrolled::WidgetScrolled() :
} }
} }
void ewol::widget::WidgetScrolled::init(const std::string& _shaperName) { void ewol::widget::WidgetScrolled::init() {
ewol::Widget::init(); ewol::Widget::init();
propertyShapeVert.set(_shaperName); propertyShapeVert.notifyChange();
propertyShapeHori.set(_shaperName); propertyShapeHori.notifyChange();
} }
ewol::widget::WidgetScrolled::~WidgetScrolled() { ewol::widget::WidgetScrolled::~WidgetScrolled() {

View File

@ -71,7 +71,7 @@ namespace ewol {
* @param[in] _shaperName Shaper name if the scrolled widget. * @param[in] _shaperName Shaper name if the scrolled widget.
*/ */
WidgetScrolled(); WidgetScrolled();
void init(const std::string& _shaperName="{ewol}THEME:GUI:WidgetScrolled.json"); void init();
public: public:
DECLARE_WIDGET_FACTORY(WidgetScrolled, "WidgetScrolled"); DECLARE_WIDGET_FACTORY(WidgetScrolled, "WidgetScrolled");
/** /**

View File

@ -32,14 +32,10 @@ ewol::widget::Windows::Windows() :
if (m_colorProperty != nullptr) { if (m_colorProperty != nullptr) {
m_colorBg = m_colorProperty->request("background"); m_colorBg = m_colorProperty->request("background");
} }
propertyCanFocus.setDirectCheck(true);
//KeyboardShow(KEYBOARD_MODE_CODE); //KeyboardShow(KEYBOARD_MODE_CODE);
} }
void ewol::widget::Windows::init() {
ewol::Widget::init();
propertyCanFocus.set(true);
}
ewol::widget::Windows::~Windows() { ewol::widget::Windows::~Windows() {
m_subWidget.reset(); m_subWidget.reset();
m_popUpWidgetList.clear(); m_popUpWidgetList.clear();

View File

@ -25,7 +25,6 @@ namespace ewol {
int32_t m_colorBg; //!< Default background color of the windows int32_t m_colorBg; //!< Default background color of the windows
protected: protected:
Windows(); Windows();
void init();
public: public:
virtual ~Windows(); virtual ~Windows();
// internal event at ewol system : // internal event at ewol system :

View File

@ -32,7 +32,8 @@ ewol::widget::ColorChooser::ColorChooser() :
} }
void ewol::widget::ColorChooser::init() { void ewol::widget::ColorChooser::init() {
ewol::widget::Sizer::init(ewol::widget::Sizer::modeVert); ewol::widget::Sizer::init();
propertyMode.set(ewol::widget::Sizer::modeVert);
propertyLockExpand.set(bvec2(true,true)); propertyLockExpand.set(bvec2(true,true));
m_widgetColorBar = ewol::widget::ColorBar::create(); m_widgetColorBar = ewol::widget::ColorBar::create();
m_widgetColorBar->signalChange.connect(shared_from_this(), &ewol::widget::ColorChooser::onCallbackColorChange); m_widgetColorBar->signalChange.connect(shared_from_this(), &ewol::widget::ColorChooser::onCallbackColorChange);

View File

@ -45,20 +45,22 @@ void ewol::widget::Parameter::init() {
propertyMinSize.set(gale::Dimension(vec2(80, 80), gale::Dimension::Pourcent)); propertyMinSize.set(gale::Dimension(vec2(80, 80), gale::Dimension::Pourcent));
#endif #endif
mySizerVert = ewol::widget::Sizer::create(widget::Sizer::modeVert); mySizerVert = ewol::widget::Sizer::create();
if (mySizerVert == nullptr) { if (mySizerVert == nullptr) {
EWOL_ERROR("Can not allocate widget == > display might be in error"); EWOL_ERROR("Can not allocate widget == > display might be in error");
} else { } else {
EWOL_INFO("add widget"); EWOL_INFO("add widget");
mySizerVert->propertyMode.set(widget::Sizer::modeVert);
mySizerVert->propertyLockExpand.set(bvec2(true,true)); mySizerVert->propertyLockExpand.set(bvec2(true,true));
mySizerVert->propertyExpand.set(bvec2(true,true)); mySizerVert->propertyExpand.set(bvec2(true,true));
// set it in the pop-up-system : // set it in the pop-up-system :
setSubWidget(mySizerVert); setSubWidget(mySizerVert);
mySizerHori = ewol::widget::Sizer::create(widget::Sizer::modeHori); mySizerHori = ewol::widget::Sizer::create();
if (mySizerHori == nullptr) { if (mySizerHori == nullptr) {
EWOL_ERROR("Can not allocate widget == > display might be in error"); EWOL_ERROR("Can not allocate widget == > display might be in error");
} else { } else {
mySizerHori->propertyMode.set(widget::Sizer::modeHori);
mySizerVert->subWidgetAdd(mySizerHori); mySizerVert->subWidgetAdd(mySizerHori);
mySpacer = ewol::widget::Spacer::create(); mySpacer = ewol::widget::Spacer::create();
@ -73,13 +75,11 @@ void ewol::widget::Parameter::init() {
if (tmpButton == nullptr) { if (tmpButton == nullptr) {
EWOL_ERROR("Can not allocate widget == > display might be in error"); EWOL_ERROR("Can not allocate widget == > display might be in error");
} else { } else {
tmpButton->setSubWidget(ewol::widget::Composer::create(widget::Composer::String, tmpButton->setSubWidget(ewol::widget::composerGenerateString(
"<composer>\n" "<sizer mode=\"hori\">\n"
" <sizer mode=\"hori\">\n" " <image src=\"{ewol}THEME:GUI:Save.svg\" expand=\"true\" size=\"8,8mm\"/>\n"
" <image src=\"{ewol}THEME:GUI:Save.svg\" expand=\"true\" size=\"8,8mm\"/>\n" " <label>Save</label>\n"
" <label>Save</label>\n" "</sizer>\n"));
" </sizer>\n"
"</composer>\n"));
tmpButton->signalPressed.connect(shared_from_this(), &ewol::widget::Parameter::onCallbackParameterSave); tmpButton->signalPressed.connect(shared_from_this(), &ewol::widget::Parameter::onCallbackParameterSave);
mySizerHori->subWidgetAdd(tmpButton); mySizerHori->subWidgetAdd(tmpButton);
} }
@ -97,22 +97,21 @@ void ewol::widget::Parameter::init() {
if (tmpButton == nullptr) { if (tmpButton == nullptr) {
EWOL_ERROR("Can not allocate widget == > display might be in error"); EWOL_ERROR("Can not allocate widget == > display might be in error");
} else { } else {
tmpButton->setSubWidget(ewol::widget::Composer::create(widget::Composer::String, tmpButton->setSubWidget(ewol::widget::composerGenerateString(
"<composer>\n" "<sizer mode=\"hori\">\n"
" <sizer mode=\"hori\">\n" " <image src=\"{ewol}THEME:GUI:Remove.svg\" expand=\"true\" size=\"8,8mm\"/>\n"
" <image src=\"{ewol}THEME:GUI:Remove.svg\" expand=\"true\" size=\"8,8mm\"/>\n" " <label>Close</label>\n"
" <label>Close</label>\n" "</sizer>\n"));
" </sizer>\n"
"</composer>\n"));
tmpButton->signalPressed.connect(shared_from_this(), &ewol::widget::Parameter::onCallbackMenuclosed); tmpButton->signalPressed.connect(shared_from_this(), &ewol::widget::Parameter::onCallbackMenuclosed);
mySizerHori->subWidgetAdd(tmpButton); mySizerHori->subWidgetAdd(tmpButton);
} }
} }
mySizerHori = ewol::widget::Sizer::create(widget::Sizer::modeHori); mySizerHori = ewol::widget::Sizer::create();
if (mySizerHori == nullptr) { if (mySizerHori == nullptr) {
EWOL_ERROR("Can not allocate widget == > display might be in error"); EWOL_ERROR("Can not allocate widget == > display might be in error");
} else { } else {
mySizerHori->propertyMode.set(widget::Sizer::modeHori);
mySizerVert->subWidgetAdd(mySizerHori); mySizerVert->subWidgetAdd(mySizerHori);
m_paramList = ewol::widget::ParameterList::create(); m_paramList = ewol::widget::ParameterList::create();
@ -135,10 +134,11 @@ void ewol::widget::Parameter::init() {
mySizerHori->subWidgetAdd(mySpacer); mySizerHori->subWidgetAdd(mySpacer);
} }
std::shared_ptr<ewol::widget::Sizer> mySizerVert2 = widget::Sizer::create(widget::Sizer::modeVert); std::shared_ptr<ewol::widget::Sizer> mySizerVert2 = widget::Sizer::create();
if (mySizerVert2 == nullptr) { if (mySizerVert2 == nullptr) {
EWOL_ERROR("Can not allocate widget == > display might be in error"); EWOL_ERROR("Can not allocate widget == > display might be in error");
} else { } else {
mySizerVert2->propertyMode.set(widget::Sizer::modeVert);
mySizerHori->subWidgetAdd(mySizerVert2); mySizerHori->subWidgetAdd(mySizerVert2);
mySpacer = ewol::widget::Spacer::create(); mySpacer = ewol::widget::Spacer::create();
@ -173,10 +173,11 @@ void ewol::widget::Parameter::init() {
mySizerVert->subWidgetAdd(mySpacer); mySizerVert->subWidgetAdd(mySpacer);
} }
m_widgetTitle = ewol::widget::Label::create(TRANSLATE(propertyLabelTitle)); m_widgetTitle = ewol::widget::Label::create();
if (m_widgetTitle == nullptr) { if (m_widgetTitle == nullptr) {
EWOL_ERROR("Can not allocate widget == > display might be in error"); EWOL_ERROR("Can not allocate widget == > display might be in error");
} else { } else {
m_widgetTitle->propertyValue.set(TRANSLATE(propertyLabelTitle));
m_widgetTitle->propertyExpand.set(bvec2(true,false)); m_widgetTitle->propertyExpand.set(bvec2(true,false));
mySizerVert->subWidgetAdd(m_widgetTitle); mySizerVert->subWidgetAdd(m_widgetTitle);
} }
@ -219,10 +220,11 @@ void ewol::widget::Parameter::menuAdd(std::string _label, std::string _image, st
m_wSlider->subWidgetAdd(_associateWidget); m_wSlider->subWidgetAdd(_associateWidget);
} else { } else {
EWOL_DEBUG("Associate an empty widget on it ..."); EWOL_DEBUG("Associate an empty widget on it ...");
std::shared_ptr<ewol::widget::Label> myLabel = widget::Label::create(std::string("No widget for : ") + _label); std::shared_ptr<ewol::widget::Label> myLabel = widget::Label::create();
if (nullptr == myLabel) { if (nullptr == myLabel) {
EWOL_ERROR("Can not allocate widget == > display might be in error"); EWOL_ERROR("Can not allocate widget == > display might be in error");
} else { } else {
myLabel->propertyValue.set(std::string("No widget for : ") + _label);
myLabel->propertyExpand.set(bvec2(true,true)); myLabel->propertyExpand.set(bvec2(true,true));
m_wSlider->subWidgetAdd(myLabel); m_wSlider->subWidgetAdd(myLabel);
} }

View File

@ -36,6 +36,7 @@ void ewol::widget::ParameterList::init() {
ewol::widget::WidgetScrolled::init(); ewol::widget::WidgetScrolled::init();
propertyCanFocus.set(true); propertyCanFocus.set(true);
} }
ewol::widget::ParameterList::~ParameterList() { ewol::widget::ParameterList::~ParameterList() {
//clean all the object //clean all the object
for (size_t iii=0; iii<m_listOObject.size(); iii++) { for (size_t iii=0; iii<m_listOObject.size(); iii++) {

View File

@ -14,16 +14,13 @@
#undef __class__ #undef __class__
#define __class__ "widget::SpinBase" #define __class__ "widget::SpinBase"
void ewol::widget::SpinBase::init(ewol::widget::Manager& _widgetManager) {
}
ewol::widget::SpinBase::SpinBase() : ewol::widget::SpinBase::SpinBase() :
propertyShape(this, "shape", propertyShape(this, "shape",
"", "",
"shape for the display", "shape for the display",
&ewol::widget::SpinBase::onChangePropertyShape), &ewol::widget::SpinBase::onChangePropertyShape),
propertySpinMode(this, "mode", propertySpinMode(this, "spin-mode",
ewol::widget::spinPosition_RightRight, ewol::widget::spinPosition_RightRight,
"The display spin mode", "The display spin mode",
&ewol::widget::SpinBase::onChangePropertySpinMode), &ewol::widget::SpinBase::onChangePropertySpinMode),
@ -32,6 +29,7 @@ ewol::widget::SpinBase::SpinBase() :
m_confIdDownShaper(-1), m_confIdDownShaper(-1),
m_confIdUpData(-1), m_confIdUpData(-1),
m_confIdDownData(-1) { m_confIdDownData(-1) {
addObjectType("ewol::widget::SpinBase"); addObjectType("ewol::widget::SpinBase");
propertySpinMode.add(ewol::widget::spinPosition_noneNone, "none-none"); propertySpinMode.add(ewol::widget::spinPosition_noneNone, "none-none");
propertySpinMode.add(ewol::widget::spinPosition_noneRight, "none-right"); propertySpinMode.add(ewol::widget::spinPosition_noneRight, "none-right");
@ -39,20 +37,13 @@ ewol::widget::SpinBase::SpinBase() :
propertySpinMode.add(ewol::widget::spinPosition_leftRight, "left-right"); propertySpinMode.add(ewol::widget::spinPosition_leftRight, "left-right");
propertySpinMode.add(ewol::widget::spinPosition_leftLeft, "left-left"); propertySpinMode.add(ewol::widget::spinPosition_leftLeft, "left-left");
propertySpinMode.add(ewol::widget::spinPosition_RightRight, "right-right"); propertySpinMode.add(ewol::widget::spinPosition_RightRight, "right-right");
propertyLockExpand.setDirectCheck(bvec2(true,true));
propertyGravity.setDirectCheck(gravity_center);
} }
void ewol::widget::SpinBase::init(const std::unordered_map<std::string,eproperty::Variant>& _listProperty) { void ewol::widget::SpinBase::init() {
ewol::widget::Sizer::init(_listProperty); ewol::widget::Sizer::init();
propertyShape.notifyChange();
}
void ewol::widget::SpinBase::init(enum ewol::widget::spinPosition _mode,
const std::string& _shaperName) {
ewol::widget::Sizer::init(ewol::widget::Sizer::modeHori);
propertyLockExpand.set(bvec2(true,true));
propertyShape.set(_shaperName);
propertySpinMode.set(_mode);
propertyGravity.set(gravity_center);
updateGui(); updateGui();
} }
@ -88,7 +79,7 @@ void ewol::widget::SpinBase::updateGui() {
shaper = m_config->getString(m_confIdEntryShaper); shaper = m_config->getString(m_confIdEntryShaper);
EWOL_VERBOSE("shaper entry : " << shaper); EWOL_VERBOSE("shaper entry : " << shaper);
} }
m_widgetEntry = ewol::widget::Entry::create("", shaper); m_widgetEntry = ewol::widget::Entry::create("shape", shaper);
if (m_widgetEntry != nullptr) { if (m_widgetEntry != nullptr) {
m_widgetEntry->propertyExpand.set(bvec2(true,false)); m_widgetEntry->propertyExpand.set(bvec2(true,false));
m_widgetEntry->propertyFill.set(bvec2(true,true)); m_widgetEntry->propertyFill.set(bvec2(true,true));
@ -100,12 +91,12 @@ void ewol::widget::SpinBase::updateGui() {
shaper = m_config->getString(m_confIdDownShaper); shaper = m_config->getString(m_confIdDownShaper);
EWOL_VERBOSE("shaper button DOWN : " << shaper); EWOL_VERBOSE("shaper button DOWN : " << shaper);
} }
m_widgetButtonDown = ewol::widget::Button::create(shaper); m_widgetButtonDown = ewol::widget::Button::create("shape", shaper);
if (m_widgetButtonDown != nullptr) { if (m_widgetButtonDown != nullptr) {
m_widgetButtonDown->propertyExpand.set(bvec2(false,false)); m_widgetButtonDown->propertyExpand.set(bvec2(false,false));
m_widgetButtonDown->propertyFill.set(bvec2(true,true)); m_widgetButtonDown->propertyFill.set(bvec2(true,true));
std::string data = m_config->getString(m_confIdDownData); std::string data = m_config->getString(m_confIdDownData);
std::shared_ptr<ewol::Widget> widget = ewol::widget::composerGenerate(ewol::widget::Composer::String, data); std::shared_ptr<ewol::Widget> widget = ewol::widget::composerGenerateString(data);
m_widgetButtonDown->setSubWidget(widget); m_widgetButtonDown->setSubWidget(widget);
} }
} }
@ -115,12 +106,12 @@ void ewol::widget::SpinBase::updateGui() {
shaper = m_config->getString(m_confIdUpShaper); shaper = m_config->getString(m_confIdUpShaper);
EWOL_VERBOSE("shaper button UP : " << shaper); EWOL_VERBOSE("shaper button UP : " << shaper);
} }
m_widgetButtonUp = ewol::widget::Button::create(shaper); m_widgetButtonUp = ewol::widget::Button::create("shape", shaper);
if (m_widgetButtonUp != nullptr) { if (m_widgetButtonUp != nullptr) {
m_widgetButtonUp->propertyExpand.set(bvec2(false,false)); m_widgetButtonUp->propertyExpand.set(bvec2(false,false));
m_widgetButtonUp->propertyFill.set(bvec2(true,true)); m_widgetButtonUp->propertyFill.set(bvec2(true,true));
std::string data = m_config->getString(m_confIdUpData); std::string data = m_config->getString(m_confIdUpData);
std::shared_ptr<ewol::Widget> widget = ewol::widget::composerGenerate(ewol::widget::Composer::String, data); std::shared_ptr<ewol::Widget> widget = ewol::widget::composerGenerateString(data);
m_widgetButtonUp->setSubWidget(widget); m_widgetButtonUp->setSubWidget(widget);
} }
} }

View File

@ -65,11 +65,7 @@ namespace ewol {
eproperty::Value<std::string> propertyShape; //!< Shape of the widget eproperty::Value<std::string> propertyShape; //!< Shape of the widget
eproperty::List<enum ewol::widget::spinPosition> propertySpinMode; //!< How to display the spin base eproperty::List<enum ewol::widget::spinPosition> propertySpinMode; //!< How to display the spin base
public: public:
/** UN_DECLARE_FACTORY(SpinBase);
* @brief Main call of recording the widget on the List of "widget named creator"
*/
static void init(ewol::widget::Manager& _widgetManager);
public:
protected: protected:
std::shared_ptr<ewol::resource::ConfigFile> m_config; std::shared_ptr<ewol::resource::ConfigFile> m_config;
int32_t m_confIdEntryShaper; int32_t m_confIdEntryShaper;
@ -83,9 +79,7 @@ namespace ewol {
* @param[in] _mode The mode to display the elements * @param[in] _mode The mode to display the elements
*/ */
SpinBase(); SpinBase();
void init(enum ewol::widget::spinPosition _mode, void init();
const std::string& _shaperName);
void init(const std::unordered_map<std::string,eproperty::Variant>& _listProperty);
public: public:
/** /**
* @brief Destructor * @brief Destructor

View File

@ -29,11 +29,12 @@ void ewol::widget::StdPopUp::init() {
std::shared_ptr<ewol::widget::Sizer> mySizerVert; std::shared_ptr<ewol::widget::Sizer> mySizerVert;
std::shared_ptr<ewol::widget::Spacer> mySpacer; std::shared_ptr<ewol::widget::Spacer> mySpacer;
mySizerVert = ewol::widget::Sizer::create(widget::Sizer::modeVert); mySizerVert = ewol::widget::Sizer::create();
// set it in the pop-up-system : // set it in the pop-up-system :
setSubWidget(mySizerVert); setSubWidget(mySizerVert);
mySizerVert->propertyMode.set(widget::Sizer::modeVert);
m_subBar = ewol::widget::Sizer::create(widget::Sizer::modeHori); m_subBar = ewol::widget::Sizer::create();
m_subBar->propertyMode.set(widget::Sizer::modeHori);
m_subBar->propertyLockExpand.set(bvec2(true,true)); m_subBar->propertyLockExpand.set(bvec2(true,true));
m_subBar->propertyExpand.set(bvec2(true,false)); m_subBar->propertyExpand.set(bvec2(true,false));
mySizerVert->subWidgetAdd(m_subBar); mySizerVert->subWidgetAdd(m_subBar);
@ -52,7 +53,8 @@ void ewol::widget::StdPopUp::init() {
mySpacer->propertyMinSize.set(gale::Dimension(vec2(0,5),gale::Dimension::Pixel)); mySpacer->propertyMinSize.set(gale::Dimension(vec2(0,5),gale::Dimension::Pixel));
mySizerVert->subWidgetAdd(mySpacer); mySizerVert->subWidgetAdd(mySpacer);
m_comment = ewol::widget::Label::create("No Label"); m_comment = ewol::widget::Label::create();
m_comment->propertyValue.set("No Label");
m_comment->propertyExpand.set(bvec2(true,true)); m_comment->propertyExpand.set(bvec2(true,true));
mySizerVert->subWidgetAdd(m_comment); mySizerVert->subWidgetAdd(m_comment);
@ -67,7 +69,8 @@ void ewol::widget::StdPopUp::init() {
mySpacer->propertyMinSize.set(gale::Dimension(vec2(0,3),gale::Dimension::Pixel)); mySpacer->propertyMinSize.set(gale::Dimension(vec2(0,3),gale::Dimension::Pixel));
mySizerVert->subWidgetAdd(mySpacer); mySizerVert->subWidgetAdd(mySpacer);
m_title = ewol::widget::Label::create("<bold>Message</bold>"); m_title = ewol::widget::Label::create();
m_title->propertyValue.set("<bold>Message</bold>");
m_title->propertyExpand.set(bvec2(true,false)); m_title->propertyExpand.set(bvec2(true,false));
m_title->propertyFill.set(bvec2(true,true)); m_title->propertyFill.set(bvec2(true,true));
mySizerVert->subWidgetAdd(m_title); mySizerVert->subWidgetAdd(m_title);
@ -103,7 +106,7 @@ std::shared_ptr<ewol::widget::Button> ewol::widget::StdPopUp::addButton(const st
EWOL_ERROR("Can not allocate new button ..."); EWOL_ERROR("Can not allocate new button ...");
return nullptr; return nullptr;
} }
myButton->setSubWidget(ewol::widget::Label::create(_text)); myButton->setSubWidget(ewol::widget::Label::create("value", _text));
if(_autoExit == true) { if(_autoExit == true) {
myButton->signalPressed.connect(shared_from_this(), &ewol::widget::StdPopUp::onCallBackButtonExit); myButton->signalPressed.connect(shared_from_this(), &ewol::widget::StdPopUp::onCallBackButtonExit);
} }

View File

@ -24,6 +24,7 @@
#include <ewol/widget/meta/Parameter.h> #include <ewol/widget/meta/Parameter.h>
#include <ewol/widget/Select.h> #include <ewol/widget/Select.h>
#include <ewol/widget/Manager.h> #include <ewol/widget/Manager.h>
#include <ewol/widget/Spin.h>
#include <ewol/context/Context.h> #include <ewol/context/Context.h>
#include <appl/TestDistanceField.h> #include <appl/TestDistanceField.h>
#include <etk/os/FSNode.h> #include <etk/os/FSNode.h>
@ -48,7 +49,8 @@ appl::MainWindows::MainWindows() :
void appl::MainWindows::init() { void appl::MainWindows::init() {
ewol::widget::Windows::init(); ewol::widget::Windows::init();
m_composer = ewol::widget::Composer::create(ewol::widget::Composer::file, "DATA:gui.xml"); m_composer = ewol::widget::Composer::create();
m_composer->loadFromFile("DATA:gui.xml");
setSubWidget(m_composer); setSubWidget(m_composer);
externSubBind(m_composer, ewol::widget::Button, "appl-theme-toggle", signalValue, shared_from_this(), &appl::MainWindows::onCallbackThemeChange); externSubBind(m_composer, ewol::widget::Button, "appl-theme-toggle", signalValue, shared_from_this(), &appl::MainWindows::onCallbackThemeChange);
externSubBind(m_composer, ewol::widget::Button, "appl-previous-widget", signalPressed, shared_from_this(), &appl::MainWindows::onCallbackWidgetChange, -1); externSubBind(m_composer, ewol::widget::Button, "appl-previous-widget", signalPressed, shared_from_this(), &appl::MainWindows::onCallbackWidgetChange, -1);
@ -183,12 +185,16 @@ 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"))}})); m_subWidget = ewol::widget::Spin::create("name", std::string("plop"));
// wrong: m_subWidget = ewol::widget::SpinBase::create("name", std::string("plop"), 1521);
m_subWidget = ewol::widget::Spin::create("name", std::string("plop"),
"spin-mode", ewol::widget::spinPosition_RightRight);
return; 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::composerGenerateString(tmpConstruct);
if (m_subWidget != nullptr) { if (m_subWidget != nullptr) {
m_sizerVert->subWidgetReplace(oldWidget, m_subWidget); m_sizerVert->subWidgetReplace(oldWidget, m_subWidget);
} }
@ -215,7 +221,8 @@ void appl::MainWindows::updateProperty() {
if (m_subWidget == nullptr) { if (m_subWidget == nullptr) {
return; return;
} }
std::shared_ptr<ewol::widget::Label> widget = ewol::widget::Label::create(m_subWidget->getObjectType()); std::shared_ptr<ewol::widget::Label> widget = ewol::widget::Label::create();
widget->propertyValue.set(m_subWidget->getObjectType());
m_sizerDynamic->subWidgetAdd(widget); m_sizerDynamic->subWidgetAdd(widget);
addSpacer(m_sizerDynamic, etk::color::red); addSpacer(m_sizerDynamic, etk::color::red);
for (size_t iii=0; iii<m_subWidget->getPropertyCount(); ++iii) { for (size_t iii=0; iii<m_subWidget->getPropertyCount(); ++iii) {
@ -224,13 +231,15 @@ void appl::MainWindows::updateProperty() {
APPL_WARNING("Parameter EMPTY . " << iii << " : nullptr"); APPL_WARNING("Parameter EMPTY . " << iii << " : nullptr");
continue; continue;
} }
std::shared_ptr<ewol::widget::Sizer> widgetSizer = ewol::widget::Sizer::create(ewol::widget::Sizer::modeHori); std::shared_ptr<ewol::widget::Sizer> widgetSizer = ewol::widget::Sizer::create();
if (widgetSizer != nullptr) { if (widgetSizer != nullptr) {
widgetSizer->propertyMode.set(ewol::widget::Sizer::modeHori);
widgetSizer->propertyExpand.set(bvec2(true,false)); widgetSizer->propertyExpand.set(bvec2(true,false));
widgetSizer->propertyFill.set(bvec2(true,true)); widgetSizer->propertyFill.set(bvec2(true,true));
m_sizerDynamic->subWidgetAddStart(widgetSizer); m_sizerDynamic->subWidgetAddStart(widgetSizer);
std::shared_ptr<ewol::widget::Label> widget = ewol::widget::Label::create(param->getName() + ":"); std::shared_ptr<ewol::widget::Label> widget = ewol::widget::Label::create();
widget->propertyValue.set(param->getName() + ":");
widgetSizer->subWidgetAdd(widget); widgetSizer->subWidgetAdd(widget);
//addSpacer(widgetSizer, etk::color::purple); //addSpacer(widgetSizer, etk::color::purple);
// Main part TODO: ... // Main part TODO: ...
@ -274,7 +283,8 @@ void appl::MainWindows::updateProperty() {
paramValue->set(lastValueInterpreted); paramValue->set(lastValueInterpreted);
return; return;
}); });
std::shared_ptr<ewol::widget::Label> widgetLabel = ewol::widget::Label::create("x"); std::shared_ptr<ewol::widget::Label> widgetLabel = ewol::widget::Label::create();
widgetLabel->propertyValue.set("x");
widgetTmp->setSubWidget(widgetLabel); widgetTmp->setSubWidget(widgetLabel);
widgetTmp = ewol::widget::CheckBox::create(); widgetTmp = ewol::widget::CheckBox::create();
@ -287,7 +297,8 @@ void appl::MainWindows::updateProperty() {
paramValue->set(lastValueInterpreted); paramValue->set(lastValueInterpreted);
return; return;
}); });
widgetLabel = ewol::widget::Label::create("y"); widgetLabel = ewol::widget::Label::create();
widgetLabel->propertyValue.set("y");
widgetTmp->setSubWidget(widgetLabel); widgetTmp->setSubWidget(widgetLabel);
} else if (type == typeid(ivec2).name()) { } else if (type == typeid(ivec2).name()) {
type = "ivec2"; type = "ivec2";