//-------------------------------------------------------------------------- void EnvironmentDialog::notifyEditTextChange(MyGUI::EditBox* _sender) { if (_sender == mStartFog) { mStart = MyGUI::utility::parseFloat(mStartFog->getCaption()); SetFog(); } else if (_sender == mEndFog) { mEnd = MyGUI::utility::parseFloat(mEndFog->getCaption()); SetFog(); } else { MyGUI::EditBox* edit = static_cast<MyGUI::EditBox*>(_sender); size_t cursor = edit->getTextCursor(); size_t num = MyGUI::utility::parseSizeT(edit->getCaption()); if (num > 255) num = 255; edit->setCaption(MyGUI::utility::toString(num)); if (cursor < edit->getTextLength()) edit->setTextCursor(cursor); mFogColour = ColourValue( MyGUI::utility::parseFloat(mEditRed->getCaption()) / 255.0f, MyGUI::utility::parseFloat(mEditGreen->getCaption()) / 255.0f, MyGUI::utility::parseFloat(mEditBlue->getCaption()) / 255.0f); SetFog(); } }
void ColourPanel::notifyEditTextChange(MyGUI::EditBox* _sender) { MyGUI::EditBox* edit = static_cast<MyGUI::EditBox*>(_sender); size_t cursor = edit->getTextCursor(); size_t num = MyGUI::utility::parseSizeT(edit->getOnlyText()); if (num > 255) num = 255; edit->setCaption(MyGUI::utility::toString(num)); if (cursor < edit->getTextLength()) edit->setTextCursor(cursor); MyGUI::Colour colour( MyGUI::utility::parseFloat(mEditRed->getOnlyText()) / 255.0f, MyGUI::utility::parseFloat(mEditGreen->getOnlyText()) / 255.0f, MyGUI::utility::parseFloat(mEditBlue->getOnlyText()) / 255.0f); updateFromColour(colour); }