Provide the option to suppress lua call in setText

This commit is contained in:
BenDol
2014-04-03 05:20:35 +13:00
parent d45fbcb10f
commit 1074b6b787
4 changed files with 24 additions and 8 deletions

View File

@@ -492,7 +492,7 @@ public:
void resizeToText() { setSize(getTextSize()); }
void clearText() { setText(""); }
void setText(std::string text);
void setText(std::string text, bool fireLuaCall = true);
void setTextAlign(Fw::AlignmentFlag align) { m_textAlign = align; updateText(); }
void setTextOffset(const Point& offset) { m_textOffset = offset; updateText(); }
void setTextWrap(bool textWrap) { m_textWrap = textWrap; updateText(); }

View File

@@ -112,7 +112,7 @@ void UIWidget::onFontChange(const std::string& font)
callLuaField("onFontChange", font);
}
void UIWidget::setText(std::string text)
void UIWidget::setText(std::string text, bool fireLuaCall)
{
if(m_textOnlyUpperCase)
stdext::toupper(text);
@@ -125,7 +125,10 @@ void UIWidget::setText(std::string text)
updateText();
text = m_text;
onTextChange(text, oldText);
if(fireLuaCall) {
onTextChange(text, oldText);
}
}
void UIWidget::setFont(const std::string& fontName)