2021-11-18 15:19:54 +00:00
|
|
|
|
|
|
|
#include "text.hpp"
|
|
|
|
|
|
|
|
namespace LuaUi
|
|
|
|
{
|
2021-11-19 15:21:17 +00:00
|
|
|
LuaText::LuaText()
|
|
|
|
: mAutoSized(true)
|
2022-01-28 09:31:45 +00:00
|
|
|
{
|
|
|
|
changeWidgetSkin("NormalText");
|
|
|
|
}
|
|
|
|
|
|
|
|
void LuaText::updateProperties()
|
|
|
|
{
|
|
|
|
setCaption(propertyValue("caption", std::string()));
|
|
|
|
mAutoSized = propertyValue("autoSize", true);
|
|
|
|
WidgetExtension::updateProperties();
|
|
|
|
}
|
2021-11-19 15:21:17 +00:00
|
|
|
|
2022-01-28 09:31:45 +00:00
|
|
|
void LuaText::setCaption(const MyGUI::UString& caption)
|
2021-11-18 15:19:54 +00:00
|
|
|
{
|
2022-01-28 09:31:45 +00:00
|
|
|
MyGUI::TextBox::setCaption(caption);
|
|
|
|
if (mAutoSized)
|
|
|
|
updateCoord();
|
2021-11-18 15:19:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MyGUI::IntSize LuaText::calculateSize()
|
|
|
|
{
|
|
|
|
if (mAutoSized)
|
|
|
|
return getTextSize();
|
|
|
|
else
|
|
|
|
return WidgetExtension::calculateSize();
|
|
|
|
}
|
|
|
|
}
|