[DEV] change the parameter Updating

This commit is contained in:
Edouard DUPIN 2014-08-14 22:11:42 +02:00
parent 43505fcc37
commit 71f656fb41
37 changed files with 415 additions and 996 deletions

2
external/etk vendored

@ -1 +1 @@
Subproject commit 28e619250d6ccab36d4eb33abfdc446b0279b7c8 Subproject commit fa9b27bb5592f4a6a4f7c2b22e2f15a2a8d7730b

2
external/ewolsa vendored

@ -1 +1 @@
Subproject commit 875e52574e5012e2ccaf2c6dbc1167b3cfe1129a Subproject commit 33fe9dfba589f3e8b3d518790397de9828eb7617

2
monk

@ -1 +1 @@
Subproject commit 85ebc5ec327c3920264de479c8b1049c1b81596c Subproject commit eba3e4f97f618b607e0fc52794b2a72c7f6902e8

View File

@ -298,6 +298,9 @@ namespace ewol {
bool operator== (const Shaper& _obj) const { bool operator== (const Shaper& _obj) const {
return _obj.m_name == m_name; return _obj.m_name == m_name;
} }
bool operator!= (const Shaper& _obj) const {
return _obj.m_name != m_name;
}
}; };
}; };
}; };

View File

@ -313,7 +313,7 @@ bool ewol::Object::storeXML(exml::Element* _node) const {
void ewol::Object::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) { void ewol::Object::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) {
if (_paramPointer == m_name) { if (_paramPointer == m_name) {
EWOL_CRITICAL("[" << getId() << "] Parameter name change : " << m_name); EWOL_VERBOSE("[" << getId() << "] Parameter name change : " << m_name);
} }
} }

View File

