Many UI improvements and minor fixes

This commit is contained in:
Eduardo Bart
2013-01-08 18:01:47 -02:00
parent a8d3bb97ea
commit 5344a179a4
16 changed files with 152 additions and 65 deletions

View File

@@ -46,8 +46,8 @@ bool UIHorizontalLayout::internalUpdate()
std::reverse(widgets.begin(), widgets.end());
bool changed = false;
Rect clippingRect = parentWidget->getPaddingRect();
Point pos = (m_alignRight) ? clippingRect.topRight() : clippingRect.topLeft();
Rect paddingRect = parentWidget->getPaddingRect();
Point pos = (m_alignRight) ? paddingRect.topRight() : paddingRect.topLeft();
int preferredWidth = 0;
int gap;
@@ -62,13 +62,19 @@ bool UIHorizontalLayout::internalUpdate()
preferredWidth += gap;
if(widget->isFixedSize()) {
// center it
pos.y = clippingRect.top() + (clippingRect.height() - (widget->getMarginTop() + widget->getHeight() + widget->getMarginBottom()))/2;
pos.y = std::max(pos.y, parentWidget->getY());
if(widget->getTextAlign() & Fw::AlignTop) {
pos.y = paddingRect.top() + widget->getMarginTop();
} else if(widget->getTextAlign() & Fw::AlignBottom) {
pos.y = paddingRect.bottom() - widget->getHeight() - widget->getMarginBottom();
pos.y = std::max(pos.y, paddingRect.top());
} else { // center it
pos.y = paddingRect.top() + (paddingRect.height() - (widget->getMarginTop() + widget->getHeight() + widget->getMarginBottom()))/2;
pos.y = std::max(pos.y, paddingRect.top());
}
} else {
// expand height
size.setHeight(clippingRect.height() - (widget->getMarginTop() + widget->getMarginBottom()));
pos.y = clippingRect.top() + (clippingRect.height() - size.height())/2;
size.setHeight(paddingRect.height() - (widget->getMarginTop() + widget->getMarginBottom()));
pos.y = paddingRect.top() + (paddingRect.height() - size.height())/2;
}
if(widget->setRect(Rect(pos - parentWidget->getVirtualOffset(), size)))