[DEV] try to correct sizer error
This commit is contained in:
parent
75e120ceb3
commit
fa0ef8e26c
@ -461,7 +461,7 @@ void ewol::Context::forceRedrawAll() {
|
||||
}
|
||||
ivec2 size = getSize();
|
||||
m_windowsCurrent->setSize(vec2(size.x(), size.y()));
|
||||
m_windowsCurrent->onSizeChange();
|
||||
m_windowsCurrent->onChangeSize();
|
||||
}
|
||||
/*
|
||||
void ewol::Context::OS_Stop() {
|
||||
|
@ -62,9 +62,9 @@ ewol::widget::Button::~Button() {
|
||||
|
||||
}
|
||||
|
||||
void ewol::widget::Button::onSizeChange() {
|
||||
void ewol::widget::Button::onChangeSize() {
|
||||
ewol::Padding padding = m_shaper->getPadding();
|
||||
ewol::Padding ret = onSizeChangePadded(padding);
|
||||
ewol::Padding ret = onChangeSizePadded(padding);
|
||||
//EWOL_DEBUG(" configuring : origin=" << origin << " size=" << subElementSize << "");
|
||||
m_selectableAreaPos = vec2(ret.xLeft(), ret.yButtom());
|
||||
m_selectableAreaSize = m_size - (m_selectableAreaPos + vec2(ret.xRight(), ret.yTop()));
|
||||
|
@ -152,7 +152,7 @@ namespace ewol {
|
||||
virtual void onParameterChangeValue(const ewol::parameter::Ref& _paramPointer);
|
||||
public: // Derived function
|
||||
virtual void calculateMinMaxSize();
|
||||
virtual void onSizeChange();
|
||||
virtual void onChangeSize();
|
||||
virtual void onRegenerateDisplay();
|
||||
virtual bool onEventInput(const ewol::event::Input& _event);
|
||||
virtual bool onEventEntry(const ewol::event::Entry& _event);
|
||||
|
@ -55,11 +55,11 @@ ewol::widget::CheckBox::~CheckBox() {
|
||||
|
||||
}
|
||||
|
||||
void ewol::widget::CheckBox::onSizeChange() {
|
||||
void ewol::widget::CheckBox::onChangeSize() {
|
||||
ewol::Padding padding = m_shaper->getPadding();
|
||||
float boxSize = m_shaper->getConfigNumber(m_shaperIdSize);
|
||||
padding.setXLeft(padding.xLeft()*2.0f + boxSize);
|
||||
ewol::Padding ret = onSizeChangePadded(padding);
|
||||
ewol::Padding ret = onChangeSizePadded(padding);
|
||||
EWOL_DEBUG(" configuring : padding=" << padding << " boxSize=" << boxSize << "");
|
||||
m_selectableAreaPos = vec2(ret.xLeft()/*-boxSize*/, ret.yButtom());
|
||||
m_selectableAreaSize = m_size - (m_selectableAreaPos + vec2(ret.xRight(), ret.yTop()));
|
||||
|
@ -88,7 +88,7 @@ namespace ewol {
|
||||
virtual void onParameterChangeValue(const ewol::parameter::Ref& _paramPointer);
|
||||
public: // Derived function
|
||||
virtual void calculateMinMaxSize();
|
||||
virtual void onSizeChange();
|
||||
virtual void onChangeSize();
|
||||
virtual void onRegenerateDisplay();
|
||||
virtual bool onEventInput(const ewol::event::Input& _event);
|
||||
virtual bool onEventEntry(const ewol::event::Entry& _event);
|
||||
|
@ -104,8 +104,8 @@ void ewol::widget::Container::systemDraw(const ewol::DrawProperty& _displayProp)
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::widget::Container::onSizeChange() {
|
||||
ewol::Widget::onSizeChange();
|
||||
void ewol::widget::Container::onChangeSize() {
|
||||
ewol::Widget::onChangeSize();
|
||||
if (m_subWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
@ -130,7 +130,7 @@ void ewol::widget::Container::onSizeChange() {
|
||||
}
|
||||
m_subWidget->setOrigin(origin);
|
||||
m_subWidget->setSize(m_size);
|
||||
m_subWidget->onSizeChange();
|
||||
m_subWidget->onChangeSize();
|
||||
}
|
||||
|
||||
void ewol::widget::Container::calculateMinMaxSize() {
|
||||
@ -205,7 +205,7 @@ void ewol::widget::Container::setOffset(const vec2& _newVal) {
|
||||
if (m_offset != _newVal) {
|
||||
ewol::Widget::setOffset(_newVal);
|
||||
// recalculate the new sise and position of sub widget ...
|
||||
onSizeChange();
|
||||
onChangeSize();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ namespace ewol {
|
||||
public: // Derived function
|
||||
virtual void systemDraw(const ewol::DrawProperty& _displayProp);
|
||||
virtual void onRegenerateDisplay();
|
||||
virtual void onSizeChange();
|
||||
virtual void onChangeSize();
|
||||
virtual void calculateMinMaxSize();
|
||||
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos);
|
||||
virtual std::shared_ptr<ewol::Object> getSubObjectNamed(const std::string& _objectName);
|
||||
|
@ -114,8 +114,8 @@ void ewol::widget::Container2::systemDraw(const ewol::DrawProperty& _displayProp
|
||||
}
|
||||
}
|
||||
|
||||
ewol::Padding ewol::widget::Container2::onSizeChangePadded(const ewol::Padding& _padding) {
|
||||
ewol::Widget::onSizeChange();
|
||||
ewol::Padding ewol::widget::Container2::onChangeSizePadded(const ewol::Padding& _padding) {
|
||||
ewol::Widget::onChangeSize();
|
||||
vec2 localAvaillable = m_size - vec2(_padding.x(), _padding.y());
|
||||
// Checkin the filling properties == > for the subElements:
|
||||
vec2 subElementSize = m_minSize;
|
||||
@ -150,7 +150,7 @@ ewol::Padding ewol::widget::Container2::onSizeChangePadded(const ewol::Padding&
|
||||
}
|
||||
m_subWidget[iii]->setOrigin(m_origin + origin);
|
||||
m_subWidget[iii]->setSize(subElementSize);
|
||||
m_subWidget[iii]->onSizeChange();
|
||||
m_subWidget[iii]->onChangeSize();
|
||||
}
|
||||
}
|
||||
vec2 selectableAreaPos = origin-vec2(_padding.xLeft(), _padding.yButtom());
|
||||
|
@ -126,7 +126,7 @@ namespace ewol {
|
||||
* @param[in] _padding Padding of the widget.
|
||||
* @note : INTERNAL EWOL SYSTEM
|
||||
*/
|
||||
virtual ewol::Padding onSizeChangePadded(const ewol::Padding& _padding = ewol::Padding(0,0,0,0));
|
||||
virtual ewol::Padding onChangeSizePadded(const ewol::Padding& _padding = ewol::Padding(0,0,0,0));
|
||||
/**
|
||||
* @brief calculate the minimum and maximum size (need to estimate expend properties of the widget)
|
||||
* @param[in] _padding Padding of the widget.
|
||||
@ -158,8 +158,8 @@ namespace ewol {
|
||||
public: // Derived function
|
||||
virtual void systemDraw(const ewol::DrawProperty& _displayProp);
|
||||
virtual void onRegenerateDisplay();
|
||||
virtual void onSizeChange() {
|
||||
onSizeChangePadded();
|
||||
virtual void onChangeSize() {
|
||||
onChangeSizePadded();
|
||||
}
|
||||
virtual void calculateMinMaxSize() {
|
||||
calculateMinMaxSizePadded();
|
||||
|
@ -195,14 +195,14 @@ void ewol::widget::ContainerN::systemDraw(const ewol::DrawProperty& _displayProp
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::widget::ContainerN::onSizeChange() {
|
||||
void ewol::widget::ContainerN::onChangeSize() {
|
||||
for (auto &it : m_subWidget) {
|
||||
if (it == nullptr) {
|
||||
continue;
|
||||
}
|
||||
it->setOrigin(m_origin+m_offset);
|
||||
it->setSize(m_size);
|
||||
it->onSizeChange();
|
||||
it->onChangeSize();
|
||||
}
|
||||
}
|
||||
|
||||
@ -317,7 +317,7 @@ void ewol::widget::ContainerN::setOffset(const vec2& _newVal) {
|
||||
if (m_offset != _newVal) {
|
||||
ewol::Widget::setOffset(_newVal);
|
||||
// recalculate the new sise and position of sub widget ...
|
||||
onSizeChange();
|
||||
onChangeSize();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ namespace ewol {
|
||||
public:// Derived function
|
||||
virtual void systemDraw(const ewol::DrawProperty& _displayProp);
|
||||
virtual void onRegenerateDisplay();
|
||||
virtual void onSizeChange();
|
||||
virtual void onChangeSize();
|
||||
virtual void calculateMinMaxSize();
|
||||
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos);
|
||||
virtual std::shared_ptr<ewol::Object> getSubObjectNamed(const std::string& _objectName);
|
||||
|
@ -49,7 +49,7 @@ ewol::widget::ContextMenu::~ContextMenu() {
|
||||
|
||||
}
|
||||
|
||||
void ewol::widget::ContextMenu::onSizeChange() {
|
||||
void ewol::widget::ContextMenu::onChangeSize() {
|
||||
// pop-up fill all the display :
|
||||
ewol::Padding padding = m_shaper->getPadding();
|
||||
EWOL_VERBOSE("our origin=" << m_origin << " size=" << m_size);
|
||||
@ -109,7 +109,7 @@ void ewol::widget::ContextMenu::onSizeChange() {
|
||||
EWOL_VERBOSE(" == > sub origin=" << subWidgetOrigin << " size=" << subWidgetSize);
|
||||
m_subWidget->setOrigin(subWidgetOrigin);
|
||||
m_subWidget->setSize(subWidgetSize);
|
||||
m_subWidget->onSizeChange();
|
||||
m_subWidget->onChangeSize();
|
||||
}
|
||||
markToRedraw();
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ namespace ewol {
|
||||
public: // Derived function
|
||||
virtual void onRegenerateDisplay();
|
||||
virtual bool onEventInput(const ewol::event::Input& _event);
|
||||
virtual void onSizeChange();
|
||||
virtual void onChangeSize();
|
||||
virtual void calculateMinMaxSize();
|
||||
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos);
|
||||
};
|
||||
|
@ -47,7 +47,7 @@ void ewol::widget::Gird::setBorderSize(const ivec2& _newBorderSize) {
|
||||
requestUpdateSize();
|
||||
}
|
||||
|
||||
void ewol::widget::Gird::onSizeChange() {
|
||||
void ewol::widget::Gird::onChangeSize() {
|
||||
//EWOL_DEBUG("Update size");
|
||||
m_size -= m_borderSize*2;
|
||||
|
||||
@ -77,7 +77,7 @@ void ewol::widget::Gird::onSizeChange() {
|
||||
m_subWidget[iii].widget->setOrigin(vec2ClipInt32(tmpOrigin));
|
||||
// all time set oll the space .
|
||||
m_subWidget[iii].widget->setSize(vec2ClipInt32(vec2(abs(m_sizeCol[m_subWidget[iii].col]), m_uniformSizeRow)));
|
||||
m_subWidget[iii].widget->onSizeChange();
|
||||
m_subWidget[iii].widget->onChangeSize();
|
||||
}
|
||||
}
|
||||
m_size += m_borderSize*2;
|
||||
|
@ -138,7 +138,7 @@ namespace ewol {
|
||||
virtual void systemDraw(const ewol::DrawProperty& _displayProp);
|
||||
virtual void onRegenerateDisplay();
|
||||
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& pos);
|
||||
virtual void onSizeChange();
|
||||
virtual void onChangeSize();
|
||||
virtual void calculateMinMaxSize();
|
||||
};
|
||||
};
|
||||
|
@ -43,7 +43,7 @@ void ewol::widget::PopUp::setShaperName(const std::string& _shaperName) {
|
||||
markToRedraw();
|
||||
}
|
||||
|
||||
void ewol::widget::PopUp::onSizeChange() {
|
||||
void ewol::widget::PopUp::onChangeSize() {
|
||||
markToRedraw();
|
||||
if (nullptr == m_subWidget) {
|
||||
return;
|
||||
@ -75,7 +75,7 @@ void ewol::widget::PopUp::onSizeChange() {
|
||||
|
||||
m_subWidget->setOrigin(subWidgetOrigin);
|
||||
m_subWidget->setSize(subWidgetSize);
|
||||
m_subWidget->onSizeChange();
|
||||
m_subWidget->onChangeSize();
|
||||
}
|
||||
|
||||
void ewol::widget::PopUp::systemDraw(const ewol::DrawProperty& _displayProp) {
|
||||
|
@ -75,7 +75,7 @@ namespace ewol {
|
||||
virtual void periodicCall(const ewol::event::Time& _event);
|
||||
virtual void systemDraw(const ewol::DrawProperty& _displayProp);
|
||||
virtual void onRegenerateDisplay();
|
||||
virtual void onSizeChange();
|
||||
virtual void onChangeSize();
|
||||
virtual bool onEventInput(const ewol::event::Input& _event);
|
||||
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos);
|
||||
protected:
|
||||
|
@ -37,8 +37,8 @@ ewol::widget::Sizer::~Sizer() {
|
||||
}
|
||||
|
||||
|
||||
void ewol::widget::Sizer::onSizeChange() {
|
||||
ewol::Widget::onSizeChange();
|
||||
void ewol::widget::Sizer::onChangeSize() {
|
||||
ewol::Widget::onChangeSize();
|
||||
vec2 tmpBorderSize = m_borderSize->getPixel();
|
||||
EWOL_VERBOSE("[" << getId() << "] update size : " << m_size << " nbElement : " << m_subWidget.size() << " borderSize=" << tmpBorderSize << " from border=" << m_borderSize);
|
||||
vec2 localWidgetSize = m_size - tmpBorderSize*2.0f;
|
||||
@ -107,7 +107,7 @@ void ewol::widget::Sizer::onSizeChange() {
|
||||
tmpSizeMin.setY(sizeExpand);
|
||||
}
|
||||
if (it->canExpand().x() == true) {
|
||||
float sizeExpand = std::avg(tmpSizeMin.x(), minSize.x(), tmpSizeMax.x());
|
||||
float sizeExpand = std::avg(tmpSizeMin.x(), localWidgetSize.x(), tmpSizeMax.x());
|
||||
tmpSizeMin.setX(sizeExpand);
|
||||
}
|
||||
it->setSize(tmpSizeMin);
|
||||
@ -122,7 +122,7 @@ void ewol::widget::Sizer::onSizeChange() {
|
||||
tmpSizeMin.setX(sizeExpand);
|
||||
}
|
||||
if (it->canExpand().y() == true) {
|
||||
float sizeExpand = std::avg(tmpSizeMin.y(), minSize.y(), tmpSizeMax.y());
|
||||
float sizeExpand = std::avg(tmpSizeMin.y(), localWidgetSize.y(), tmpSizeMax.y());
|
||||
tmpSizeMin.setY(sizeExpand);
|
||||
}
|
||||
it->setSize(tmpSizeMin);
|
||||
@ -165,7 +165,7 @@ void ewol::widget::Sizer::onSizeChange() {
|
||||
if (it == nullptr) {
|
||||
continue;
|
||||
}
|
||||
it->onSizeChange();
|
||||
it->onChangeSize();
|
||||
}
|
||||
markToRedraw();
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ namespace ewol {
|
||||
private:
|
||||
ewol::compositing::Drawing m_draw; //!< Compositing drawing element for display the border.
|
||||
public: // Derived function
|
||||
virtual void onSizeChange();
|
||||
virtual void onChangeSize();
|
||||
virtual void calculateMinMaxSize();
|
||||
// overwrite the set fuction to start annimations ...
|
||||
virtual int32_t subWidgetAdd(std::shared_ptr<ewol::Widget> _newWidget);
|
||||
|
@ -43,8 +43,8 @@ ewol::widget::WSlider::~WSlider() {
|
||||
}
|
||||
|
||||
|
||||
void ewol::widget::WSlider::onSizeChange() {
|
||||
ewol::widget::ContainerN::onSizeChange();
|
||||
void ewol::widget::WSlider::onChangeSize() {
|
||||
ewol::widget::ContainerN::onChangeSize();
|
||||
if (m_windowsDestination == m_windowsSources) {
|
||||
auto it = m_subWidget.begin();
|
||||
std::advance(it, m_windowsDestination);
|
||||
@ -52,7 +52,7 @@ void ewol::widget::WSlider::onSizeChange() {
|
||||
&& *it != nullptr) {
|
||||
(*it)->setOrigin(m_origin+m_offset);
|
||||
(*it)->setSize(m_size);
|
||||
(*it)->onSizeChange();
|
||||
(*it)->onChangeSize();
|
||||
}
|
||||
} else {
|
||||
float factor = -1.0f;
|
||||
@ -73,7 +73,7 @@ void ewol::widget::WSlider::onSizeChange() {
|
||||
+ m_offset);
|
||||
}
|
||||
(*it)->setSize(m_size);
|
||||
(*it)->onSizeChange();
|
||||
(*it)->onChangeSize();
|
||||
}
|
||||
it = m_subWidget.begin();
|
||||
std::advance(it, m_windowsDestination);
|
||||
@ -89,7 +89,7 @@ void ewol::widget::WSlider::onSizeChange() {
|
||||
+ m_offset);
|
||||
}
|
||||
(*it)->setSize(m_size);
|
||||
(*it)->onSizeChange();
|
||||
(*it)->onChangeSize();
|
||||
}
|
||||
}
|
||||
markToRedraw();
|
||||
@ -205,7 +205,7 @@ void ewol::widget::WSlider::periodicCall(const ewol::event::Time& _event) {
|
||||
m_slidingProgress += _event.getDeltaCall()/m_transitionSpeed;
|
||||
m_slidingProgress = std::avg(0.0f, m_slidingProgress, 1.0f);
|
||||
}
|
||||
onSizeChange();
|
||||
onChangeSize();
|
||||
}
|
||||
|
||||
void ewol::widget::WSlider::systemDraw(const ewol::DrawProperty& _displayProp) {
|
||||
|
@ -99,7 +99,7 @@ namespace ewol {
|
||||
return m_transitionSlide;
|
||||
};
|
||||
public: // Derived function
|
||||
virtual void onSizeChange();
|
||||
virtual void onChangeSize();
|
||||
virtual void systemDraw(const ewol::DrawProperty& _displayProp);
|
||||
virtual void onRegenerateDisplay();
|
||||
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos);
|
||||
|
@ -146,7 +146,8 @@ ewol::Widget::~Widget() {
|
||||
shortCutClean();
|
||||
}
|
||||
|
||||
void ewol::Widget::onSizeChange() {
|
||||
void ewol::Widget::onChangeSize() {
|
||||
EWOL_VERBOSE("[" << getId() << "] {" << getObjectType() << "} update size : " << m_size);
|
||||
markToRedraw();
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ namespace ewol {
|
||||
* @brief Parent have set the size and the origin. the container need to update the subwidget property
|
||||
* @note : INTERNAL EWOL SYSTEM
|
||||
*/
|
||||
virtual void onSizeChange();
|
||||
virtual void onChangeSize();
|
||||
virtual void calculateSize() {};
|
||||
/**
|
||||
* @brief get the widget size
|
||||
|
@ -41,21 +41,21 @@ ewol::widget::Windows::~Windows() {
|
||||
m_popUpWidgetList.clear();
|
||||
}
|
||||
|
||||
void ewol::widget::Windows::onSizeChange() {
|
||||
ewol::Widget::onSizeChange();
|
||||
void ewol::widget::Windows::onChangeSize() {
|
||||
ewol::Widget::onChangeSize();
|
||||
if (m_subWidget != nullptr) {
|
||||
m_subWidget->calculateMinMaxSize();
|
||||
// TODO : do it better ... and manage gravity ...
|
||||
m_subWidget->setSize(m_size);
|
||||
m_subWidget->setOrigin(vec2(0.0f, 0.0f));
|
||||
m_subWidget->onSizeChange();
|
||||
m_subWidget->onChangeSize();
|
||||
}
|
||||
for (auto &it : m_popUpWidgetList) {
|
||||
if(it != nullptr) {
|
||||
it->calculateMinMaxSize();
|
||||
it->setSize(m_size);
|
||||
it->setOrigin(vec2(0.0f, 0.0f));
|
||||
it->onSizeChange();
|
||||
it->onChangeSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -172,7 +172,7 @@ void ewol::widget::Windows::setSubWidget(std::shared_ptr<ewol::Widget> _widget)
|
||||
}
|
||||
|
||||
// Regenerate the size calculation :
|
||||
onSizeChange();
|
||||
onChangeSize();
|
||||
}
|
||||
|
||||
void ewol::widget::Windows::popUpWidgetPush(std::shared_ptr<ewol::Widget> _widget) {
|
||||
@ -186,7 +186,7 @@ void ewol::widget::Windows::popUpWidgetPush(std::shared_ptr<ewol::Widget> _widge
|
||||
// force the focus on the basic widget ==> this remove many time the virual keyboard area
|
||||
_widget->keepFocus();
|
||||
// Regenerate the size calculation :
|
||||
onSizeChange();
|
||||
onChangeSize();
|
||||
// TODO : it is dangerous to access directly to the system ...
|
||||
getContext().resetIOEvent();
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ namespace ewol {
|
||||
virtual void systemDraw(const ewol::DrawProperty& _displayProp);
|
||||
public: // Derived function
|
||||
virtual void onRegenerateDisplay();
|
||||
virtual void onSizeChange();
|
||||
virtual void onChangeSize();
|
||||
virtual std::shared_ptr<ewol::Widget> getWidgetAtPos(const vec2& _pos);
|
||||
virtual void requestDestroyFromChild(const std::shared_ptr<Object>& _child);
|
||||
virtual std::shared_ptr<ewol::Object> getSubObjectNamed(const std::string& _objectName);
|
||||
|
@ -1,10 +1,14 @@
|
||||
<composer>
|
||||
<sizer mode="vert"
|
||||
expand="true,true"
|
||||
fill="true,true">
|
||||
fill="true,true"
|
||||
border="10px"
|
||||
border-color="#F008">
|
||||
<spacer expand="true,true" fill="true,true" color="red"/>
|
||||
<spacer expand="true,true" fill="true,true" color="green"/>
|
||||
|
||||
<spacer expand="false,true" fill="true,true" color="green"/>
|
||||
<spacer expand="true,true" fill="true,true" color="blue"/>
|
||||
|
||||
<!--
|
||||
<sizer mode="hori"
|
||||
expand="true,false"
|
||||
|
Loading…
x
Reference in New Issue
Block a user