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)
|
|
|
|
{}
|
|
|
|
|
2021-11-18 15:19:54 +00:00
|
|
|
void LuaText::initialize()
|
|
|
|
{
|
|
|
|
WidgetExtension::initialize();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool LuaText::setPropertyRaw(std::string_view name, sol::object value)
|
|
|
|
{
|
|
|
|
if (name == "caption")
|
|
|
|
{
|
|
|
|
if (!value.is<std::string>())
|
|
|
|
return false;
|
|
|
|
setCaption(value.as<std::string>());
|
|
|
|
}
|
|
|
|
else if (name == "autoSize")
|
|
|
|
{
|
|
|
|
if (!value.is<bool>())
|
|
|
|
return false;
|
|
|
|
mAutoSized = value.as<bool>();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return WidgetExtension::setPropertyRaw(name, value);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
MyGUI::IntSize LuaText::calculateSize()
|
|
|
|
{
|
|
|
|
if (mAutoSized)
|
|
|
|
return getTextSize();
|
|
|
|
else
|
|
|
|
return WidgetExtension::calculateSize();
|
|
|
|
}
|
|
|
|
}
|