6
#include "Precompiled.h"
7
#include "PropertyInt4Control.h"
13
PropertyInt4Control::PropertyInt4Control(MyGUI::Widget* _parent) :
14
wraps::BaseLayout("PropertyEditControl.layout", _parent),
17
assignWidget(mEdit, "Edit");
19
mEdit->eventEditTextChange += MyGUI::newDelegate(this, &PropertyInt4Control::notifyEditTextChange);
22
PropertyInt4Control::~PropertyInt4Control()
24
mEdit->eventEditTextChange -= MyGUI::newDelegate(this, &PropertyInt4Control::notifyEditTextChange);
27
void PropertyInt4Control::updateProperty()
29
Property* proper = getProperty();
30
if (proper != nullptr)
32
mEdit->setEnabled(!proper->getReadOnly());
33
mEdit->setCaption(proper->getValue());
35
bool validate = isValidate();
40
mEdit->setCaption("");
41
mEdit->setEnabled(false);
45
void PropertyInt4Control::notifyEditTextChange(MyGUI::EditBox* _sender)
47
Property* proper = getProperty();
48
if (proper != nullptr)
50
bool validate = isValidate();
52
proper->setValue(getClearValue(), getTypeName());
58
bool PropertyInt4Control::isValidate()
60
MyGUI::UString value = mEdit->getOnlyText();
66
if (!MyGUI::utility::parseComplex(value, value1, value2, value3, value4))
72
MyGUI::UString PropertyInt4Control::getClearValue()
74
MyGUI::UString value = mEdit->getOnlyText();
80
if (MyGUI::utility::parseComplex(value, value1, value2, value3, value4))
81
return MyGUI::utility::toString(value1, " ", value2, " ", value3, " ", value4);
86
void PropertyInt4Control::setColour(bool _validate)
88
MyGUI::UString value = mEdit->getOnlyText();
90
value = replaceTags("ColourError") + value;
92
size_t index = mEdit->getTextCursor();
93
mEdit->setCaption(value);
94
mEdit->setTextCursor(index);