[DEV] sizer parameter normalisation
This commit is contained in:
parent
428111b1d9
commit
bd184d4f8f
2
external/etk
vendored
2
external/etk
vendored
@ -1 +1 @@
|
|||||||
Subproject commit fc6e425cebc2bafc2d4169b8235878ae493e1545
|
Subproject commit 8300237b2cc37bd36113c2830bdf1941fd0e8099
|
@ -10,6 +10,9 @@
|
|||||||
#include <ewol/widget/Sizer.h>
|
#include <ewol/widget/Sizer.h>
|
||||||
#include <ewol/widget/Manager.h>
|
#include <ewol/widget/Manager.h>
|
||||||
|
|
||||||
|
const char* const ewol::widget::Sizer::configBorder = "border";
|
||||||
|
const char* const ewol::widget::Sizer::configMode = "mode";
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "Sizer"
|
#define __class__ "Sizer"
|
||||||
|
|
||||||
@ -28,6 +31,8 @@ ewol::widget::Sizer::Sizer(enum displayMode _mode):
|
|||||||
m_animation(animationNone),
|
m_animation(animationNone),
|
||||||
m_animationTime(0) {
|
m_animationTime(0) {
|
||||||
addObjectType("ewol::widget::Sizer");
|
addObjectType("ewol::widget::Sizer");
|
||||||
|
registerConfig(configBorder, "dimension", NULL, "The sizer border size");
|
||||||
|
registerConfig(configMode, "list", "{vert,hori}", "The display mode");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,10 +56,6 @@ void ewol::widget::Sizer::setMode(enum displayMode _mode) {
|
|||||||
requestUpdateSize();
|
requestUpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ewol::widget::Sizer::displayMode ewol::widget::Sizer::getMode(void) {
|
|
||||||
return m_mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
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();
|
||||||
@ -163,29 +164,6 @@ void ewol::widget::Sizer::calculateMinMaxSize(void) {
|
|||||||
//EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} Result min size : " << m_minSize);
|
//EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} Result min size : " << m_minSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ewol::widget::Sizer::loadXML(exml::Element* _node) {
|
|
||||||
if (NULL == _node) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// parse generic properties :
|
|
||||||
ewol::widget::ContainerN::loadXML(_node);
|
|
||||||
|
|
||||||
std::string tmpAttributeValue = _node->getAttribute("border");
|
|
||||||
if (tmpAttributeValue.size()!=0) {
|
|
||||||
m_borderSize = tmpAttributeValue;
|
|
||||||
}
|
|
||||||
tmpAttributeValue = _node->getAttribute("mode");
|
|
||||||
if (tmpAttributeValue.size()!=0) {
|
|
||||||
if( compare_no_case(tmpAttributeValue, "vert") == true
|
|
||||||
|| compare_no_case(tmpAttributeValue, "vertical") == true) {
|
|
||||||
m_mode = ewol::widget::Sizer::modeVert;
|
|
||||||
} else {
|
|
||||||
m_mode = ewol::widget::Sizer::modeHori;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t ewol::widget::Sizer::subWidgetAdd(ewol::Widget* _newWidget) {
|
int32_t ewol::widget::Sizer::subWidgetAdd(ewol::Widget* _newWidget) {
|
||||||
if (m_animation == animationNone) {
|
if (m_animation == animationNone) {
|
||||||
return ewol::widget::ContainerN::subWidgetAdd(_newWidget);
|
return ewol::widget::ContainerN::subWidgetAdd(_newWidget);
|
||||||
@ -220,5 +198,42 @@ void ewol::widget::Sizer::subWidgetUnLink(ewol::Widget* _newWidget) {
|
|||||||
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 {
|
||||||
|
if (true == ewol::widget::ContainerN::onGetConfig(_config, _result)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (_config == configBorder) {
|
||||||
|
_result = (std::string)getBorderSize();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (_config == configMode) {
|
||||||
|
if (getMode() == modeVert) {
|
||||||
|
_result = "vert";
|
||||||
|
} else {
|
||||||
|
_result = "hori";
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,6 +25,9 @@ namespace ewol {
|
|||||||
* @brief Main call of recording the widget on the List of "widget named creator"
|
* @brief Main call of recording the widget on the List of "widget named creator"
|
||||||
*/
|
*/
|
||||||
static void init(ewol::widget::Manager& _widgetManager);
|
static void init(ewol::widget::Manager& _widgetManager);
|
||||||
|
// Config list of properties
|
||||||
|
static const char* const configBorder;
|
||||||
|
static const char* const configMode;
|
||||||
public:
|
public:
|
||||||
enum displayMode {
|
enum displayMode {
|
||||||
modeVert, //!< Vertical mode
|
modeVert, //!< Vertical mode
|
||||||
@ -51,7 +54,9 @@ namespace ewol {
|
|||||||
* @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.
|
||||||
*/
|
*/
|
||||||
enum displayMode getMode(void);
|
enum displayMode getMode(void) const {
|
||||||
|
return m_mode;
|
||||||
|
}
|
||||||
private:
|
private:
|
||||||
ewol::Dimension m_borderSize; //!< Border size needed for all the display
|
ewol::Dimension m_borderSize; //!< Border size needed for all the display
|
||||||
public:
|
public:
|
||||||
@ -64,7 +69,7 @@ namespace ewol {
|
|||||||
* @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)
|
||||||
*/
|
*/
|
||||||
const ewol::Dimension& getBorderSize(void) {
|
const ewol::Dimension& getBorderSize(void) const {
|
||||||
return m_borderSize;
|
return m_borderSize;
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
@ -113,12 +118,13 @@ namespace ewol {
|
|||||||
public: // Derived function
|
public: // Derived function
|
||||||
virtual void calculateSize(const vec2& _availlable);
|
virtual void calculateSize(const vec2& _availlable);
|
||||||
virtual void calculateMinMaxSize(void);
|
virtual void calculateMinMaxSize(void);
|
||||||
virtual bool loadXML(exml::Element* _node);
|
|
||||||
// overwrite the set fuction to start annimations ...
|
// overwrite the set fuction to start annimations ...
|
||||||
virtual int32_t subWidgetAdd(ewol::Widget* _newWidget);
|
virtual int32_t subWidgetAdd(ewol::Widget* _newWidget);
|
||||||
virtual int32_t subWidgetAddStart(ewol::Widget* _newWidget);
|
virtual int32_t subWidgetAddStart(ewol::Widget* _newWidget);
|
||||||
virtual void subWidgetRemove(ewol::Widget* _newWidget);
|
virtual void subWidgetRemove(ewol::Widget* _newWidget);
|
||||||
virtual void subWidgetUnLink(ewol::Widget* _newWidget);
|
virtual void subWidgetUnLink(ewol::Widget* _newWidget);
|
||||||
|
virtual bool onSetConfig(const ewol::object::Config& _conf);
|
||||||
|
virtual bool onGetConfig(const char* _config, std::string& _result) const;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user