mirror of
https://github.com/edubart/otclient.git
synced 2025-11-07 13:56:22 +01:00
add horizontal box layout, enter keypress fix
This commit is contained in:
@@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user