@ -16,7 +16,7 @@
namespace ewol { namespace ewol {
namespace object { namespace object {
template<typename MY_TYPE> class Param : public Parameter { template<typename MY_TYPE, bool isEventReceiving=false> class Param : public Parameter {
private: private:
MY_TYPE m_value; //!< Current value. MY_TYPE m_value; //!< Current value.
MY_TYPE m_default; //!< Default value. MY_TYPE m_default; //!< Default value.
@ -67,6 +67,8 @@ namespace ewol {
virtual void setString(const std::string& _newVal) { virtual void setString(const std::string& _newVal) {
// when you want to set an element in parameter you will implement the function template std::from_string // when you want to set an element in parameter you will implement the function template std::from_string
etk::from_string(m_value, _newVal); etk::from_string(m_value, _newVal);
// TODO : Do it better ...
notifyChange();
} }
// herited methode // herited methode
virtual std::string getInfo() const { virtual std::string getInfo() const {
@ -78,7 +80,7 @@ namespace ewol {
} }
// herited methode // herited methode
virtual void setDefault() { virtual void setDefault() {
m_value = m_default; set(m_default);
} }
public: public:
/** /**
@ -97,7 +99,10 @@ namespace ewol {
* @param[in] newVal New value to set (set the nearest value if range is set) * @param[in] newVal New value to set (set the nearest value if range is set)
*/ */
void set(const MY_TYPE& _newVal) { void set(const MY_TYPE& _newVal) {
m_value = _newVal; if (_newVal != m_value) {
m_value = _newVal;
notifyChange();
}
} }
private: private:
/** /**

View File

@ -16,7 +16,7 @@
namespace ewol { namespace ewol {
namespace object { namespace object {
template<typename MY_TYPE> class ParamList : public Parameter { template<typename MY_TYPE, bool isEventReceiving=false> class ParamList : public Parameter {
private: private:
MY_TYPE m_value; //!< Element value ==> can be directly used. MY_TYPE m_value; //!< Element value ==> can be directly used.
MY_TYPE m_default; //!< Default value. MY_TYPE m_default; //!< Default value.
@ -67,7 +67,10 @@ namespace ewol {
virtual void setString(const std::string& _newVal) { virtual void setString(const std::string& _newVal) {
auto it = m_list.find(_newVal); auto it = m_list.find(_newVal);
if (it != m_list.end()) { if (it != m_list.end()) {
m_value = it->second; if (it->second != m_value) {
m_value = it->second;
notifyChange();
}
return; return;
} }
EWOL_WARNING("paramList value='" << _newVal << "' is not un the list ... ==> no change"); EWOL_WARNING("paramList value='" << _newVal << "' is not un the list ... ==> no change");
@ -89,7 +92,7 @@ namespace ewol {
} }
// herited methode // herited methode
virtual void setDefault() { virtual void setDefault() {
m_value = m_default; set(m_default);
} }
void setDefaultValue(const MY_TYPE& _value) { void setDefaultValue(const MY_TYPE& _value) {
m_default = _value; m_default = _value;
@ -109,9 +112,13 @@ namespace ewol {
* @param[in] _newVal New value of the parameter. (not set if out of range) * @param[in] _newVal New value of the parameter. (not set if out of range)
*/ */
void set(MY_TYPE _newVal) { void set(MY_TYPE _newVal) {
if (_newVal == m_value) {
return;
}
for (auto &it : m_list) { for (auto &it : m_list) {
if (it.second == _newVal) { if (it.second == _newVal) {
m_value = it.second; m_value = it.second;
notifyChange();
return; return;
} }
} }

View File

@ -16,7 +16,7 @@
namespace ewol { namespace ewol {
namespace object { namespace object {
template<typename MY_TYPE> class ParamRange : public Parameter { template<typename MY_TYPE, bool isEventReceiving=false> class ParamRange : public Parameter {
private: private:
MY_TYPE m_value; //!< Current value. MY_TYPE m_value; //!< Current value.
MY_TYPE m_min; //!< Minimum value. MY_TYPE m_min; //!< Minimum value.
@ -78,7 +78,7 @@ namespace ewol {
} }
// herited methode // herited methode
virtual void setDefault() { virtual void setDefault() {
m_value = m_default; set(m_default);
} }
public: public:
/** /**
@ -98,9 +98,16 @@ namespace ewol {
*/ */
void set(const MY_TYPE& _newVal) { void set(const MY_TYPE& _newVal) {
if (m_min == m_max) { if (m_min == m_max) {
m_value = _newVal; if (_newVal != m_value) {
m_value = _newVal;
notifyChange();
}
} else { } else {
m_value = std::avg(m_min, _newVal, m_max); MY_TYPE newVal = std::avg(m_min, _newVal, m_max);
if (newVal != m_value) {
m_value = newVal;
notifyChange();
}
} }
} }
private: private:

View File

@ -72,12 +72,6 @@ ewol::widget::Button::~Button() {
} }
void ewol::widget::Button::setShaperName(const std::string& _shaperName) {
EWOL_WARNING("set shaper name : '" << _shaperName << "'");
m_shaper->setSource(_shaperName);
markToRedraw();
}
void ewol::widget::Button::calculateSize(const vec2& _availlable) { void ewol::widget::Button::calculateSize(const vec2& _availlable) {
ewol::Padding padding = m_shaper->getPadding(); ewol::Padding padding = m_shaper->getPadding();
ewol::Padding ret = calculateSizePadded(_availlable, padding); ewol::Padding ret = calculateSizePadded(_availlable, padding);
@ -109,99 +103,6 @@ void ewol::widget::Button::onRegenerateDisplay() {
vec2ClipInt32(m_selectableAreaSize-vec2(padding.x(),padding.y()) ) ); vec2ClipInt32(m_selectableAreaSize-vec2(padding.x(),padding.y()) ) );
} }
void ewol::widget::Button::setLock(enum buttonLock _lock) {
if (m_lock == _lock) {
return;
}
m_lock = _lock;
if(ewol::widget::Button::lockAccess == _lock) {
m_buttonPressed = false;
m_mouseHover = false;
}
CheckStatus();
markToRedraw();
}
void ewol::widget::Button::setEnableSingle(bool _single){
if (m_enableSingle == _single) {
return;
}
m_enableSingle = _single;
if (m_enableSingle == true) {
if ( m_idWidgetDisplayed == 0
&& m_subWidget[0] == nullptr
&& m_subWidget[1] != nullptr) {
m_idWidgetDisplayed = 1;
} else if ( m_idWidgetDisplayed == 1
&& m_subWidget[1] == nullptr
&& m_subWidget[0] != nullptr) {
m_idWidgetDisplayed = 0;
} else if ( m_subWidget[0] == nullptr
&& m_subWidget[1] == nullptr) {
m_idWidgetDisplayed = 0;
}
}
}
void ewol::widget::Button::setValue(bool _val) {
if (m_value == _val) {
return;
}
m_value = _val;
if (m_toggleMode == true) {
if (m_value == false) {
m_idWidgetDisplayed = 0;
} else {
m_idWidgetDisplayed = 1;
}
}
if (m_enableSingle == true) {
if ( m_idWidgetDisplayed == 0
&& m_subWidget[0] == nullptr
&& m_subWidget[1] != nullptr) {
m_idWidgetDisplayed = 1;
} else if ( m_idWidgetDisplayed == 1
&& m_subWidget[1] == nullptr
&& m_subWidget[0] != nullptr) {
m_idWidgetDisplayed = 0;
}
}
CheckStatus();
markToRedraw();
}
void ewol::widget::Button::setToggleMode(bool _togg) {
if (m_toggleMode == _togg) {
return;
}
m_toggleMode = _togg;
if (m_value == true) {
m_value = false;
// TODO : change display and send event ...
}
if (m_toggleMode == false) {
m_idWidgetDisplayed = 0;
} else {
if (m_value == false) {
m_idWidgetDisplayed = 0;
} else {
m_idWidgetDisplayed = 1;
}
}
if (m_enableSingle == true) {
if ( m_idWidgetDisplayed == 0
&& m_subWidget[0] == nullptr
&& m_subWidget[1] != nullptr) {
m_idWidgetDisplayed = 1;
} else if ( m_idWidgetDisplayed == 1
&& m_subWidget[1] == nullptr
&& m_subWidget[0] != nullptr) {
m_idWidgetDisplayed = 0;
}
}
CheckStatus();
markToRedraw();
}
bool ewol::widget::Button::onEventInput(const ewol::event::Input& _event) { bool ewol::widget::Button::onEventInput(const ewol::event::Input& _event) {
EWOL_VERBOSE("Event on BT : " << _event); EWOL_VERBOSE("Event on BT : " << _event);
// disable event in the lock access mode : // disable event in the lock access mode :
@ -318,85 +219,79 @@ void ewol::widget::Button::periodicCall(const ewol::event::Time& _event) {
markToRedraw(); markToRedraw();
} }
/* void ewol::widget::Button::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) {
bool ewol::widget::Button::onSetConfig(const ewol::object::Config& _conf) { ewol::widget::Container2::onParameterChangeValue(_paramPointer);
if (true == ewol::widget::Container2::onSetConfig(_conf)) { if (_paramPointer == m_shaper) {
return true; markToRedraw();
} } else if (_paramPointer == m_value) {
if (_conf.getConfig() == configToggle) { if (m_toggleMode == true) {
setToggleMode(etk::string_to_bool(_conf.getData())); if (m_value == false) {
return true; m_idWidgetDisplayed = 0;
} } else {
if (_conf.getConfig() == configLock) { m_idWidgetDisplayed = 1;
enum buttonLock tmpLock = lockNone; }
if( etk::compare_no_case(_conf.getData(), "true") == true
|| etk::compare_no_case(_conf.getData(), "1") == true) {
tmpLock = lockAccess;
} else if( etk::compare_no_case(_conf.getData(), "down") == true
|| etk::compare_no_case(_conf.getData(), "pressed") == true) {
tmpLock = lockWhenPressed;
} else if( etk::compare_no_case(_conf.getData(), "up") == true
|| etk::compare_no_case(_conf.getData(), "released") == true) {
tmpLock = lockWhenReleased;
} }
setLock(tmpLock); if (m_enableSingle == true) {
return true; if ( m_idWidgetDisplayed == 0
} && m_subWidget[0] == nullptr
if (_conf.getConfig() == configValue) { && m_subWidget[1] != nullptr) {
setValue(etk::string_to_bool(_conf.getData())); m_idWidgetDisplayed = 1;
return true; } else if ( m_idWidgetDisplayed == 1
} && m_subWidget[1] == nullptr
if (_conf.getConfig() == configShaper) { && m_subWidget[0] != nullptr) {
setShaperName(_conf.getData()); m_idWidgetDisplayed = 0;
return true; }
} }
if (_conf.getConfig() == configEnableSingle) { CheckStatus();
setEnableSingle(etk::string_to_bool(_conf.getData())); markToRedraw();
return true; } else if (_paramPointer == m_lock) {
} if(ewol::widget::Button::lockAccess == m_lock.get()) {
return false; m_buttonPressed = false;
} m_mouseHover = false;
}
bool ewol::widget::Button::onGetConfig(const char* _config, std::string& _result) const { CheckStatus();
if (true == ewol::widget::Container2::onGetConfig(_config, _result)) { markToRedraw();
return true; } else if (_paramPointer == m_toggleMode) {
} if (m_value == true) {
if (_config == configToggle) { m_value = false;
_result = etk::to_string(getToggleMode()); // TODO : change display and send event ...
return true; }
} if (m_toggleMode == false) {
if (_config == configLock) { m_idWidgetDisplayed = 0;
switch(getLock()){ } else {
default: if (m_value == false) {
case lockNone: m_idWidgetDisplayed = 0;
_result = "none"; } else {
break; m_idWidgetDisplayed = 1;
case lockAccess: }
_result = "true"; }
break; if (m_enableSingle == true) {
case lockWhenPressed: if ( m_idWidgetDisplayed == 0
_result = "pressed"; && m_subWidget[0] == nullptr
break; && m_subWidget[1] != nullptr) {
case lockWhenReleased: m_idWidgetDisplayed = 1;
_result = "released"; } else if ( m_idWidgetDisplayed == 1
break; && m_subWidget[1] == nullptr
&& m_subWidget[0] != nullptr) {
m_idWidgetDisplayed = 0;
}
}
CheckStatus();
markToRedraw();
} else if (_paramPointer == m_enableSingle) {
if (m_enableSingle == true) {
if ( m_idWidgetDisplayed == 0
&& m_subWidget[0] == nullptr
&& m_subWidget[1] != nullptr) {
m_idWidgetDisplayed = 1;
} else if ( m_idWidgetDisplayed == 1
&& m_subWidget[1] == nullptr
&& m_subWidget[0] != nullptr) {
m_idWidgetDisplayed = 0;
} else if ( m_subWidget[0] == nullptr
&& m_subWidget[1] == nullptr) {
m_idWidgetDisplayed = 0;
}
} }
return true;
} }
if (_config == configValue) {
_result = etk::to_string(getValue());
return true;
}
if (_config == configShaper) {
_result = m_shaper->getSource();
return true;
}
if (_config == configEnableSingle) {
_result = getEnableSingle();
return true;
}
return false;
} }
*/

View File

@ -60,7 +60,9 @@ namespace ewol {
* @brief set the shaper name (use the contructer one this permit to not noad unused shaper) * @brief set the shaper name (use the contructer one this permit to not noad unused shaper)
* @param[in] _shaperName The new shaper filename * @param[in] _shaperName The new shaper filename
*/ */
void setShaperName(const std::string& _shaperName); void setShaperName(const std::string& _shaperName) {
m_shaper.setString(_shaperName);
}
protected: protected:
ewol::object::Param<bool> m_value; //!< Current state of the button. ewol::object::Param<bool> m_value; //!< Current state of the button.
public: public:
@ -69,7 +71,9 @@ namespace ewol {
* @note Work only in toggle mode * @note Work only in toggle mode
* @param[in] _val New value of the button * @param[in] _val New value of the button
*/ */
void setValue(bool _val); void setValue(bool _val) {
m_value.set(_val);
}
/** /**
* @brief get the current button value. * @brief get the current button value.
* @return True : The button is pressed. * @return True : The button is pressed.
@ -85,7 +89,9 @@ namespace ewol {
* @brief set the button lock state. * @brief set the button lock state.
* @param[in] _lock New lock mode of the button * @param[in] _lock New lock mode of the button
*/ */
void setLock(enum buttonLock _lock); void setLock(enum buttonLock _lock) {
m_lock.set(_lock);
}
/** /**
* @brief get the current button lock value. * @brief get the current button lock value.
* @return The requested lock mode * @return The requested lock mode
@ -100,7 +106,9 @@ namespace ewol {
* @brief change the toggle mode. * @brief change the toggle mode.
* @param[in] _togg New toggle mode * @param[in] _togg New toggle mode
*/ */
void setToggleMode(bool _togg); void setToggleMode(bool _togg) {
m_toggleMode.set(_togg);
}
/** /**
* @brief get the current toggle mode. * @brief get the current toggle mode.
* @return the current toggle mode. * @return the current toggle mode.
@ -115,7 +123,9 @@ namespace ewol {
* @brief Chane the display single widget mode availlable. * @brief Chane the display single widget mode availlable.
* @param[in] _single single mode widget set * @param[in] _single single mode widget set
*/ */
void setEnableSingle(bool _single); void setEnableSingle(bool _single) {
m_enableSingle.set(_single);
}
/** /**
* @brief get the current single mode enableling. * @brief get the current single mode enableling.
* @return the current value. * @return the current value.
@ -141,10 +151,7 @@ namespace ewol {
void CheckStatus(); void CheckStatus();
protected: // Derived function protected: // Derived function
virtual void onDraw(); virtual void onDraw();
/* virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer);
virtual bool onSetConfig(const ewol::object::Config& _conf);
virtual bool onGetConfig(const char* _config, std::string& _result) const;
*/
public: // Derived function public: // Derived function
virtual void calculateMinMaxSize(); virtual void calculateMinMaxSize();
virtual void calculateSize(const vec2& _availlable); virtual void calculateSize(const vec2& _availlable);

View File

@ -63,12 +63,6 @@ ewol::widget::CheckBox::~CheckBox() {
} }
void ewol::widget::CheckBox::setShaperName(const std::string& _shaperName) {
EWOL_WARNING("set shaper name : '" << _shaperName << "'");
m_shaper->setSource(_shaperName);
markToRedraw();
}
void ewol::widget::CheckBox::calculateSize(const vec2& _availlable) { void ewol::widget::CheckBox::calculateSize(const vec2& _availlable) {
ewol::Padding padding = m_shaper->getPadding(); ewol::Padding padding = m_shaper->getPadding();
float boxSize = m_shaper->getConfigNumber(m_shaperIdSize); float boxSize = m_shaper->getConfigNumber(m_shaperIdSize);
@ -115,20 +109,6 @@ void ewol::widget::CheckBox::onRegenerateDisplay() {
vec2ClipInt32(size2-vec2(padding.x(),padding.y()) )); vec2ClipInt32(size2-vec2(padding.x(),padding.y()) ));
} }
void ewol::widget::CheckBox::setValue(bool _val) {
if (m_value != _val) {
m_value = _val;
if (m_value == false) {
m_idWidgetDisplayed = convertId(0);
} else {
m_idWidgetDisplayed = convertId(1);
}
CheckStatus();
markToRedraw();
}
m_shaper->setActivateState(m_value==true?1:0);
}
bool ewol::widget::CheckBox::onEventInput(const ewol::event::Input& _event) { bool ewol::widget::CheckBox::onEventInput(const ewol::event::Input& _event) {
EWOL_VERBOSE("Event on BT : " << _event); EWOL_VERBOSE("Event on BT : " << _event);
@ -223,35 +203,18 @@ void ewol::widget::CheckBox::periodicCall(const ewol::event::Time& _event) {
markToRedraw(); markToRedraw();
} }
/* void ewol::widget::CheckBox::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) {
bool ewol::widget::CheckBox::onSetConfig(const ewol::object::Config& _conf) { ewol::widget::Container2::onParameterChangeValue(_paramPointer);
if (true == ewol::widget::Container2::onSetConfig(_conf)) { if (_paramPointer == m_shaper) {
return true; markToRedraw();
} else if (_paramPointer == m_value) {
if (m_value == false) {
m_idWidgetDisplayed = convertId(0);
} else {
m_idWidgetDisplayed = convertId(1);
}
CheckStatus();
markToRedraw();
m_shaper->setActivateState(m_value==true?1:0);
} }
if (_conf.getConfig() == configValue) {
setValue(etk::string_to_bool(_conf.getData()));
return true;
}
if (_conf.getConfig() == configShaper) {
setShaperName(_conf.getData());
return true;
}
return false;
} }
bool ewol::widget::CheckBox::onGetConfig(const char* _config, std::string& _result) const {
if (true == ewol::widget::Container2::onGetConfig(_config, _result)) {
return true;
}
if (_config == configValue) {
_result = etk::to_string(getValue());
return true;
}
if (_config == configShaper) {
_result = m_shaper.getSource();
return true;
}
return false;
}
*/

View File

@ -53,7 +53,9 @@ namespace ewol {
* @brief set the shaper name (use the contructer one this permit to not noad unused shaper) * @brief set the shaper name (use the contructer one this permit to not noad unused shaper)
* @param[in] _shaperName The new shaper filename * @param[in] _shaperName The new shaper filename
*/ */
void setShaperName(const std::string& _shaperName); void setShaperName(const std::string& _shaperName) {
m_shaper.set(_shaperName);
}
protected: protected:
ewol::object::Param<bool> m_value; //!< Current state of the checkbox. ewol::object::Param<bool> m_value; //!< Current state of the checkbox.
public: public:
@ -61,7 +63,9 @@ namespace ewol {
* @brief set the current value of the checkbox (check or not) * @brief set the current value of the checkbox (check or not)
* @param[in] _val New value of the button * @param[in] _val New value of the button
*/ */
void setValue(bool _val); void setValue(bool _val) {
m_value.set(_val);
}
/** /**
* @brief get the current button value. * @brief get the current button value.
* @return True : The checkbox is active. * @return True : The checkbox is active.
@ -82,10 +86,7 @@ namespace ewol {
void CheckStatus(); void CheckStatus();
protected: // Derived function protected: // Derived function
virtual void onDraw(); virtual void onDraw();
/* virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer);
virtual bool onSetConfig(const ewol::object::Config& _conf);
virtual bool onGetConfig(const char* _config, std::string& _result) const;
*/
public: // Derived function public: // Derived function
virtual void calculateMinMaxSize(); virtual void calculateMinMaxSize();
virtual void calculateSize(const vec2& _availlable); virtual void calculateSize(const vec2& _availlable);

View File

@ -49,12 +49,6 @@ ewol::widget::ContextMenu::~ContextMenu() {
} }
void ewol::widget::ContextMenu::setShaperName(const std::string& _shaperName) {
m_shaper.set(_shaperName);
markToRedraw();
}
void ewol::widget::ContextMenu::calculateSize(const vec2& _availlable) { void ewol::widget::ContextMenu::calculateSize(const vec2& _availlable) {
//EWOL_DEBUG("CalculateSize=" << availlable); //EWOL_DEBUG("CalculateSize=" << availlable);
// pop-up fill all the display : // pop-up fill all the display :
@ -224,14 +218,6 @@ bool ewol::widget::ContextMenu::onEventInput(const ewol::event::Input& _event) {
return false; return false;
} }
void ewol::widget::ContextMenu::setPositionMark(enum markPosition _position, vec2 _arrowPos) {
EWOL_DEBUG("set context menu at the position : " << _arrowPos);
m_arrawBorder.set(_position);
m_arrowPos.set(_arrowPos);
markToRedraw();
}
std::shared_ptr<ewol::Widget> ewol::widget::ContextMenu::getWidgetAtPos(const vec2& _pos) { std::shared_ptr<ewol::Widget> ewol::widget::ContextMenu::getWidgetAtPos(const vec2& _pos) {
std::shared_ptr<ewol::Widget> val = ewol::widget::Container::getWidgetAtPos(_pos); std::shared_ptr<ewol::Widget> val = ewol::widget::Container::getWidgetAtPos(_pos);
if (nullptr != val) { if (nullptr != val) {
@ -240,6 +226,16 @@ std::shared_ptr<ewol::Widget> ewol::widget::ContextMenu::getWidgetAtPos(const ve
return std::dynamic_pointer_cast<ewol::Widget>(shared_from_this()); return std::dynamic_pointer_cast<ewol::Widget>(shared_from_this());
} }
void ewol::widget::ContextMenu::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) {
ewol::widget::Container::onParameterChangeValue(_paramPointer);
if (_paramPointer == m_shaper) {
markToRedraw();
} else if (_paramPointer == m_arrowPos) {
markToRedraw();
} else if (_paramPointer == m_arrawBorder) {
markToRedraw();
}
}
/* /*
bool ewol::widget::ContextMenu::onSetConfig(const ewol::object::Config& _conf) { bool ewol::widget::ContextMenu::onSetConfig(const ewol::object::Config& _conf) {
if (true == ewol::widget::Container::onSetConfig(_conf)) { if (true == ewol::widget::Container::onSetConfig(_conf)) {

View File

@ -44,25 +44,26 @@ namespace ewol {
* @brief set the shaper name (use the contructer one this permit to not noad unused shaper) * @brief set the shaper name (use the contructer one this permit to not noad unused shaper)
* @param[in] _shaperName The new shaper filename * @param[in] _shaperName The new shaper filename
*/ */
void setShaperName(const std::string& _shaperName); void setShaperName(const std::string& _shaperName) {
m_shaper.set(_shaperName);
}
private: private:
// TODO : Rework the displayer .... // TODO : Rework the displayer ....
ewol::compositing::Drawing m_compositing; ewol::compositing::Drawing m_compositing;
etk::Color<> m_colorBackGroung; etk::Color<> m_colorBackGroung;
etk::Color<> m_colorBorder; etk::Color<> m_colorBorder;
float m_offset; float m_offset;
private: private:
ewol::object::Param<vec2> m_arrowPos; ewol::object::Param<vec2> m_arrowPos;
ewol::object::ParamList<enum markPosition> m_arrawBorder; ewol::object::ParamList<enum markPosition> m_arrawBorder;
public: public:
void setPositionMark(enum markPosition position, vec2 arrowPos); void setPositionMark(enum markPosition _position, const vec2& _arrowPos) {
m_arrawBorder.set(_position);
m_arrowPos.set(_arrowPos);
}
protected: // Derived function protected: // Derived function
virtual void onDraw(); virtual void onDraw();
/* virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer);
virtual bool onSetConfig(const ewol::object::Config& _conf);
virtual bool onGetConfig(const char* _config, std::string& _result) const;
*/
public: // Derived function public: // Derived function
virtual void onRegenerateDisplay(); virtual void onRegenerateDisplay();
virtual bool onEventInput(const ewol::event::Input& _event); virtual bool onEventInput(const ewol::event::Input& _event);

View File

@ -36,7 +36,7 @@ const char * const ewol::widget::Entry::eventModify = "modify";
ewol::widget::Entry::Entry() : ewol::widget::Entry::Entry() :
m_shaper(*this, "shaper", "Shaper to display the background"), m_shaper(*this, "shaper", "Shaper to display the background"),
m_data(*this, "value", "", "Value display in the entry (decorated text)"), m_data(*this, "value", "", "Value display in the entry (decorated text)"),
m_maxCharacter(*this, "max", 0x7FFFFFFF, "Maximum cgar that can be set on the Entry"), m_maxCharacter(*this, "max", 0x7FFFFFFF, 0, 0x7FFFFFFF, "Maximum cgar that can be set on the Entry"),
m_regExp(*this, "regExp", "Control what it is write with a regular expression"), m_regExp(*this, "regExp", "Control what it is write with a regular expression"),
m_needUpdateTextPos(true), m_needUpdateTextPos(true),
m_displayStartPosition(0), m_displayStartPosition(0),
@ -64,10 +64,6 @@ void ewol::widget::Entry::init(const std::string& _newData) {
ewol::Widget::init(); ewol::Widget::init();
m_data.set(_newData); m_data.set(_newData);
m_shaper.setString("THEME:GUI:Entry.json"); m_shaper.setString("THEME:GUI:Entry.json");
m_colorIdTextFg = m_shaper->requestColor("text-foreground");
m_colorIdTextBg = m_shaper->requestColor("text-background");
m_colorIdCursor = m_shaper->requestColor("text-cursor");
m_colorIdSelection = m_shaper->requestColor("text-selection");
} }
@ -75,16 +71,6 @@ ewol::widget::Entry::~Entry() {
} }
void ewol::widget::Entry::setMaxChar(int32_t _nbMax) {
if (_nbMax <= 0) {
m_maxCharacter = 0x7FFFFFFF;
} else {
m_maxCharacter = _nbMax;
}
}
void ewol::widget::Entry::calculateMinMaxSize() { void ewol::widget::Entry::calculateMinMaxSize() {
// call main class // call main class
ewol::Widget::calculateMinMaxSize(); ewol::Widget::calculateMinMaxSize();
@ -99,7 +85,7 @@ void ewol::widget::Entry::calculateMinMaxSize() {
checkMinSize(); checkMinSize();
} }
// TODO : ... Set it a a generic parameter...
void ewol::widget::Entry::setValue(const std::string& _newData) { void ewol::widget::Entry::setValue(const std::string& _newData) {
std::string newData = _newData; std::string newData = _newData;
if ((int64_t)newData.size() > m_maxCharacter) { if ((int64_t)newData.size() > m_maxCharacter) {
@ -555,67 +541,27 @@ void ewol::widget::Entry::periodicCall(const ewol::event::Time& _event) {
markToRedraw(); markToRedraw();
} }
void ewol::widget::Entry::setRegExp(const std::string& _expression) { void ewol::widget::Entry::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) {
std::string previousRegExp = m_regExp->getRegExp(); ewol::Widget::onParameterChangeValue(_paramPointer);
EWOL_DEBUG("change input regExp \"" << previousRegExp << "\" == > \"" << _expression << "\""); if (_paramPointer == m_shaper) {
m_regExp->compile(_expression); m_colorIdTextFg = m_shaper->requestColor("text-foreground");
if (m_regExp->getStatus() == false) { m_colorIdTextBg = m_shaper->requestColor("text-background");
EWOL_ERROR("error when adding regExp ... == > set the previous back ..."); m_colorIdCursor = m_shaper->requestColor("text-cursor");
m_regExp->compile(previousRegExp); m_colorIdSelection = m_shaper->requestColor("text-selection");
} else if (_paramPointer == m_data) {
// to late to update data ... with control.
markToRedraw();
} else if (_paramPointer == m_maxCharacter) {
// nothing to do ...
} else if (_paramPointer == m_regExp) {
if (m_regExp->getStatus() == false) {
EWOL_ERROR("error when adding regExp ... == > set the '\".*\"' ...");
m_regExp->compile(".*");
}
markToRedraw();
} else if (_paramPointer == m_textWhenNothing) {
markToRedraw();
} }
} }
void ewol::widget::Entry::setEmptyText(const std::string& _text) {
m_textWhenNothing = _text;
markToRedraw();
}
/*
bool ewol::widget::Entry::onSetConfig(const ewol::object::Config& _conf) {
if (true == ewol::Widget::onSetConfig(_conf)) {
return true;
}
if (_conf.getConfig() == configMaxChar) {
setMaxChar(stoi(_conf.getData()));
return true;
}
if (_conf.getConfig() == configRegExp) {
setRegExp(_conf.getData());
return true;
}
if (_conf.getConfig() == configEmptyMessage) {
setEmptyText(_conf.getData());
return true;
}
if (_conf.getConfig() == configValue) {
setValue(_conf.getData());
return true;
}
return false;
}
bool ewol::widget::Entry::onGetConfig(const char* _config, std::string& _result) const {
if (true == ewol::Widget::onGetConfig(_config, _result)) {
return true;
}
if (_config == configMaxChar) {
_result = etk::to_string(getMaxChar());
return true;
}
if (_config == configRegExp) {
_result = getRegExp();
return true;
}
if (_config == configEmptyMessage) {
_result = getEmptyText();
return true;
}
if (_config == configValue) {
_result = getValue();
return true;
}
return false;
}
*/

View File

@ -57,7 +57,6 @@ namespace ewol {
* @brief Destuctor * @brief Destuctor
*/ */
virtual ~Entry(); virtual ~Entry();
private: private:
ewol::object::Param<std::string> m_data; //!< sting that must be displayed ewol::object::Param<std::string> m_data; //!< sting that must be displayed
protected: protected:
@ -79,15 +78,16 @@ namespace ewol {
std::string getValue() const { std::string getValue() const {
return m_data; return m_data;
}; };
private: private:
ewol::object::Param<int32_t> m_maxCharacter; //!< number max of xharacter in the list ewol::object::ParamRange<int32_t> m_maxCharacter; //!< number max of xharacter in the list
public: public:
/** /**
* @brief Limit the number of Unicode character in the entry * @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) * @param[in] _nbMax Number of max character set in the List (0x7FFFFFFF for no limit)
*/ */
void setMaxChar(int32_t _nbMax); void setMaxChar(int32_t _nbMax) {
m_maxCharacter.set(_nbMax);
}
/** /**
* @brief Limit the number of Unicode character in the entry * @brief Limit the number of Unicode character in the entry
* @return Number of max character set in the List. * @return Number of max character set in the List.
@ -102,7 +102,9 @@ namespace ewol {
* @brief Limit the input entry at a regular expression... (by default it is "*") * @brief Limit the input entry at a regular expression... (by default it is "*")
* @param _expression New regular expression * @param _expression New regular expression
*/ */
void setRegExp(const std::string& _expression); void setRegExp(const std::string& _expression) {
m_regExp.setString(_expression);
}
/** /**
* @brief get the regualar expression limitation * @brief get the regualar expression limitation
* @param The regExp string * @param The regExp string
@ -132,7 +134,6 @@ namespace ewol {
* @note The display is automaticly requested when change apear. * @note The display is automaticly requested when change apear.
*/ */
virtual void updateCursorPosition(const vec2& _pos, bool _Selection=false); virtual void updateCursorPosition(const vec2& _pos, bool _Selection=false);
public: public:
/** /**
* @brief Copy the selected data on the specify clipboard * @brief Copy the selected data on the specify clipboard
@ -151,7 +152,9 @@ namespace ewol {
* @brief set The text displayed when nothing is in the entry. * @brief set The text displayed when nothing is in the entry.
* @param _text Text to display when the entry box is empty (this text can be decorated). * @param _text Text to display when the entry box is empty (this text can be decorated).
*/ */
void setEmptyText(const std::string& _text); void setEmptyText(const std::string& _text) {
m_textWhenNothing.set(_text);
}
/** /**
* @brief get The text displayed when nothing is in the entry. * @brief get The text displayed when nothing is in the entry.
* @return Text display when nothing * @return Text display when nothing
@ -172,10 +175,7 @@ namespace ewol {
virtual void onLostFocus(); virtual void onLostFocus();
virtual void changeStatusIn(int32_t _newStatusId); virtual void changeStatusIn(int32_t _newStatusId);
virtual void periodicCall(const ewol::event::Time& _event); virtual void periodicCall(const ewol::event::Time& _event);
/* virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer);
virtual bool onSetConfig(const ewol::object::Config& _conf);
virtual bool onGetConfig(const char* _config, std::string& _result) const;
*/
}; };
}; };
}; };

View File

@ -46,78 +46,10 @@ ewol::widget::Image::~Image() {
} }
void ewol::widget::Image::setFile(const std::string& _file) {
EWOL_VERBOSE("Set Image : " << _file);
if (m_fileName.get() != _file) {
// copy data :
m_fileName.set(_file);
// force redraw all :
markToRedraw();
EWOL_VERBOSE("Set sources : " << m_fileName << " size=" << m_imageSize);
m_compositing.setSource(m_fileName, m_imageSize->getPixel());
}
}
void ewol::widget::Image::setBorder(const ewol::Dimension& _border) {
EWOL_VERBOSE("Set border=" << _border);
// copy data :
m_border.set(_border);
// force redraw all :
markToRedraw();
// TODO : change the size with no size requested ...
requestUpdateSize();
}
void ewol::widget::Image::setKeepRatio(bool _keep) {
if (m_keepRatio.get() == _keep) {
return;
}
// copy data :
m_keepRatio.set(_keep);
// force redraw all :
markToRedraw();
requestUpdateSize();
}
void ewol::widget::Image::setStartPos(const vec2& _pos) {
if (m_posStart.get() == _pos) {
return;
}
// copy data :
m_posStart.set(_pos);
// force redraw all :
markToRedraw();
requestUpdateSize();
}
void ewol::widget::Image::setStopPos(const vec2& _pos) {
// copy data :
m_posStop.set(_pos);
// force redraw all :
markToRedraw();
requestUpdateSize();
}
void ewol::widget::Image::setImageSize(const ewol::Dimension& _size) {
EWOL_VERBOSE("Set Image size : " << _size);
if (_size != m_imageSize.get()) {
m_imageSize.set(_size);
markToRedraw();
requestUpdateSize();
EWOL_VERBOSE("Set sources : " << m_fileName << " size=" << m_imageSize);
m_compositing.setSource(m_fileName, m_imageSize->getPixel());
}
}
void ewol::widget::Image::set(const std::string& _file, const ewol::Dimension& _border) { void ewol::widget::Image::set(const std::string& _file, const ewol::Dimension& _border) {
EWOL_VERBOSE("Set Image : " << _file << " border=" << _border); EWOL_VERBOSE("Set Image : " << _file << " border=" << _border);
// copy data : m_border.set(_border);
if (m_border.get() != _border) { m_fileName.set(_file);
m_border.set(_border);
requestUpdateSize();
markToRedraw();
}
setFile(_file);
} }
void ewol::widget::Image::onDraw() { void ewol::widget::Image::onDraw() {
@ -249,75 +181,21 @@ bool ewol::widget::Image::loadXML(exml::Element* _node) {
return true; return true;
} }
/* void ewol::widget::Image::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) {
bool ewol::widget::Image::onSetConfig(const ewol::object::Config& _conf) { ewol::Widget::onParameterChangeValue(_paramPointer);
if (true == ewol::Widget::onSetConfig(_conf)) { if ( _paramPointer == m_fileName
return true; || _paramPointer == m_imageSize) {
markToRedraw();
requestUpdateSize();
EWOL_VERBOSE("Set sources : " << m_fileName << " size=" << m_imageSize);
m_compositing.setSource(m_fileName, m_imageSize->getPixel());
} else if ( _paramPointer == m_border
|| _paramPointer == m_keepRatio
|| _paramPointer == m_posStart
|| _paramPointer == m_posStop) {
markToRedraw();
requestUpdateSize();
} else if (_paramPointer == m_distanceFieldMode) {
markToRedraw();
} }
if (_conf.getConfig() == configRatio) {
setKeepRatio(etk::string_to_bool(_conf.getData()));
return true;
}
if (_conf.getConfig() == configSize) {
setImageSize(_conf.getData());
return true;
}
if (_conf.getConfig() == configBorder) {
setBorder(_conf.getData());
return true;
}
if (_conf.getConfig() == configSource) {
setFile(_conf.getData());
return true;
}
if (_conf.getConfig() == configDistanceField) {
setDistanceField(etk::string_to_bool(_conf.getData()));
return true;
}
if (_conf.getConfig() == configPartStart) {
setStartPos(vec2(_conf.getData()));
return true;
}
if (_conf.getConfig() == configPartStop) {
setStopPos(vec2(_conf.getData()));
return true;
}
return false;
} }
bool ewol::widget::Image::onGetConfig(const char* _config, std::string& _result) const {
if (true == ewol::Widget::onGetConfig(_config, _result)) {
return true;
}
if (_config == configRatio) {
_result = etk::to_string(getKeepRatio());
return true;
}
if (_config == configSize) {
_result = getImageSize();
return true;
}
if (_config == configBorder) {
_result = getBorder();
return true;
}
if (_config == configSource) {
_result = getFile();
return true;
}
if (_config == configDistanceField) {
_result = etk::to_string(getDistanceField());
return true;
}
if (_config == configPartStart) {
_result = (std::string)getStartPos();
return true;
}
if (_config == configPartStop) {
_result = (std::string)getStopPos();
return true;
}
return false;
}
*/

View File

@ -56,7 +56,9 @@ namespace ewol {
* @brief set the new filename * @brief set the new filename
* @param[in] _file Filaneme of the new image * @param[in] _file Filaneme of the new image
*/ */
void setFile(const std::string& _file); void setFile(const std::string& _file) {
m_fileName.set(_file);
}
/** /**
* @brief get the file displayed * @brief get the file displayed
* @return the filename of the image * @return the filename of the image
@ -158,10 +160,7 @@ namespace ewol {
} }
protected: // Derived function protected: // Derived function
virtual void onDraw(); virtual void onDraw();
/* virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer);
virtual bool onSetConfig(const ewol::object::Config& _conf);
virtual bool onGetConfig(const char* _config, std::string& _result) const;
*/
public: // Derived function public: // Derived function
virtual void calculateMinMaxSize(); virtual void calculateMinMaxSize();
virtual void onRegenerateDisplay(); virtual void onRegenerateDisplay();

View File

@ -59,16 +59,6 @@ void ewol::widget::Label::calculateMinMaxSize() {
EWOL_VERBOSE("[" << getId() << "] {" << getObjectType() << "} Result min size : " << tmpMin << " < " << m_minSize << " < " << tmpMax); EWOL_VERBOSE("[" << getId() << "] {" << getObjectType() << "} Result min size : " << tmpMin << " < " << m_minSize << " < " << tmpMax);
} }
void ewol::widget::Label::setLabel(const std::string& _newLabel) {
m_label.setString(_newLabel);
markToRedraw();
requestUpdateSize();
}
std::string ewol::widget::Label::getLabel() const {
return etk::to_string(m_label.get());
}
void ewol::widget::Label::onDraw() { void ewol::widget::Label::onDraw() {
m_text.draw(); m_text.draw();
} }
@ -154,27 +144,11 @@ bool ewol::widget::Label::loadXML(exml::Element* _node) {
return true; return true;
} }
/* void ewol::widget::Label::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) {
bool ewol::widget::Label::onSetConfig(const ewol::object::Config& _conf) { ewol::Widget::onParameterChangeValue(_paramPointer);
if (true == ewol::Widget::onSetConfig(_conf)) { if (_paramPointer == m_label) {
return true; markToRedraw();
requestUpdateSize();
} }
if (_conf.getConfig() == configValue) {
setLabel(_conf.getData());
return true;
}
return false;
} }
bool ewol::widget::Label::onGetConfig(const char* _config, std::string& _result) const {
if (true == ewol::Widget::onGetConfig(_config, _result)) {
return true;
}
if (_config == configValue) {
_result = getLabel();
return true;
}
return false;
}
*/

View File

@ -48,26 +48,27 @@ namespace ewol {
* @brief change the label displayed * @brief change the label displayed
* @param[in] _newLabel The displayed decorated text. * @param[in] _newLabel The displayed decorated text.
*/ */
void setLabel(const std::string& _newLabel); void setLabel(const std::string& _newLabel) {
m_label.set(etk::to_u32string(_newLabel));
}
//! @previous //! @previous
inline void setValue(const std::string& _newLabel) { inline void setValue(const std::string& _newLabel) {
setLabel(_newLabel); m_label.set(etk::to_u32string(_newLabel));
}; };
/** /**
* @brief get the current displayed label * @brief get the current displayed label
* @return The displayed decorated text. * @return The displayed decorated text.
*/ */
std::string getLabel() const; std::string getLabel() const {
return etk::to_string(m_label);
}
//! @previous //! @previous
inline std::string getValue() const { inline std::string getValue() const {
return getLabel(); return etk::to_string(m_label);
}; };
protected: // Derived function protected: // Derived function
virtual void onDraw(); virtual void onDraw();
/* virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer);
virtual bool onSetConfig(const ewol::object::Config& _conf);
virtual bool onGetConfig(const char* _config, std::string& _result) const;
*/
public: // Derived function public: // Derived function
virtual void calculateMinMaxSize(); virtual void calculateMinMaxSize();
virtual void onRegenerateDisplay(); virtual void onRegenerateDisplay();

View File

@ -247,67 +247,20 @@ bool ewol::widget::ListFileSystem::onItemEvent(int32_t _IdInput,
return false; return false;
} }
/* void ewol::widget::ListFileSystem::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) {
bool ewol::widget::ListFileSystem::onSetConfig(const ewol::object::Config& _conf) { ewol::widget::List::onParameterChangeValue(_paramPointer);
if (true == ewol::widget::List::onSetConfig(_conf)) { if (_paramPointer == m_folder) {
return true; regenerateView();
} else if (_paramPointer == m_selectFile) {
setSelect(m_selectFile);
} else if (_paramPointer == m_showFile) {
regenerateView();
} else if (_paramPointer == m_showFolder) {
regenerateView();
} else if (_paramPointer == m_showHidden) {
regenerateView();
} else if (_paramPointer == m_showTemporaryFile) {
regenerateView();
} }
if (_conf.getConfig() == configShowHidden) {
setShowHidden(etk::string_to_bool(_conf.getData()));
return true;
}
if (_conf.getConfig() == configShowFile) {
setShowFiles(etk::string_to_bool(_conf.getData()));
return true;
}
if (_conf.getConfig() == configShowFolder) {
setShowFolder(etk::string_to_bool(_conf.getData()));
return true;
}
if (_conf.getConfig() == configShowTemporary) {
setShowTemporaryFiles(etk::string_to_bool(_conf.getData()));
return true;
}
if (_conf.getConfig() == configPath) {
setFolder(_conf.getData());
return true;
}
if (_conf.getConfig() == configSelect) {
setSelect(_conf.getData());
return true;
}
return false;
} }
bool ewol::widget::ListFileSystem::onGetConfig(const char* _config, std::string& _result) const {
if (true == ewol::widget::List::onGetConfig(_config, _result)) {
return true;
}
if (_config == configShowHidden) {
_result = etk::to_string(getShowHidden());
return true;
}
if (_config == configShowFile) {
_result = etk::to_string(getShowFiles());
return true;
}
if (_config == configShowFolder) {
_result = etk::to_string(getShowFolder());
return true;
}
if (_config == configShowTemporary) {
_result = etk::to_string(getShowTemporaryFiles());
return true;
}
if (_config == configPath) {
_result = getFolder();
return true;
}
if (_config == configSelect) {
_result = getSelect();
return true;
}
return false;
}
*/

View File

@ -69,15 +69,14 @@ namespace ewol {
std::string getSelect() const ; std::string getSelect() const ;
protected: protected:
ewol::object::Param<std::string> m_folder; //!< Current folder that display point on. ewol::object::Param<std::string> m_folder; //!< Current folder that display point on.
ewol::object::Param<std::string> m_selectFile; //!< current selected file ewol::object::Param<std::string, true> m_selectFile; //!< current selected file
public: public:
/** /**
* @brief Set a folder to display (might be a valid folder !!!) * @brief Set a folder to display (might be a valid folder !!!)
* @param[in] _newFolder Path on the folder to display content. * @param[in] _newFolder Path on the folder to display content.
*/ */
void setFolder(const std::string& _newFolder) { void setFolder(const std::string& _newFolder) {
m_folder = _newFolder; m_folder.set(_newFolder);
regenerateView();
}; };
/** /**
* @brief Get the element current displaying folder path. * @brief Get the element current displaying folder path.
@ -94,8 +93,7 @@ namespace ewol {
* @param[in] _state New state to apply on display the 'file'. * @param[in] _state New state to apply on display the 'file'.
*/ */
void setShowFiles(bool _state) { void setShowFiles(bool _state) {
m_showFile = _state; m_showFile.set(_state);
regenerateView();
}; };
/** /**
* @brief Get the status of the displaying files or Not. * @brief Get the status of the displaying files or Not.
@ -112,8 +110,7 @@ namespace ewol {
* @param[in] _state New state to apply on display the 'folder'. * @param[in] _state New state to apply on display the 'folder'.
*/ */
void setShowFolder(bool _state) { void setShowFolder(bool _state) {
m_showFolder = _state; m_showFolder.set(_state);
regenerateView();
}; };
/** /**
* @brief Get the status of the displaying fodlers or Not. * @brief Get the status of the displaying fodlers or Not.
@ -130,8 +127,7 @@ namespace ewol {
* @param[in] _state New state to apply on display the hidden element. * @param[in] _state New state to apply on display the hidden element.
*/ */
void setShowHidden(bool _state) { void setShowHidden(bool _state) {
m_showHidden = _state; m_showHidden.set(_state);
regenerateView();
}; };
/** /**
* @brief Get the status of the displaying hidden files or folder or Not. * @brief Get the status of the displaying hidden files or folder or Not.
@ -148,8 +144,7 @@ namespace ewol {
* @param[in] _state New state to apply on display temporary files. * @param[in] _state New state to apply on display temporary files.
*/ */
void setShowTemporaryFiles(bool _state) { void setShowTemporaryFiles(bool _state) {
m_showTemporaryFile = _state; m_showTemporaryFile.set(_state);
regenerateView();
}; };
/** /**
* @brief Get the status of the displaying temporary file (xxx~, xxx.bck, xxx.pyc) or Not. * @brief Get the status of the displaying temporary file (xxx~, xxx.bck, xxx.pyc) or Not.
@ -158,11 +153,8 @@ namespace ewol {
bool getShowTemporaryFiles() const { bool getShowTemporaryFiles() const {
return m_showFile; return m_showFile;
}; };
/*
public: // glocal derived functions public: // glocal derived functions
virtual bool onSetConfig(const ewol::object::Config& _conf); virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer);
virtual bool onGetConfig(const char* _config, std::string& _result) const;
*/
}; };
}; };
}; };

View File

@ -36,13 +36,6 @@ ewol::widget::PopUp::~PopUp() {
} }
void ewol::widget::PopUp::lockExpand(const bvec2& _lockExpand) {
if (_lockExpand != m_lockExpand) {
m_lockExpand = _lockExpand;
markToRedraw();
requestUpdateSize();
}
}
void ewol::widget::PopUp::setShaperName(const std::string& _shaperName) { void ewol::widget::PopUp::setShaperName(const std::string& _shaperName) {
m_shaper.setString(_shaperName); m_shaper.setString(_shaperName);
@ -141,46 +134,19 @@ std::shared_ptr<ewol::Widget> ewol::widget::PopUp::getWidgetAtPos(const vec2& _p
return std::dynamic_pointer_cast<ewol::Widget>(shared_from_this()); return std::dynamic_pointer_cast<ewol::Widget>(shared_from_this());
} }
/* void ewol::widget::PopUp::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) {
bool ewol::widget::PopUp::onSetConfig(const ewol::object::Config& _conf) { ewol::widget::Container::onParameterChangeValue(_paramPointer);
if (true == ewol::widget::Container::onSetConfig(_conf)) { if (_paramPointer == m_shaper) {
return true; markToRedraw();
requestUpdateSize();
} else if (_paramPointer == m_lockExpand) {
markToRedraw();
requestUpdateSize();
} else if (_paramPointer == m_closeOutEvent) {
// nothing to do ...
} }
if (_conf.getConfig() == configShaper) {
setShaperName(_conf.getData());
return true;
}
if (_conf.getConfig() == configRemoveOnExternClick) {
setRemoveOnExternClick(etk::string_to_bool(_conf.getData()));
return true;
}
if (_conf.getConfig() == configLockExpand) {
lockExpand(_conf.getData());
return true;
}
return false;
} }
bool ewol::widget::PopUp::onGetConfig(const char* _config, std::string& _result) const {
if (true == ewol::widget::Container::onGetConfig(_config, _result)) {
return true;
}
if (_config == configShaper) {
_result = m_shaper.getSource();
return true;
}
if (_config == configLockExpand) {
_result = m_lockExpand;
return true;
}
if (_config == configRemoveOnExternClick) {
_result = etk::to_string(getRemoveOnExternClick());
return true;
}
return false;
}
*/
bool ewol::widget::PopUp::onEventInput(const ewol::event::Input& _event) { bool ewol::widget::PopUp::onEventInput(const ewol::event::Input& _event) {
if (0 != _event.getId()) { if (0 != _event.getId()) {
if (true == m_closeOutEvent) { if (true == m_closeOutEvent) {

View File

@ -50,7 +50,9 @@ namespace ewol {
* @brief Limit the expend properties to the current widget (no contamination) * @brief Limit the expend properties to the current widget (no contamination)
* @param[in] _lockExpend Lock mode of the expend properties * @param[in] _lockExpend Lock mode of the expend properties
*/ */
void lockExpand(const bvec2& _lockExpand); void lockExpand(const bvec2& _lockExpand) {
m_lockExpand.set(_lockExpand);
}
private: private:
ewol::object::Param<bool> m_closeOutEvent; //!< ratio progression of a sliding ewol::object::Param<bool> m_closeOutEvent; //!< ratio progression of a sliding
public: public:
@ -59,7 +61,7 @@ namespace ewol {
* @param[in] _state New status * @param[in] _state New status
*/ */
void setRemoveOnExternClick(bool _state) { void setRemoveOnExternClick(bool _state) {
m_closeOutEvent = _state; m_closeOutEvent.set(_state);
}; };
/** /**
* @brief get the status of the request the Auto-remove when the event input is set outside the widget. * @brief get the status of the request the Auto-remove when the event input is set outside the widget.
@ -70,10 +72,7 @@ namespace ewol {
}; };
protected: // Derived function protected: // Derived function
virtual void onDraw(); virtual void onDraw();
/* virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer);
virtual bool onSetConfig(const ewol::object::Config& _conf);
virtual bool onGetConfig(const char* _config, std::string& _result) const;
*/
public: // Derived function public: // Derived function
virtual void periodicCall(const ewol::event::Time& _event); virtual void periodicCall(const ewol::event::Time& _event);
virtual void systemDraw(const ewol::DrawProperty& _displayProp); virtual void systemDraw(const ewol::DrawProperty& _displayProp);

View File

@ -73,59 +73,17 @@ void ewol::widget::ProgressBar::onRegenerateDisplay() {
} }
} }
void ewol::widget::ProgressBar::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) {
/* ewol::Widget::onParameterChangeValue(_paramPointer);
if (_paramPointer == m_value) {
bool ewol::widget::ProgressBar::onSetConfig(const ewol::object::Config& _conf) {
if (true == ewol::Widget::onSetConfig(_conf)) {
return true;
}
if (_conf.getConfig() == configColorBg) {
m_textColorFg = _conf.getData();
markToRedraw(); markToRedraw();
return true; } else if (_paramPointer == m_textColorFg) {
}
if (_conf.getConfig() == configColorFgOn) {
m_textColorBgOn = _conf.getData();
markToRedraw(); markToRedraw();
return true; } else if (_paramPointer == m_textColorBgOn) {
}
if (_conf.getConfig() == configColorFgOff) {
m_textColorBgOff = _conf.getData();
markToRedraw(); markToRedraw();
return true; } else if (_paramPointer == m_textColorBgOff) {
}
if (_conf.getConfig() == configValue) {
m_value = stof(_conf.getData());
markToRedraw(); markToRedraw();
return true;
} }
return false;
} }
bool ewol::widget::ProgressBar::onGetConfig(const char* _config, std::string& _result) const {
if (true == ewol::Widget::onGetConfig(_config, _result)) {
return true;
}
if (_config == configColorBg) {
_result = m_textColorFg.getString();
return true;
}
if (_config == configColorFgOn) {
_result = m_textColorBgOn.getString();
return true;
}
if (_config == configColorFgOff) {
_result = m_textColorBgOff.getString();
return true;
}
if (_config == configValue) {
_result = m_value;
return true;
}
return false;
}
*/

View File

@ -44,10 +44,7 @@ namespace ewol {
ewol::object::Param<etk::Color<>> m_textColorBgOff; //!< bar color disable ewol::object::Param<etk::Color<>> m_textColorBgOff; //!< bar color disable
protected: // Derived function protected: // Derived function
virtual void onDraw(); virtual void onDraw();
/* virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer);
virtual bool onSetConfig(const ewol::object::Config& _conf);
virtual bool onGetConfig(const char* _config, std::string& _result) const;
*/
public: // Derived function public: // Derived function
virtual void onRegenerateDisplay(); virtual void onRegenerateDisplay();
virtual void calculateMinMaxSize(); virtual void calculateMinMaxSize();

View File

@ -350,6 +350,12 @@ std::shared_ptr<ewol::Widget> ewol::widget::Scroll::getWidgetAtPos(const vec2& _
} }
return std::dynamic_pointer_cast<ewol::Widget>(shared_from_this());; return std::dynamic_pointer_cast<ewol::Widget>(shared_from_this());;
} }
void ewol::widget::Scroll::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) {
ewol::widget::Container::onParameterChangeValue(_paramPointer);
if (_paramPointer == m_limit) {
}
}
/* /*
bool ewol::widget::Scroll::onSetConfig(const ewol::object::Config& _conf) { bool ewol::widget::Scroll::onSetConfig(const ewol::object::Config& _conf) {
if (true == ewol::widget::Container::onSetConfig(_conf)) { if (true == ewol::widget::Container::onSetConfig(_conf)) {

View File

@ -68,10 +68,7 @@ namespace ewol {
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos); virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos);
protected: // Derived function protected: // Derived function
virtual void onDraw(); virtual void onDraw();
/* virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer);
virtual bool onSetConfig(const ewol::object::Config& _conf);
virtual bool onGetConfig(const char* _config, std::string& _result) const;
*/
}; };
}; };
}; };

View File

@ -36,18 +36,6 @@ ewol::widget::Sizer::~Sizer() {
} }
void ewol::widget::Sizer::setBorderSize(const ewol::Dimension& _newBorderSize) {
m_borderSize.set(_newBorderSize);
markToRedraw();
requestUpdateSize();
}
void ewol::widget::Sizer::setMode(enum displayMode _mode) {
m_mode.set(_mode);
markToRedraw();
requestUpdateSize();
}
void ewol::widget::Sizer::calculateSize(const vec2& _availlable) { void ewol::widget::Sizer::calculateSize(const vec2& _availlable) {
ewol::Widget::calculateSize(_availlable); ewol::Widget::calculateSize(_availlable);
vec2 tmpBorderSize = m_borderSize->getPixel(); vec2 tmpBorderSize = m_borderSize->getPixel();
@ -189,43 +177,14 @@ void ewol::widget::Sizer::subWidgetUnLink(std::shared_ptr<ewol::Widget> _newWidg
// TODO : ... // TODO : ...
ewol::widget::ContainerN::subWidgetUnLink(_newWidget); ewol::widget::ContainerN::subWidgetUnLink(_newWidget);
} }
/*
bool ewol::widget::Sizer::onSetConfig(const ewol::object::Config& _conf) {
if (true == ewol::widget::ContainerN::onSetConfig(_conf)) {
return true;
}
if (_conf.getConfig() == configBorder) {
setBorderSize(_conf.getData());
return true;
}
if (_conf.getConfig() == configMode) {
if (_conf.getData() == "vert") {
setMode(modeVert);
} else {
setMode(modeHori);
}
return true;
}
return false;
}
bool ewol::widget::Sizer::onGetConfig(const char* _config, std::string& _result) const { void ewol::widget::Sizer::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) {
if (true == ewol::widget::ContainerN::onGetConfig(_config, _result)) { ewol::widget::ContainerN::onParameterChangeValue(_paramPointer);
return true; if (_paramPointer == m_mode) {
markToRedraw();
requestUpdateSize();
} else if (_paramPointer == m_borderSize) {
markToRedraw();
requestUpdateSize();
} }
if (_config == configBorder) { }
_result = (std::string)getBorderSize();
return true;
}
if (_config == configMode) {
if (getMode() == modeVert) {
_result = "vert";
} else {
_result = "hori";
}
return true;
}
return false;
}
*/

View File

@ -49,7 +49,9 @@ namespace ewol {
* @brief set the mode to display elements. * @brief set the mode to display elements.
* @param[in] _mode The mode to display the elements. * @param[in] _mode The mode to display the elements.
*/ */
void setMode(enum displayMode _mode); void setMode(enum displayMode _mode) {
m_mode.set(_mode);
}
/** /**
* @brief get the mode to display elements. * @brief get the mode to display elements.
* @return The current mode to display the elements. * @return The current mode to display the elements.
@ -64,7 +66,9 @@ namespace ewol {
* @brief set the current border size of the current element: * @brief set the current border size of the current element:
* @param[in] _newBorderSize The border size to set (0 if not used) * @param[in] _newBorderSize The border size to set (0 if not used)
*/ */
void setBorderSize(const ewol::Dimension& _newBorderSize); void setBorderSize(const ewol::Dimension& _newBorderSize) {
m_borderSize.set(_newBorderSize);
}
/** /**
* @brief get the current border size of the current element: * @brief get the current border size of the current element:
* @return the border size (0 if not used) * @return the border size (0 if not used)
@ -123,10 +127,7 @@ namespace ewol {
virtual int32_t subWidgetAddStart(std::shared_ptr<ewol::Widget> _newWidget); virtual int32_t subWidgetAddStart(std::shared_ptr<ewol::Widget> _newWidget);
virtual void subWidgetRemove(std::shared_ptr<ewol::Widget> _newWidget); virtual void subWidgetRemove(std::shared_ptr<ewol::Widget> _newWidget);
virtual void subWidgetUnLink(std::shared_ptr<ewol::Widget> _newWidget); virtual void subWidgetUnLink(std::shared_ptr<ewol::Widget> _newWidget);
/* virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer);
virtual bool onSetConfig(const ewol::object::Config& _conf);
virtual bool onGetConfig(const char* _config, std::string& _result) const;
*/
}; };
}; };
}; };

View File

@ -47,28 +47,11 @@ void ewol::widget::Spacer::onRegenerateDisplay() {
m_draw.setPos(vec3(0, 0, 0) ); m_draw.setPos(vec3(0, 0, 0) );
m_draw.rectangleWidth(vec3(m_size.x(), m_size.y(),0) ); m_draw.rectangleWidth(vec3(m_size.x(), m_size.y(),0) );
} }
/*
bool ewol::widget::Spacer::onSetConfig(const ewol::object::Config& _conf) { void ewol::widget::Spacer::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) {
if (true == ewol::Widget::onSetConfig(_conf)) { ewol::Widget::onParameterChangeValue(_paramPointer);
return true; if (_paramPointer == m_color) {
}
if (_conf.getConfig() == configColor) {
m_color = _conf.getData();
markToRedraw(); markToRedraw();
return true;
} }
return false;
} }
bool ewol::widget::Spacer::onGetConfig(const char* _config, std::string& _result) const {
if (true == ewol::Widget::onGetConfig(_config, _result)) {
return true;
}
if (_config == configColor) {
_result = m_color.getString();
return true;
}
return false;
}
*/

