You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openmw/components/lua_ui/textedit.cpp

44 lines
1.3 KiB
C++

3 years ago
#include "textedit.hpp"
#include "alignment.hpp"
3 years ago
namespace LuaUi
{
void LuaTextEdit::initialize()
{
changeWidgetSkin("LuaTextEdit");
eventEditTextChange += MyGUI::newDelegate(this, &LuaTextEdit::textChange);
WidgetExtension::initialize();
}
void LuaTextEdit::deinitialize()
{
eventEditTextChange -= MyGUI::newDelegate(this, &LuaTextEdit::textChange);
WidgetExtension::deinitialize();
}
3 years ago
void LuaTextEdit::updateProperties()
3 years ago
{
setCaption(propertyValue("text", std::string()));
setFontHeight(propertyValue("textSize", 10));
setTextColour(propertyValue("textColor", MyGUI::Colour(0, 0, 0, 1)));
setEditMultiLine(propertyValue("multiline", false));
setEditWordWrap(propertyValue("wordWrap", false));
Alignment horizontal(propertyValue("textAlignH", Alignment::Start));
Alignment vertical(propertyValue("textAlignV", Alignment::Start));
setTextAlign(alignmentToMyGui(horizontal, vertical));
setEditStatic(propertyValue("readOnly", false));
3 years ago
WidgetExtension::updateProperties();
3 years ago
}
void LuaTextEdit::textChange(MyGUI::EditBox*)
{
triggerEvent("textChanged", sol::make_object(lua(), getCaption().asUTF8()));
}
3 years ago
}