void PropertyFieldPosition::onAction(const std::string& _value, bool _force) { EditorWidgets* ew = &EditorWidgets::getInstance(); WidgetContainer* widgetContainer = ew->find(mCurrentWidget); bool goodData = onCheckValue(); if (goodData) { if (widgetContainer->getRelativeMode()) { std::istringstream str(_value); MyGUI::FloatCoord float_coord; str >> float_coord; float_coord.left = float_coord.left / 100; float_coord.top = float_coord.top / 100; float_coord.width = float_coord.width / 100; float_coord.height = float_coord.height / 100; MyGUI::IntCoord coord = MyGUI::CoordConverter::convertFromRelative(float_coord, mCurrentWidget->getParentSize()); mCurrentWidget->setCoord(coord); EditorWidgets::getInstance().onSetWidgetCoord(mCurrentWidget, mCurrentWidget->getAbsoluteCoord(), "PropertiesPanelView"); } else {
void PropertyFieldColour::setColour(const MyGUI::Colour& _color, bool _final) { std::string value = MyGUI::utility::toString(_color.red, " ", _color.green, " ", _color.blue); mField->setOnlyText(value); onCheckValue(); onAction(value, _final); }
void PropertyFieldColour::showColourDialog() { mGoodData = onCheckValue(); if (mGoodData) mPreviewColour = getColour(); else mPreviewColour = MyGUI::Colour::White; mColourPanel->setColour(mPreviewColour); mColourPanel->setAlphaSupport(false); mColourPanel->doModal(); }
void PropertyFieldEditBox::setValue(const std::string& _value) { std::string DEFAULT_VALUE = replaceTags("ColourDefault") + DEFAULT_STRING; if (_value.empty()) { mField->setCaption(DEFAULT_VALUE); } else { mField->setOnlyText(_value); onCheckValue(); } }
void PropertyFieldEditBox::notifyApplyProperties(MyGUI::Widget* _sender, bool _force) { std::string DEFAULT_VALUE = replaceTags("ColourDefault") + DEFAULT_STRING; std::string value = mField->getOnlyText(); if (value == DEFAULT_STRING && mField->getCaption() == DEFAULT_VALUE) value = ""; bool goodData = onCheckValue(); if (goodData || _force) { onAction(value, true); } }