View File

@ -51,10 +51,7 @@ namespace ewol {
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos) { return nullptr; }; virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos) { return nullptr; };
virtual void onRegenerateDisplay(); virtual void onRegenerateDisplay();
virtual void onDraw(); virtual void onDraw();
/* virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer);
virtual bool onSetConfig(const ewol::object::Config& _conf);
virtual bool onGetConfig(const char* _config, std::string& _result) const;
*/
}; };
}; };
}; };

View File

@ -26,10 +26,6 @@ std::ostream& operator <<(std::ostream& _os, const enum ewol::widget::WSlider::s
// Event list of properties // Event list of properties
const char* const ewol::widget::WSlider::eventStartSlide = "ewol-widget-wslider-event-start-slide"; const char* const ewol::widget::WSlider::eventStartSlide = "ewol-widget-wslider-event-start-slide";
const char* const ewol::widget::WSlider::eventStopSlide = "ewol-widget-wslider-event-stop-slide"; const char* const ewol::widget::WSlider::eventStopSlide = "ewol-widget-wslider-event-stop-slide";
// Config list of properties
const char* const ewol::widget::WSlider::configMode = "mode";
const char* const ewol::widget::WSlider::configSpeed = "speed";
const char* const ewol::widget::WSlider::configSelect = "select";
ewol::widget::WSlider::WSlider() : ewol::widget::WSlider::WSlider() :
m_windowsSources(0), m_windowsSources(0),
@ -122,6 +118,12 @@ void ewol::widget::WSlider::subWidgetSelectSet(int32_t _id) {
elementID ++; elementID ++;
if (it != nullptr) { if (it != nullptr) {
if (it->getId() == _id) { if (it->getId() == _id) {
if (it->getName() != "") {
// change the internal event parameter (in case...) ==> no event generation
m_selectNewWidget.get() = it->getName();
} else {
m_selectNewWidget.get() = "";
}
break; break;
} }
} }
@ -130,6 +132,8 @@ void ewol::widget::WSlider::subWidgetSelectSet(int32_t _id) {
subWidgetSelectSetVectorId(elementID); subWidgetSelectSetVectorId(elementID);
} else { } else {
subWidgetSelectSetVectorId(-1); subWidgetSelectSetVectorId(-1);
// change the internal event parameter (in case...) ==> no event generation
m_selectNewWidget.get() = "";
} }
} }
@ -143,6 +147,12 @@ void ewol::widget::WSlider::subWidgetSelectSet(const std::shared_ptr<ewol::Widge
if ( it != nullptr if ( it != nullptr
&& it == _widgetPointer) { && it == _widgetPointer) {
subWidgetSelectSetVectorId(iii); subWidgetSelectSetVectorId(iii);
if (_widgetPointer->getName() != "") {
// change the internal event parameter (in case...) ==> no event generation
m_selectNewWidget.get() = _widgetPointer->getName();
} else {
m_selectNewWidget.get() = "";
}
return; return;
} }
iii++; iii++;
@ -160,6 +170,8 @@ void ewol::widget::WSlider::subWidgetSelectSet(const std::string& _widgetName) {
if ( it != nullptr if ( it != nullptr
&& it->getName() == _widgetName) { && it->getName() == _widgetName) {
subWidgetSelectSetVectorId(iii); subWidgetSelectSetVectorId(iii);
// change the internal event parameter (in case...) ==> no event generation
m_selectNewWidget.get() = _widgetName;
return; return;
} }
iii++; iii++;
@ -167,13 +179,6 @@ void ewol::widget::WSlider::subWidgetSelectSet(const std::string& _widgetName) {
EWOL_ERROR("Can not change to a widget not present"); EWOL_ERROR("Can not change to a widget not present");
} }
void ewol::widget::WSlider::setTransitionMode(enum sladingMode _mode) {
if (m_transitionSlide != _mode) {
m_transitionSlide = _mode;
markToRedraw();
}
}
void ewol::widget::WSlider::periodicCall(const ewol::event::Time& _event) { void ewol::widget::WSlider::periodicCall(const ewol::event::Time& _event) {
if (m_slidingProgress >= 1.0) { if (m_slidingProgress >= 1.0) {
m_windowsSources = m_windowsDestination; m_windowsSources = m_windowsDestination;
@ -269,65 +274,19 @@ void ewol::widget::WSlider::onRegenerateDisplay() {
} }
} }
} }
/* void ewol::widget::WSlider::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) {
bool ewol::widget::WSlider::onSetConfig(const ewol::object::Config& _conf) { ewol::widget::ContainerN::onParameterChangeValue(_paramPointer);
if (true == ewol::widget::ContainerN::onSetConfig(_conf)) { if (_paramPointer == m_selectNewWidget) {
return true; if (m_selectNewWidget.get() != "") {
} subWidgetSelectSet(m_selectNewWidget);
if (_conf.getConfig() == configMode) {
enum sladingMode tmpTransition = sladingTransitionHori;
if(etk::compare_no_case(_conf.getData(), "vert") == true) {
tmpTransition = sladingTransitionVert;
} else if(etk::compare_no_case(_conf.getData(), "hori") == true) {
tmpTransition = sladingTransitionHori;
} }
setTransitionMode(tmpTransition); } else if (_paramPointer == m_transitionSpeed) {
return true; // nothing to do ...
} else if (_paramPointer == m_transitionSlide) {
markToRedraw();
} }
if (_conf.getConfig() == configSpeed) {
setTransitionSpeed(etk::string_to_float(_conf.getData()));
return true;
}
if (_conf.getConfig() == configSelect) {
subWidgetSelectSet(_conf.getData());
return true;
}
return false;
} }
bool ewol::widget::WSlider::onGetConfig(const char* _config, std::string& _result) const {
if (true == ewol::widget::ContainerN::onGetConfig(_config, _result)) {
return true;
}
if (_config == configMode) {
switch(m_transitionSlide){
default:
case sladingTransitionHori:
_result = "hori";
break;
case sladingTransitionVert:
_result = "vert";
break;
}
return true;
}
if (_config == configMode) {
_result = etk::to_string(getTransitionSpeed());
return true;
}
if (_config == configSelect) {
auto it = m_subWidget.begin();
std::advance(it, m_windowsRequested);
if ( it != m_subWidget.end()
&& *it != nullptr) {
_result = (*it)->getName();
}
return true;
}
return false;
}
*/
std::shared_ptr<ewol::Widget> ewol::widget::WSlider::getWidgetAtPos(const vec2& _pos) { std::shared_ptr<ewol::Widget> ewol::widget::WSlider::getWidgetAtPos(const vec2& _pos) {
if (true == isHide()) { if (true == isHide()) {
return nullptr; return nullptr;

View File

@ -24,11 +24,6 @@ namespace ewol {
// Event list of properties // Event list of properties
static const char* const eventStartSlide; static const char* const eventStartSlide;
static const char* const eventStopSlide; static const char* const eventStopSlide;
// Config list of properties
// TODO : remove the dynamic transition and set this in annimation ...
static const char* const configMode;
static const char* const configSpeed;
static const char* const configSelect;
enum sladingMode { enum sladingMode {
sladingTransitionVert, sladingTransitionVert,
sladingTransitionHori, sladingTransitionHori,
@ -47,7 +42,7 @@ namespace ewol {
int32_t m_windowsDestination; //!< widget destinated viewed int32_t m_windowsDestination; //!< widget destinated viewed
int32_t m_windowsRequested; //!< widget destination requested when change in modification in progress int32_t m_windowsRequested; //!< widget destination requested when change in modification in progress
float m_slidingProgress; //!< ratio progression of a sliding float m_slidingProgress; //!< ratio progression of a sliding
ewol::object::Param<std::string> m_selectNewWidget; // input config requesting ewol::object::Param<std::string, true> m_selectNewWidget; // input config requesting
protected: protected:
/** /**
* @brief Generate the move on the specific vector ID (This is not a public acces, because the vector can have some null pointer inside ...) * @brief Generate the move on the specific vector ID (This is not a public acces, because the vector can have some null pointer inside ...)
@ -94,7 +89,9 @@ namespace ewol {
* @brief set a new mode of sliding element * @brief set a new mode of sliding element
* @param[in] _mode new display mode * @param[in] _mode new display mode
*/ */
void setTransitionMode(enum sladingMode _mode); void setTransitionMode(enum sladingMode _mode) {
m_transitionSlide.set(_mode);
}
/** /**
* @brief get a new mode of sliding element * @brief get a new mode of sliding element
* @return The current sliding mode * @return The current sliding mode
@ -108,10 +105,7 @@ namespace ewol {
virtual void onRegenerateDisplay(); virtual void onRegenerateDisplay();
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos); virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos);
virtual void periodicCall(const ewol::event::Time& _event); virtual void periodicCall(const ewol::event::Time& _event);
/* virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer);
virtual bool onSetConfig(const ewol::object::Config& _conf);
virtual bool onGetConfig(const char* _config, std::string& _result) const;
*/
}; };
}; };
std::ostream& operator <<(std::ostream& _os, const enum ewol::widget::WSlider::sladingMode _obj); std::ostream& operator <<(std::ostream& _os, const enum ewol::widget::WSlider::sladingMode _obj);

View File

@ -152,24 +152,6 @@ ewol::Widget::~Widget() {
shortCutClean(); shortCutClean();
} }
void ewol::Widget::hide() {
if (m_hide == false) {
EWOL_WARNING("HIDE widget: '" << getName() << "'");
m_hide = true;
markToRedraw();
requestUpdateSize();
}
}
void ewol::Widget::show() {
if (m_hide == true) {
EWOL_WARNING("SHOW widget: '" << getName() << "'");
m_hide = false;
markToRedraw();
requestUpdateSize();
}
}
void ewol::Widget::calculateSize(const vec2& _available) { void ewol::Widget::calculateSize(const vec2& _available) {
m_size = _available; m_size = _available;
m_size.setMax(m_minSize); m_size.setMax(m_minSize);
@ -198,15 +180,6 @@ bool ewol::Widget::rmFocus() {
return false; return false;
} }
void ewol::Widget::setCanHaveFocus(bool _canFocusState) {
if (m_canFocus != _canFocusState) {
m_canFocus = _canFocusState;
if (m_hasFocus == true) {
rmFocus();
}
}
}
void ewol::Widget::keepFocus() { void ewol::Widget::keepFocus() {
getWidgetManager().focusKeep(std::dynamic_pointer_cast<ewol::Widget>(shared_from_this())); getWidgetManager().focusKeep(std::dynamic_pointer_cast<ewol::Widget>(shared_from_this()));
} }
@ -416,25 +389,6 @@ vec2 ewol::Widget::getCalculateMaxSize() {
return vec2(ULTIMATE_MAX_SIZE,ULTIMATE_MAX_SIZE); return vec2(ULTIMATE_MAX_SIZE,ULTIMATE_MAX_SIZE);
} }
void ewol::Widget::setMinSize(const ewol::Dimension& _size) {
vec2 pixelMin = _size.getPixel();
vec2 pixelMax = m_userMaxSize->getPixel();
// check minimum & maximum compatibility :
bool error=false;
if (pixelMin.x()>pixelMax.x()) {
error=true;
}
if (pixelMin.y()>pixelMax.y()) {
error=true;
}
if (error == true) {
EWOL_ERROR("Can not set a 'min size' > 'max size' set nothing ...");
return;
}
m_userMinSize = _size;
requestUpdateSize();
}
void ewol::Widget::setNoMinSize() { void ewol::Widget::setNoMinSize() {
m_userMinSize.set(ewol::Dimension(vec2(0,0),ewol::Dimension::Pixel)); m_userMinSize.set(ewol::Dimension(vec2(0,0),ewol::Dimension::Pixel));
} }
@ -445,25 +399,6 @@ void ewol::Widget::checkMinSize() {
m_minSize.setY(std::max(m_minSize.y(), pixelSize.y())); m_minSize.setY(std::max(m_minSize.y(), pixelSize.y()));
} }
void ewol::Widget::setMaxSize(const ewol::Dimension& _size) {
vec2 pixelMin = m_userMinSize->getPixel();
vec2 pixelMax = _size.getPixel();
// check minimum & maximum compatibility :
bool error=false;
if (pixelMin.x()>pixelMax.x()) {
error=true;
}
if (pixelMin.y()>pixelMax.y()) {
error=true;
}
if (error == true) {
EWOL_ERROR("Can not set a 'min size' > 'max size' set nothing ...");
return;
}
m_userMaxSize = _size;
requestUpdateSize();
}
void ewol::Widget::setNoMaxSize() { void ewol::Widget::setNoMaxSize() {
m_userMaxSize.set(ewol::Dimension(vec2(ULTIMATE_MAX_SIZE,ULTIMATE_MAX_SIZE),ewol::Dimension::Pixel)); m_userMaxSize.set(ewol::Dimension(vec2(ULTIMATE_MAX_SIZE,ULTIMATE_MAX_SIZE),ewol::Dimension::Pixel));
} }
@ -481,15 +416,6 @@ vec2 ewol::Widget::getSize() {
return vec2(0,0); return vec2(0,0);
} }
void ewol::Widget::setExpand(const bvec2& _newExpand) {
if( m_userExpand->x() != _newExpand.x()
|| m_userExpand->y() != _newExpand.y()) {
m_userExpand.set(_newExpand);
requestUpdateSize();
markToRedraw();
}
}
bvec2 ewol::Widget::canExpand() { bvec2 ewol::Widget::canExpand() {
if (false == isHide()) { if (false == isHide()) {
return m_userExpand; return m_userExpand;
@ -497,15 +423,6 @@ bvec2 ewol::Widget::canExpand() {
return bvec2(false,false); return bvec2(false,false);
} }
void ewol::Widget::setFill(const bvec2& _newFill) {
if( m_userFill->x() != _newFill.x()
|| m_userFill->y() != _newFill.y()) {
m_userFill = _newFill;
requestUpdateSize();
markToRedraw();
}
}
const bvec2& ewol::Widget::canFill() { const bvec2& ewol::Widget::canFill() {
return m_userFill; return m_userFill;
} }
@ -719,9 +636,64 @@ bool ewol::Widget::systemEventInput(ewol::event::InputSystem& _event) {
return onEventInput(_event.m_event); return onEventInput(_event.m_event);
} }
void ewol::Widget::setGravity(enum gravity _gravity) { void ewol::Widget::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) {
m_gravity = _gravity; ewol::Object::onParameterChangeValue(_paramPointer);
markToRedraw(); if (_paramPointer == m_canFocus) {
if (m_hasFocus == true) {
rmFocus();
}
} else if (_paramPointer == m_gravity) {
markToRedraw();
} else if (_paramPointer == m_hide) {
markToRedraw();
requestUpdateSize();
} else if (_paramPointer == m_userFill) {
markToRedraw();
requestUpdateSize();
} else if (_paramPointer == m_userExpand) {
requestUpdateSize();
markToRedraw();
} else if (_paramPointer == m_userMaxSize) {
vec2 pixelMin = m_userMinSize->getPixel();
vec2 pixelMax = m_userMaxSize->getPixel();
// check minimum & maximum compatibility :
bool error=false;
if (pixelMin.x()>pixelMax.x()) {
error=true;
}
if (pixelMin.y()>pixelMax.y()) {
error=true;
}
if (error == true) {
EWOL_ERROR("Can not set a 'min size' > 'max size' reset to maximum ...");
m_userMaxSize = ewol::Dimension(vec2(ULTIMATE_MAX_SIZE,ULTIMATE_MAX_SIZE),ewol::Dimension::Pixel);
}
requestUpdateSize();
} else if (_paramPointer == m_userMinSize) {
vec2 pixelMin = m_userMinSize->getPixel();
vec2 pixelMax = m_userMaxSize->getPixel();
// check minimum & maximum compatibility :
bool error=false;
if (pixelMin.x()>pixelMax.x()) {
error=true;
}
if (pixelMin.y()>pixelMax.y()) {
error=true;
}
if (error == true) {
EWOL_ERROR("Can not set a 'min size' > 'max size' set nothing ...");
m_userMinSize = ewol::Dimension(vec2(0,0),ewol::Dimension::Pixel);
}
requestUpdateSize();
} else if (_paramPointer == m_annimationTypeStart) {
} else if (_paramPointer == m_annimationTimeStart) {
} else if (_paramPointer == m_annimationTypeStop) {
} else if (_paramPointer == m_annimationTimeStop) {
}
} }
/* /*

View File

@ -123,15 +123,6 @@ namespace ewol {
* *
*/ */
class Widget : public ewol::Object { class Widget : public ewol::Object {
public:
// Config list of properties
static const char* const configFill;
static const char* const configExpand;
static const char* const configHide;
static const char* const configFocus;
static const char* const configMinSize;
static const char* const configMaxSize;
static const char* const configGravity;
protected: protected:
/** /**
* @brief Constructor of the widget classes * @brief Constructor of the widget classes
@ -246,7 +237,9 @@ namespace ewol {
* @brief User set the minimum size he want to set the display * @brief User set the minimum size he want to set the display
* @param[in] _size set minimum size (none : 0) * @param[in] _size set minimum size (none : 0)
*/ */
void setMinSize(const ewol::Dimension& _size); void setMinSize(const ewol::Dimension& _size) {
m_userMinSize.set(_size);
}
/** /**
* @brief User set No minimum size. * @brief User set No minimum size.
*/ */
@ -271,7 +264,9 @@ namespace ewol {
* @brief User set the maximum size he want to set the display * @brief User set the maximum size he want to set the display
* @param[in] _size The new maximum size requested (vec2(0,0) to unset) * @param[in] _size The new maximum size requested (vec2(0,0) to unset)
*/ */
void setMaxSize(const ewol::Dimension& _size); void setMaxSize(const ewol::Dimension& _size) {
m_userMaxSize.set(_size);
}
/** /**
* @brief User set No maximum size. * @brief User set No maximum size.
*/ */
@ -296,7 +291,9 @@ namespace ewol {
* @brief set the expend capabilities (x&y) * @brief set the expend capabilities (x&y)
* @param[in] _newExpend 2D boolean repensent the capacity to expend * @param[in] _newExpend 2D boolean repensent the capacity to expend
*/ */
virtual void setExpand(const bvec2& _newExpand); virtual void setExpand(const bvec2& _newExpand) {
m_userExpand.set(_newExpand);
}
/** /**
* @brief get the expend capabilities (x&y) (set by the user) * @brief get the expend capabilities (x&y) (set by the user)
* @return 2D boolean repensent the capacity to expend * @return 2D boolean repensent the capacity to expend
@ -317,7 +314,9 @@ namespace ewol {
* @brief set the x&y filling capacity * @brief set the x&y filling capacity
* @param[in] _newFill new x&y fill state * @param[in] _newFill new x&y fill state
*/ */
virtual void setFill(const bvec2& _newFill); virtual void setFill(const bvec2& _newFill) {
m_userFill.set(_newFill);
}
/** /**
* @brief set the x&y filling capacity set by the user * @brief set the x&y filling capacity set by the user
* @return bvec2 repensent the capacity to x&y filling (set by the user) * @return bvec2 repensent the capacity to x&y filling (set by the user)
@ -337,11 +336,15 @@ namespace ewol {
/** /**
* @brief set the widget hidden * @brief set the widget hidden
*/ */
virtual void hide(); virtual void hide() {
m_hide.set(true);
}
/** /**
* @brief set the widget visible * @brief set the widget visible
*/ */
virtual void show(); virtual void show() {
m_hide.set(false);
}
/** /**
* @brief get the visibility of the widget * @brief get the visibility of the widget
* @return true: if the widget is hiden, false: it is visible * @return true: if the widget is hiden, false: it is visible
@ -357,7 +360,9 @@ namespace ewol {
* @brief set the widget gravity * @brief set the widget gravity
* @param[in] _gravity New gravity of the widget * @param[in] _gravity New gravity of the widget
*/ */
virtual void setGravity(enum ewol::gravity _gravity); virtual void setGravity(enum ewol::gravity _gravity) {
m_gravity.set(_gravity);
}
/** /**
* @brief get the widget gravity * @brief get the widget gravity
* @return the gravity type * @return the gravity type
@ -400,7 +405,9 @@ namespace ewol {
* @brief set the capability to have the focus * @brief set the capability to have the focus
* @param[in] _canFocusState new focus capability * @param[in] _canFocusState new focus capability
*/ */
virtual void setCanHaveFocus(bool _canFocusState); virtual void setCanHaveFocus(bool _canFocusState) {
m_canFocus.set(_canFocusState);
}
/** /**
* @brief keep the focus on this widget == > this remove the previous focus on all other widget * @brief keep the focus on this widget == > this remove the previous focus on all other widget
*/ */
@ -688,10 +695,7 @@ namespace ewol {
virtual void onObjectRemove(const std::shared_ptr<ewol::Object>& _object) {}; virtual void onObjectRemove(const std::shared_ptr<ewol::Object>& _object) {};
virtual bool loadXML(exml::Element* _node); virtual bool loadXML(exml::Element* _node);
protected: // Derived function protected: // Derived function
/* virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer);
virtual bool onSetConfig(const ewol::object::Config& _conf);
virtual bool onGetConfig(const char* _config, std::string& _result) const;
*/
public: public:
/** /**
* @brief need to be call When the size of the current widget have change == > this force the system to recalculate all the widget positions * @brief need to be call When the size of the current widget have change == > this force the system to recalculate all the widget positions

View File

@ -76,7 +76,6 @@ namespace ewol {
// Event list of properties // Event list of properties
static const char* const eventCancel; static const char* const eventCancel;
static const char* const eventValidate; static const char* const eventValidate;
// Config list of properties
protected: protected:
FileChooser(); FileChooser();
void init(); void init();