From 1a3bbc297ce8860f6980019001b64dc70a38d57d Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Fri, 12 Feb 2016 23:48:35 +0100 Subject: [PATCH] [DEV] start think of new simplest API for properties (not build and not work) --- ewol/object/Object.h | 25 ++------- ewol/widget/Button.h | 92 +++++--------------------------- ewol/widget/ButtonColor.h | 22 ++------ ewol/widget/CheckBox.cpp | 1 + ewol/widget/CheckBox.h | 33 ++---------- ewol/widget/ColorBar.h | 3 +- ewol/widget/ContextMenu.h | 17 ++---- ewol/widget/Entry.h | 58 +++----------------- ewol/widget/Spin.cpp | 41 -------------- ewol/widget/Spin.h | 78 +++------------------------ ewol/widget/meta/ColorChooser.h | 3 +- ewol/widget/meta/FileChooser.h | 3 +- ewol/widget/meta/Parameter.h | 3 +- ewol/widget/meta/ParameterList.h | 5 +- ewol/widget/meta/SpinBase.h | 17 +----- 15 files changed, 55 insertions(+), 346 deletions(-) diff --git a/ewol/object/Object.h b/ewol/object/Object.h index cf616740..6fa00a62 100644 --- a/ewol/object/Object.h +++ b/ewol/object/Object.h @@ -77,6 +77,10 @@ namespace ewol { class Object : public std::enable_shared_from_this, public eproperty::Interface, public esignal::Interface { + public: // Event list + + public: // propertie list + eproperty::Value 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 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 - - - diff --git a/ewol/widget/Button.h b/ewol/widget/Button.h index 6fe0633f..8d39df98 100644 --- a/ewol/widget/Button.h +++ b/ewol/widget/Button.h @@ -26,21 +26,27 @@ namespace ewol { */ class Button : public ewol::widget::Container2 { public: - // Event list of properties - esignal::Signal signalPressed; - esignal::Signal signalDown; - esignal::Signal signalUp; - esignal::Signal signalEnter; - esignal::Signal signalLeave; - esignal::Signal 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 signalPressed; + esignal::Signal signalDown; + esignal::Signal signalUp; + esignal::Signal signalEnter; + esignal::Signal signalLeave; + esignal::Signal signalValue; + public: // propertie list + eproperty::Value propertyShaper; //!< shaper name property + eproperty::Value propertyValue; //!< Current state of the button. + eproperty::List propertyLock; //!< Current lock state of the button. + eproperty::Value propertyToggleMode; //!< The button is able to toggle. + eproperty::Value propertyEnableSingle; //!< When a single subwidget is set display all time it. private: - eproperty::Value 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 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 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 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 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. diff --git a/ewol/widget/ButtonColor.h b/ewol/widget/ButtonColor.h index f6aafb8f..291e00c0 100644 --- a/ewol/widget/ButtonColor.h +++ b/ewol/widget/ButtonColor.h @@ -20,9 +20,10 @@ namespace ewol { namespace widget { class ButtonColor : public ewol::Widget { - public: - // Event list of properties + public: // signals esignal::Signal> signalChange; + public: // properties + eproperty::Value> 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> 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 diff --git a/ewol/widget/CheckBox.cpp b/ewol/widget/CheckBox.cpp index 3f531e78..2b6cbcfb 100644 --- a/ewol/widget/CheckBox.cpp +++ b/ewol/widget/CheckBox.cpp @@ -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), diff --git a/ewol/widget/CheckBox.h b/ewol/widget/CheckBox.h index 972a3633..15371039 100644 --- a/ewol/widget/CheckBox.h +++ b/ewol/widget/CheckBox.h @@ -18,15 +18,17 @@ namespace ewol { namespace widget { class CheckBox : public ewol::widget::Container2 { - public: - // Event list of properties + public: // Event list esignal::Signal signalPressed; esignal::Signal signalDown; esignal::Signal signalUp; esignal::Signal signalEnter; esignal::Signal signalValue; + public: // propertie list + eproperty::Value propertyShaper; + eproperty::Value propertyValue; //!< Current state of the checkbox. private: - eproperty::Value 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 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 diff --git a/ewol/widget/ColorBar.h b/ewol/widget/ColorBar.h index 8a6bb836..182d2b54 100644 --- a/ewol/widget/ColorBar.h +++ b/ewol/widget/ColorBar.h @@ -18,8 +18,7 @@ namespace ewol { namespace widget { class ColorBar : public ewol::Widget { - public: - // Event list of properties + public: // signals esignal::Signal> signalChange; protected: ColorBar(); diff --git a/ewol/widget/ContextMenu.h b/ewol/widget/ContextMenu.h index 79e7341c..3c031069 100644 --- a/ewol/widget/ContextMenu.h +++ b/ewol/widget/ContextMenu.h @@ -29,6 +29,10 @@ namespace ewol { markLeft, markNone }; + public: // properties + eproperty::Value propertyArrowPos; + eproperty::List propertyArrawBorder; + eproperty::Value 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 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 m_arrowPos; - eproperty::List m_arrawBorder; public: void setPositionMarkAuto(const vec2& _origin, const vec2& _size); void setPositionMark(enum markPosition _position, const vec2& _arrowPos); diff --git a/ewol/widget/Entry.h b/ewol/widget/Entry.h index b696596d..c075adc6 100644 --- a/ewol/widget/Entry.h +++ b/ewol/widget/Entry.h @@ -31,12 +31,18 @@ namespace ewol { * ~~~~~~~~~~~~~~~~~~~~~~ */ class Entry : public ewol::Widget { - public: + public: // Event list esignal::Signal signalClick; //!< bang on click the entry box esignal::Signal signalEnter; //!< Enter key is pressed esignal::Signal signalModify; //!< data change + public: // propertie list + eproperty::Value propertyShaper; + eproperty::Value propertyValue; //!< string that must be displayed + eproperty::Range propertyMaxCharacter; //!< number max of xharacter in the list + eproperty::Value propertyRegex; //!< regular expression value + eproperty::Value propertyTextWhenNothing; //!< Text to display when nothing in in the entry (decorated text...) private: - eproperty::Value 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 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 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 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 diff --git a/ewol/widget/Spin.cpp b/ewol/widget/Spin.cpp index f626199e..606da839 100644 --- a/ewol/widget/Spin.cpp +++ b/ewol/widget/Spin.cpp @@ -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; -} - diff --git a/ewol/widget/Spin.h b/ewol/widget/Spin.h index 9eb62ec5..01273e69 100644 --- a/ewol/widget/Spin.h +++ b/ewol/widget/Spin.h @@ -22,6 +22,12 @@ namespace ewol { // Event list of properties esignal::Signal signalValue; esignal::Signal signalValueDouble; + public: + eproperty::Value propertyValue; //!< Current value of the Spin. + eproperty::Value propertyMin; //!< Minimum value + eproperty::Value propertyMax; //!< Maximum value + eproperty::Value propertyIncrement; //!< Increment value + eproperty::Value 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 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 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 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 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 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); diff --git a/ewol/widget/meta/ColorChooser.h b/ewol/widget/meta/ColorChooser.h index 2d852f1b..98b1b831 100644 --- a/ewol/widget/meta/ColorChooser.h +++ b/ewol/widget/meta/ColorChooser.h @@ -24,8 +24,7 @@ namespace ewol { * @ingroup ewolWidgetGroup */ class ColorChooser : public ewol::widget::Sizer { - public: - // Event list of properties + public: // signals esignal::Signal> signalChange; protected: ColorChooser(); diff --git a/ewol/widget/meta/FileChooser.h b/ewol/widget/meta/FileChooser.h index c80c4a44..01a429cf 100644 --- a/ewol/widget/meta/FileChooser.h +++ b/ewol/widget/meta/FileChooser.h @@ -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 signalCancel; esignal::Signal signalValidate; protected: diff --git a/ewol/widget/meta/Parameter.h b/ewol/widget/meta/Parameter.h index a08ba110..61eaa42e 100644 --- a/ewol/widget/meta/Parameter.h +++ b/ewol/widget/meta/Parameter.h @@ -25,8 +25,7 @@ namespace ewol { * @ingroup ewolWidgetGroup */ class Parameter : public ewol::widget::PopUp { - public: - // Event list of properties + public: // signals esignal::Signal signalClose; protected: Parameter(); diff --git a/ewol/widget/meta/ParameterList.h b/ewol/widget/meta/ParameterList.h index 198df2a4..b08b3ec6 100644 --- a/ewol/widget/meta/ParameterList.h +++ b/ewol/widget/meta/ParameterList.h @@ -36,9 +36,10 @@ namespace ewol { * @ingroup ewolWidgetGroup */ class ParameterList :public ewol::widget::WidgetScrolled { - public: - // Event list of properties + public: //signals esignal::Signal signalSelect; + public: // properties + private: int32_t m_idSelected; std::vector m_list; diff --git a/ewol/widget/meta/SpinBase.h b/ewol/widget/meta/SpinBase.h index 4ab4b5b4..3493b981 100644 --- a/ewol/widget/meta/SpinBase.h +++ b/ewol/widget/meta/SpinBase.h @@ -61,6 +61,8 @@ namespace ewol { * @ingroup ewolWidgetGroup */ class SpinBase : public ewol::widget::Sizer { + public: // properties list: + eproperty::List 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 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 m_widgetEntry; std::shared_ptr m_widgetButtonDown;