BoxSizer to Sizer

This commit is contained in:
2018-08-15 22:04:06 -04:00
parent 353dc21750
commit bd3c111fa1
67 changed files with 369 additions and 308 deletions
@@ -287,11 +287,50 @@ cWindow* cWindow::getParent()
return mp_parent;
}
const unsigned long int cWindow::getFillParentSize()
{
unsigned long int rtn = 0;
int count = 0;
GUIHelpers::Size size = getSize(false);
std::vector<cWindow*>::iterator it;
for (it = m_children.begin(); it < m_children.end(); it++) {
if ((*it)->getLayout() == GUIHelpers::eLayout::WRAP_CONTENT) {
size -= (*it)->getSize();
}
else {
count++;
}
}
switch (m_orientation) {
case GUIHelpers::eOrientation::VERTICAL:
rtn = size.y;
break;
case GUIHelpers::eOrientation::HORIZONTAL:
rtn = size.x;
break;
default:
break;
}
//if ((rtn % count) != 0)
rtn /= count;
return rtn;
}
/*virtual*/ const GUIHelpers::eType cWindow::getType() const
{
return GUIHelpers::eType::CWINDOW;
}
/// protected
/*virtual*/ void cWindow::Resize()
@@ -316,12 +355,19 @@ cWindow* cWindow::getParent()
mySize = mp_parent->getSize(false);
if (mp_parent->getType() == GUIHelpers::eType::CLAYOUT) {
if (mp_parent->getChildren().size() > 1)
unsigned long int fillSize = 0;
if (mp_parent->getChildren().size() > 1) {
fillSize = mp_parent->getFillParentSize();
mySize -= mp_parent->getChildrenSize(this);
if (mp_parent->getOrientation() == GUIHelpers::eOrientation::VERTICAL)
}
if (mp_parent->getOrientation() == GUIHelpers::eOrientation::VERTICAL) {
mySize.x = m_size.x;
if (mp_parent->getOrientation() == GUIHelpers::eOrientation::HORIZONTAL)
mySize.y = fillSize;
}
if (mp_parent->getOrientation() == GUIHelpers::eOrientation::HORIZONTAL) {
mySize.y = m_size.y;
mySize.x = fillSize;
}
}
mySize.x -= m_padding.x + m_padding.w;
@@ -460,6 +506,10 @@ std::vector<cWindow*>& cWindow::getChildren()
}
/// private
void cWindow::Rebuild(cWindow * const parent, const GUIHelpers::eLayout & layout)
{
}
void cWindow::AddSize( const int x, const int y, GUIHelpers::Size& mySize ) const
{
int addFrom = x;