mirror of
https://github.com/edubart/otclient.git
synced 2025-10-16 12:34:55 +02:00
improved charlist
This commit is contained in:
@@ -12,7 +12,9 @@ void UILabel::setup()
|
||||
void UILabel::render()
|
||||
{
|
||||
UIWidget::render();
|
||||
m_font->renderText(m_text, m_rect, m_align, m_foregroundColor);
|
||||
Rect textRect = m_rect;
|
||||
textRect.setTopLeft(textRect.topLeft() + m_offset);
|
||||
m_font->renderText(m_text, textRect, m_align, m_foregroundColor);
|
||||
}
|
||||
|
||||
void UILabel::setText(const std::string& text)
|
||||
@@ -43,5 +45,8 @@ void UILabel::onStyleApply(const OTMLNodePtr& styleNode)
|
||||
setText(node->value());
|
||||
else if(node->tag() == "align")
|
||||
setAlign(fw::translateAlignment(node->value()));
|
||||
else if(node->tag() == "offset") {
|
||||
setOffset(node->value<Point>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -13,15 +13,18 @@ public:
|
||||
|
||||
void setText(const std::string& text);
|
||||
void setAlign(AlignmentFlag align) { m_align = align; }
|
||||
void setOffset(const Point& offset) { m_offset = offset; }
|
||||
|
||||
std::string getText() const { return m_text; }
|
||||
AlignmentFlag getAlign() const { return m_align; }
|
||||
Point getOffset() const { return m_offset; }
|
||||
|
||||
protected:
|
||||
virtual void onStyleApply(const OTMLNodePtr& styleNode);
|
||||
|
||||
private:
|
||||
std::string m_text;
|
||||
Point m_offset;
|
||||
AlignmentFlag m_align;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user