1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-22 08:23:52 +00:00
openmw/components/lua_ui/text.cpp

44 lines
907 B
C++
Raw Normal View History

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();
}
}