1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 18:59:57 +00:00
openmw/components/lua_ui/text.cpp
2021-11-19 18:05:43 +01:00

43 lines
907 B
C++

#include "text.hpp"
namespace LuaUi
{
LuaText::LuaText()
: mAutoSized(true)
{}
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();
}
}