[DEV] start think of new simplest API for properties (not build and not work)

This commit is contained in:
Edouard DUPIN 2016-02-12 23:48:35 +01:00
parent 86f537913b
commit 1a3bbc297c
15 changed files with 55 additions and 346 deletions

View File

@ -77,6 +77,10 @@ namespace ewol {
class Object : public std::enable_shared_from_this<Object>,
public eproperty::Interface,
public esignal::Interface {
public: // Event list
public: // propertie list
eproperty::Value<std::string> propertyName; //!< name of the element ...
private:
static size_t m_valUID; //!< Static used for the unique ID definition
private:
@ -187,23 +191,6 @@ namespace ewol {
public:
// TODO : Rework the position on this function ... This is a convignent function ...
bool propertySetOnWidgetNamed(const std::string& _objectName, const std::string& _config, const std::string& _value);
protected:
eproperty::Value<std::string> m_name; //!< name of the element ...
public:
/**
* @brief get the Object name
* @return The requested name
*/
const std::string& getName() const {
return m_name.get();
};
/**
* @brief get the Widget name
* @param[in] _name The new name
*/
void setName(const std::string& _name) {
m_name = _name;
};
public:
/**
* @brief load properties with an XML node.
@ -310,8 +297,4 @@ namespace ewol {
EWOL_ERROR("object named='" << _name << "' not exit or can not be cast in : " << #_type); \
} \
} while (false)
//#include <esignal/Signal.h>

View File

@ -26,21 +26,27 @@ namespace ewol {
*/
class Button : public ewol::widget::Container2 {
public:
// Event list of properties
esignal::Signal<void> signalPressed;
esignal::Signal<void> signalDown;
esignal::Signal<void> signalUp;
esignal::Signal<void> signalEnter;
esignal::Signal<void> signalLeave;
esignal::Signal<bool> signalValue;
enum buttonLock{
lockNone, //!< normal status of the button
lockWhenPressed, //!< When the state is set in pressed, the status stay in this one
lockWhenReleased, //!< When the state is set in not pressed, the status stay in this one
lockAccess, //!< all event are trashed == > acctivity of the button is disable
};
public: // Event list
esignal::Signal<void> signalPressed;
esignal::Signal<void> signalDown;
esignal::Signal<void> signalUp;
esignal::Signal<void> signalEnter;
esignal::Signal<void> signalLeave;
esignal::Signal<bool> signalValue;
public: // propertie list
eproperty::Value<std::string> propertyShaper; //!< shaper name property
eproperty::Value<bool> propertyValue; //!< Current state of the button.
eproperty::List<enum buttonLock> propertyLock; //!< Current lock state of the button.
eproperty::Value<bool> propertyToggleMode; //!< The button is able to toggle.
eproperty::Value<bool> propertyEnableSingle; //!< When a single subwidget is set display all time it.
private:
eproperty::Value<ewol::compositing::Shaper> m_shaper; //!< Compositing theme.
ewol::compositing::Shaper m_shaper; //!< Compositing theme.
protected:
/**
* @brief Constructor
@ -61,76 +67,6 @@ namespace ewol {
void setShaperName(const std::string& _shaperName) {
m_shaper.setString(_shaperName);
}
protected:
eproperty::Value<bool> m_value; //!< Current state of the button.
public:
/**
* @brief set the currentValue of the Button (pressed or not)
* @note Work only in toggle mode
* @param[in] _val New value of the button
*/
void setValue(bool _val) {
m_value.set(_val);
}
/**
* @brief get the current button value.
* @return True : The button is pressed.
* @return false : The button is released.
*/
bool getValue() const {
return m_value;
};
protected:
eproperty::List<enum buttonLock> m_lock; //!< Current lock state of the button.
public:
/**
* @brief set the button lock state.
* @param[in] _lock New lock mode of the button
*/
void setLock(enum buttonLock _lock) {
m_lock.set(_lock);
}
/**
* @brief get the current button lock value.
* @return The requested lock mode
*/
enum buttonLock getLock() const {
return m_lock;
};
protected:
eproperty::Value<bool> m_toggleMode; //!< The button is able to toggle.
public:
/**
* @brief change the toggle mode.
* @param[in] _togg New toggle mode
*/
void setToggleMode(bool _togg) {
m_toggleMode.set(_togg);
}
/**
* @brief get the current toggle mode.
* @return the current toggle mode.
*/
bool getToggleMode() const {
return m_toggleMode;
};
protected:
eproperty::Value<bool> m_enableSingle; //!< When a single subwidget is set display all time it.
public:
/**
* @brief Chane the display single widget mode availlable.
* @param[in] _single single mode widget set
*/
void setEnableSingle(bool _single) {
m_enableSingle.set(_single);
}
/**
* @brief get the current single mode enableling.
* @return the current value.
*/
bool getEnableSingle() const {
return m_enableSingle;
};
private:
bool m_mouseHover; //!< Flag to know where the mouse is (inside the displayed widget (if not fill)).
bool m_buttonPressed; //!< Flag to know if the button is curently pressed.

View File

@ -20,9 +20,10 @@
namespace ewol {
namespace widget {
class ButtonColor : public ewol::Widget {
public:
// Event list of properties
public: // signals
esignal::Signal<etk::Color<>> signalChange;
public: // properties
eproperty::Value<etk::Color<>> m_textColorFg; //!< Current color.
private:
ewol::compositing::Shaper m_shaper; //!< Compositing theme.
ewol::compositing::Text m_text; //!< Compositing Test display.
@ -51,23 +52,6 @@ namespace ewol {
* @param[in] _shaperName The new shaper filename.
*/
void setShaperName(std::string _shaperName);
protected:
eproperty::Value<etk::Color<>> m_textColorFg; //!< Current color.
public:
/**
* @brief get the current color of the color selection widget
* @return The current color
*/
const etk::Color<>& getValue() {
return m_textColorFg.get();
}
/**
* @brief Specify the current color.
* @param[in] _color The new display color.
*/
void setValue(const etk::Color<>& _color) {
m_textColorFg.set(_color);
}
protected: // Derived function
virtual void onDraw();
public: // Derived function

View File

@ -25,6 +25,7 @@ ewol::widget::CheckBox::CheckBox() :
signalUp(*this, "up", "CheckBox is UP"),
signalEnter(*this, "enter", "The cursor enter inside the CheckBox"),
signalValue(*this, "value", "CheckBox value change"),
propertyshaper(*this, "shaper", "The display name for config file"),
m_shaper(*this, "shaper", "The display name for config file"),
m_mouseHover(false),
m_buttonPressed(false),

View File

@ -18,15 +18,17 @@
namespace ewol {
namespace widget {
class CheckBox : public ewol::widget::Container2 {
public:
// Event list of properties
public: // Event list
esignal::Signal<void> signalPressed;
esignal::Signal<void> signalDown;
esignal::Signal<void> signalUp;
esignal::Signal<void> signalEnter;
esignal::Signal<bool> signalValue;
public: // propertie list
eproperty::Value<std::string> propertyShaper;
eproperty::Value<bool> propertyValue; //!< Current state of the checkbox.
private:
eproperty::Value<ewol::compositing::Shaper> m_shaper; //!< Compositing theme.
ewol::compositing::Shaper m_shaper; //!< Compositing theme.
bool m_mouseHover; //!< Flag to know where the mouse is (inside the displayed widget (if not fill)).
bool m_buttonPressed; //!< Flag to know if the button is curently pressed.
// hover area :
@ -48,31 +50,6 @@ namespace ewol {
* @brief main destructor.
*/
virtual ~CheckBox();
/**
* @brief set the shaper name (use the contructer one this permit to not noad unused shaper)
* @param[in] _shaperName The new shaper filename
*/
void setShaperName(const std::string& _shaperName) {
m_shaper.set(_shaperName);
}
protected:
eproperty::Value<bool> m_value; //!< Current state of the checkbox.
public:
/**
* @brief set the current value of the checkbox (check or not)
* @param[in] _val New value of the button
*/
void setValue(bool _val) {
m_value.set(_val);
}
/**
* @brief get the current button value.
* @return True : The checkbox is active.
* @return false : The checkbox is disable.
*/
bool getValue() const {
return m_value;
};
protected:
/**
* @brief internal system to change the property of the current status

View File

@ -18,8 +18,7 @@
namespace ewol {
namespace widget {
class ColorBar : public ewol::Widget {
public:
// Event list of properties
public: // signals
esignal::Signal<etk::Color<>> signalChange;
protected:
ColorBar();

View File

@ -29,6 +29,10 @@ namespace ewol {
markLeft,
markNone
};
public: // properties
eproperty::Value<vec2> propertyArrowPos;
eproperty::List<enum markPosition> propertyArrawBorder;
eproperty::Value<std::string> propertyShaper; //!< Compositing theme.
protected:
ContextMenu();
void init(const std::string& _shaperName="{ewol}THEME:GUI:ContextMenu.json");
@ -36,22 +40,11 @@ namespace ewol {
DECLARE_WIDGET_FACTORY(ContextMenu, "ContextMenu");
virtual ~ContextMenu();
private:
eproperty::Value<ewol::compositing::Shaper> m_shaper; //!< Compositing theme.
public:
/**
* @brief set the shaper name (use the contructer one this permit to not noad unused shaper)
* @param[in] _shaperName The new shaper filename
*/
void setShaperName(const std::string& _shaperName);
private:
// TODO : Rework the displayer ....
ewol::compositing::Shaper m_shaper; //!< Compositing theme.
ewol::compositing::Drawing m_compositing;
etk::Color<> m_colorBackGroung;
etk::Color<> m_colorBorder;
float m_offset;
private:
eproperty::Value<vec2> m_arrowPos;
eproperty::List<enum markPosition> m_arrawBorder;
public:
void setPositionMarkAuto(const vec2& _origin, const vec2& _size);
void setPositionMark(enum markPosition _position, const vec2& _arrowPos);

View File

@ -31,12 +31,18 @@ namespace ewol {
* ~~~~~~~~~~~~~~~~~~~~~~
*/
class Entry : public ewol::Widget {
public:
public: // Event list
esignal::Signal<void> signalClick; //!< bang on click the entry box
esignal::Signal<std::string> signalEnter; //!< Enter key is pressed
esignal::Signal<std::string> signalModify; //!< data change
public: // propertie list
eproperty::Value<std::string> propertyShaper;
eproperty::Value<std::string> propertyValue; //!< string that must be displayed
eproperty::Range<int32_t> propertyMaxCharacter; //!< number max of xharacter in the list
eproperty::Value<std::string> propertyRegex; //!< regular expression value
eproperty::Value<std::string> propertyTextWhenNothing; //!< Text to display when nothing in in the entry (decorated text...)
private:
eproperty::Value<ewol::compositing::Shaper> m_shaper;
ewol::compositing::Shaper m_shaper;
int32_t m_colorIdTextFg; //!< color property of the text foreground
int32_t m_colorIdTextBg; //!< color property of the text background
int32_t m_colorIdCursor; //!< color property of the text cursor
@ -56,62 +62,14 @@ namespace ewol {
* @brief Destuctor
*/
virtual ~Entry();
private:
eproperty::Value<std::string> m_data; //!< sting that must be displayed
protected:
/**
* @brief internal check the value with RegExp checking
* @param[in] _newData The new string to display
*/
void setInternalValue(const std::string& _newData);
public:
/**
* @brief set a new value on the entry.
* @param[in] _newData the new string to display.
*/
void setValue(const std::string& _newData);
/**
* @brief get the current value in the entry
* @return The current display value
*/
std::string getValue() const {
return m_data;
};
private:
eproperty::Range<int32_t> m_maxCharacter; //!< number max of xharacter in the list
public:
/**
* @brief Limit the number of Unicode character in the entry
* @param[in] _nbMax Number of max character set in the List (0x7FFFFFFF for no limit)
*/
void setMaxChar(int32_t _nbMax) {
m_maxCharacter.set(_nbMax);
}
/**
* @brief Limit the number of Unicode character in the entry
* @return Number of max character set in the List.
*/
int32_t getMaxChar() const {
return m_maxCharacter;
};
private:
eproperty::Value<std::string> m_regexValue; //!< regular expression value
std::regex m_regex; //!< regular expression to check content
public:
/**
* @brief Limit the input entry at a regular expression... (by default it is "*")
* @param _expression New regular expression
*/
void setRegex(const std::string& _expression) {
m_regexValue.set(_expression);
}
/**
* @brief get the regualar expression limitation
* @param The regExp string
*/
std::string getRegex() const {
return m_regexValue;
};
private:
bool m_needUpdateTextPos; //!< text position can have change
int32_t m_displayStartPosition; //!< ofset in pixel of the display of the UString

View File

@ -93,44 +93,3 @@ void ewol::widget::Spin::onCallbackDown() {
int64_t value = m_value.get() - m_increment.get();
checkValue(value);
}
void ewol::widget::Spin::setValue(int64_t _val) {
m_value.set(_val);
}
int64_t ewol::widget::Spin::getValue() const {
return m_value;
}
void ewol::widget::Spin::setMinimum(int64_t _val) {
m_min.set(_val);
}
int64_t ewol::widget::Spin::getMinimum() const {
return m_min;
}
void ewol::widget::Spin::setMaximum(int64_t _val) {
m_max.set(_val);
}
int64_t ewol::widget::Spin::getMaximum() const {
return m_max;
}
void ewol::widget::Spin::setIncrement(int64_t _val) {
m_increment.set(_val);
}
int64_t ewol::widget::Spin::getIncrement() const {
return m_increment;
}
void ewol::widget::Spin::setMantis(int8_t _val) {
m_mantis.set(_val);
}
int8_t ewol::widget::Spin::getMantis() const {
return m_mantis;
}

View File

@ -22,6 +22,12 @@ namespace ewol {
// Event list of properties
esignal::Signal<int64_t> signalValue;
esignal::Signal<double> signalValueDouble;
public:
eproperty::Value<int64_t> propertyValue; //!< Current value of the Spin.
eproperty::Value<int64_t> propertyMin; //!< Minimum value
eproperty::Value<int64_t> propertyMax; //!< Maximum value
eproperty::Value<int64_t> propertyIncrement; //!< Increment value
eproperty::Value<int8_t> propertyMantis; //!< number of value under '.' value
protected:
/**
* @brief Constructor
@ -37,78 +43,6 @@ namespace ewol {
* @brief Destructor
*/
virtual ~Spin();
/**
* @brief set the shaper name (use the contructer one this permit to not noad unused shaper)
* @param[in] _shaperName The new shaper filename
*/
void setShaperName(const std::string& _shaperName) {
//m_shaper.setString(_shaperName);
}
protected:
eproperty::Value<int64_t> m_value; //!< Current value of the Spin.
public:
/**
* @brief set the current value of the Spin
* @param[in] _val New value to set
*/
void setValue(int64_t _val);
/**
* @brief get the current Spin value.
* @return The current spin value.
*/
int64_t getValue() const;
protected:
eproperty::Value<int64_t> m_min; //!< Minimum value
public:
/**
* @brief set the minimum of the Spin
* @param[in] _val New minimum to set
*/
void setMinimum(int64_t _val);
/**
* @brief get the current Spin minimum.
* @return The current spin minimum.
*/
int64_t getMinimum() const;
protected:
eproperty::Value<int64_t> m_max; //!< Maximum value
public:
/**
* @brief set the maxnimum of the Spin
* @param[in] _val New maxnimum to set
*/
void setMaximum(int64_t _val);
/**
* @brief get the current Spin maxnimum.
* @return The current spin maxnimum.
*/
int64_t getMaximum() const;
protected:
eproperty::Value<int64_t> m_increment; //!< Increment value
public:
/**
* @brief set the increment value of the Spin
* @param[in] _val New increment to set
*/
void setIncrement(int64_t _val);
/**
* @brief get the current Spin increment.
* @return The current spin increment.
*/
int64_t getIncrement() const;
protected:
eproperty::Value<int8_t> m_mantis; //!< number of value under '.' value
public:
/**
* @brief set the mantis value of the Spin
* @param[in] _val New mantis to set
*/
void setMantis(int8_t _val);
/**
* @brief get the current Spin mantis.
* @return The current spin mantis.
*/
int8_t getMantis() const;
protected:
virtual void checkValue(int64_t _value);
virtual void onPropertyChangeValue(const eproperty::Ref& _paramPointer);

View File

@ -24,8 +24,7 @@ namespace ewol {
* @ingroup ewolWidgetGroup
*/
class ColorChooser : public ewol::widget::Sizer {
public:
// Event list of properties
public: // signals
esignal::Signal<etk::Color<>> signalChange;
protected:
ColorChooser();

View File

@ -63,8 +63,7 @@ namespace ewol {
* This is the best example of a Meta-widget.
*/
class FileChooser : public ewol::widget::Composer {
public:
// Event list of properties
public: // signals
esignal::Signal<void> signalCancel;
esignal::Signal<std::string> signalValidate;
protected:

View File

@ -25,8 +25,7 @@ namespace ewol {
* @ingroup ewolWidgetGroup
*/
class Parameter : public ewol::widget::PopUp {
public:
// Event list of properties
public: // signals
esignal::Signal<void> signalClose;
protected:
Parameter();

View File

@ -36,9 +36,10 @@ namespace ewol {
* @ingroup ewolWidgetGroup
*/
class ParameterList :public ewol::widget::WidgetScrolled {
public:
// Event list of properties
public: //signals
esignal::Signal<int32_t> signalSelect;
public: // properties
private:
int32_t m_idSelected;
std::vector<ewol::widget::elementPL *> m_list;

View File

@ -61,6 +61,8 @@ namespace ewol {
* @ingroup ewolWidgetGroup
*/
class SpinBase : public ewol::widget::Sizer {
public: // properties list:
eproperty::List<enum ewol::widget::spinPosition> m_spinMode; //!< How to display the spin base
public:
/**
* @brief Main call of recording the widget on the List of "widget named creator"
@ -74,7 +76,6 @@ namespace ewol {
int32_t m_confIdDownShaper;
int32_t m_confIdUpData;
int32_t m_confIdDownData;
eproperty::List<enum ewol::widget::spinPosition> m_spinMode; //!< How to display the spin base
protected:
/**
* @brief Constructor
@ -88,20 +89,6 @@ namespace ewol {
* @brief Destructor
*/
virtual ~SpinBase();
/**
* @brief set the mode to display elements.
* @param[in] _mode The mode to display the elements.
*/
void setMode(enum ewol::widget::spinPosition _mode) {
m_spinMode.set(_mode);
}
/**
* @brief get the mode to display elements.
* @return The current mode to display the elements.
*/
enum ewol::widget::spinPosition getMode() const {
return m_spinMode;
}
protected:
std::shared_ptr<ewol::widget::Entry> m_widgetEntry;
std::shared_ptr<ewol::widget::Button> m_widgetButtonDown;