mirror of
https://github.com/edubart/otclient.git
synced 2025-10-20 06:23:26 +02:00
UI tweaks
This commit is contained in:
@@ -101,8 +101,10 @@ bool UIGridLayout::internalUpdate()
|
||||
Point virtualPos = Point(column * (m_cellSize.width() + cellSpacing), line * (m_cellSize.height() + cellSpacing));
|
||||
preferredHeight = virtualPos.y + m_cellSize.height();
|
||||
Point pos = topLeft + virtualPos - parentWidget->getVirtualOffset();
|
||||
Rect dest = Rect(pos, m_cellSize);
|
||||
dest.expand(-widget->getMarginTop(), -widget->getMarginRight(), -widget->getMarginBottom(), -widget->getMarginLeft());
|
||||
|
||||
if(widget->setRect(Rect(pos, m_cellSize)))
|
||||
if(widget->setRect(dest))
|
||||
changed = true;
|
||||
|
||||
index++;
|
||||
|
@@ -458,6 +458,13 @@ void UIWidget::unlockChild(const UIWidgetPtr& child)
|
||||
}
|
||||
}
|
||||
|
||||
void UIWidget::mergeStyle(const OTMLNodePtr& styleNode)
|
||||
{
|
||||
applyStyle(styleNode);
|
||||
m_style->merge(styleNode);
|
||||
updateStyle();
|
||||
}
|
||||
|
||||
void UIWidget::applyStyle(const OTMLNodePtr& styleNode)
|
||||
{
|
||||
if(m_destroyed)
|
||||
|
@@ -90,6 +90,7 @@ public:
|
||||
void moveChildToIndex(const UIWidgetPtr& child, int index);
|
||||
void lockChild(const UIWidgetPtr& child);
|
||||
void unlockChild(const UIWidgetPtr& child);
|
||||
void mergeStyle(const OTMLNodePtr& styleNode);
|
||||
void applyStyle(const OTMLNodePtr& styleNode);
|
||||
void addAnchor(Fw::AnchorEdge anchoredEdge, const std::string& hookedWidgetId, Fw::AnchorEdge hookedEdge);
|
||||
void removeAnchor(Fw::AnchorEdge anchoredEdge);
|
||||
|
@@ -43,7 +43,7 @@ void UIWidget::updateText()
|
||||
// update rect size
|
||||
if(!m_rect.isValid() || m_textAutoResize) {
|
||||
Size textBoxSize = getTextSize();
|
||||
textBoxSize += Size(m_padding.left + m_padding.right, m_padding.top + m_padding.left);
|
||||
textBoxSize += Size(m_padding.left + m_padding.right, m_padding.top + m_padding.bottom);
|
||||
Size size = getSize();
|
||||
if(size.width() <= 0 || (m_textAutoResize && !m_textWrap))
|
||||
size.setWidth(textBoxSize.width());
|
||||
|
Reference in New Issue
Block a user