6
#include "Precompiled.h"
7
#include "PropertyInt2Control.h"
13
PropertyInt2Control::PropertyInt2Control(MyGUI::Widget* _parent) :
14
wraps::BaseLayout("PropertyEditControl.layout", _parent),
17
assignWidget(mEdit, "Edit");
19
mEdit->eventEditTextChange += MyGUI::newDelegate(this, &PropertyInt2Control::notifyEditTextChange);
22
PropertyInt2Control::~PropertyInt2Control()
24
mEdit->eventEditTextChange -= MyGUI::newDelegate(this, &PropertyInt2Control::notifyEditTextChange);
27
void PropertyInt2Control::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 PropertyInt2Control::notifyEditTextChange(MyGUI::EditBox* _sender)
47
Property* proper = getProperty();
48
if (proper != nullptr)
50
bool validate = isValidate();
52
proper->setValue(getClearValue(), getTypeName());
58
bool PropertyInt2Control::isValidate()
60
MyGUI::UString value = mEdit->getOnlyText();
64
if (!MyGUI::utility::parseComplex(value, value1, value2))
70
MyGUI::UString PropertyInt2Control::getClearValue()
72
MyGUI::UString value = mEdit->getOnlyText();
76
if (MyGUI::utility::parseComplex(value, value1, value2))
77
return MyGUI::utility::toString(value1, " ", value2);
82
void PropertyInt2Control::setColour(bool _validate)
84
MyGUI::UString value = mEdit->getOnlyText();
86
value = replaceTags("ColourError") + value;
88
size_t index = mEdit->getTextCursor();
89
mEdit->setCaption(value);
90
mEdit->setTextCursor(index);