add horizontal box layout, enter keypress fix

This commit is contained in:
Eduardo Bart
2012-01-15 11:57:42 -02:00
parent 8bc879d295
commit a238111c07
13 changed files with 269 additions and 27 deletions

View File

@@ -24,23 +24,13 @@
#include "uiwidget.h"
#include <framework/core/eventdispatcher.h>
UIVerticalLayout::UIVerticalLayout(UIWidgetPtr parentWidget)
: UILayout(parentWidget)
{
m_spacing = 0;
}
void UIVerticalLayout::applyStyle(const OTMLNodePtr& styleNode)
{
UILayout::applyStyle(styleNode);
UIBoxLayout::applyStyle(styleNode);
for(const OTMLNodePtr& node : styleNode->children()) {
if(node->tag() == "align-bottom")
setAlignBottom(node->value<bool>());
else if(node->tag() == "spacing")
setSpacing(node->value<int>());
else if(node->tag() == "fit-parent")
setFitParent(node->value<bool>());
}
}
@@ -88,10 +78,10 @@ void UIVerticalLayout::internalUpdate()
prefferedHeight -= m_spacing;
prefferedHeight += parentWidget->getPaddingTop() + parentWidget->getPaddingBottom();
if(m_fitParent && prefferedHeight != parentWidget->getHeight()) {
if(m_fitChildren && prefferedHeight != parentWidget->getHeight()) {
// must set the preffered width later
g_dispatcher.addEvent([=] {
parentWidget->setHeight(prefferedHeight);
});
}
}
}