|
@@ -13,7 +13,7 @@ void Layout::align(Control* control, const Container* container)
|
|
|
|
|
|
|
|
if (control->_alignment != Control::ALIGN_TOP_LEFT ||
|
|
if (control->_alignment != Control::ALIGN_TOP_LEFT ||
|
|
|
control->_autoWidth || control->_autoHeight)
|
|
control->_autoWidth || control->_autoHeight)
|
|
|
- {
|
|
|
|
|
|
|
+ {
|
|
|
Rectangle controlBounds = control->getBounds();
|
|
Rectangle controlBounds = control->getBounds();
|
|
|
const Theme::Margin& controlMargin = control->getMargin();
|
|
const Theme::Margin& controlMargin = control->getMargin();
|
|
|
const Rectangle& containerBounds = container->getBounds();
|
|
const Rectangle& containerBounds = container->getBounds();
|
|
@@ -35,7 +35,7 @@ void Layout::align(Control* control, const Container* container)
|
|
|
clipHeight = containerBounds.height - containerBorder.top - containerBorder.bottom - containerPadding.top - containerPadding.bottom;
|
|
clipHeight = containerBounds.height - containerBorder.top - containerBorder.bottom - containerPadding.top - containerPadding.bottom;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (control->_autoWidth)
|
|
|
|
|
|
|
+ if (control->_autoWidth)
|
|
|
{
|
|
{
|
|
|
controlBounds.width = clipWidth - controlMargin.left - controlMargin.right;
|
|
controlBounds.width = clipWidth - controlMargin.left - controlMargin.right;
|
|
|
}
|
|
}
|
|
@@ -54,6 +54,10 @@ void Layout::align(Control* control, const Container* container)
|
|
|
{
|
|
{
|
|
|
controlBounds.y = clipHeight * 0.5f - controlBounds.height * 0.5f;
|
|
controlBounds.y = clipHeight * 0.5f - controlBounds.height * 0.5f;
|
|
|
}
|
|
}
|
|
|
|
|
+ else if ((control->_alignment & Control::ALIGN_TOP) == Control::ALIGN_TOP)
|
|
|
|
|
+ {
|
|
|
|
|
+ controlBounds.y = 0;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// Horizontal alignment
|
|
// Horizontal alignment
|
|
|
if ((control->_alignment & Control::ALIGN_RIGHT) == Control::ALIGN_RIGHT)
|
|
if ((control->_alignment & Control::ALIGN_RIGHT) == Control::ALIGN_RIGHT)
|
|
@@ -64,6 +68,10 @@ void Layout::align(Control* control, const Container* container)
|
|
|
{
|
|
{
|
|
|
controlBounds.x = clipWidth * 0.5f - controlBounds.width * 0.5f;
|
|
controlBounds.x = clipWidth * 0.5f - controlBounds.width * 0.5f;
|
|
|
}
|
|
}
|
|
|
|
|
+ else if ((control->_alignment & Control::ALIGN_LEFT) == Control::ALIGN_LEFT)
|
|
|
|
|
+ {
|
|
|
|
|
+ controlBounds.x = 0;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
control->setBounds(controlBounds);
|
|
control->setBounds(controlBounds);
|
|
|
}
|
|
}
|