| 352 | } |
| 353 | |
| 354 | void ColourPanel::notifyEditTextChangeAlpha(MyGUI::EditBox* _sender) |
| 355 | { |
| 356 | MyGUI::UString value = _sender->getOnlyText(); |
| 357 | |
| 358 | mCurrentColour.alpha = MyGUI::utility::parseValue<float>(value); |
| 359 | |
| 360 | bool validate = true; |
| 361 | if (mCurrentColour.alpha > 1) |
| 362 | { |
| 363 | mCurrentColour.alpha = 1; |
| 364 | validate = false; |
| 365 | } |
| 366 | else if (mCurrentColour.alpha < 0) |
| 367 | { |
| 368 | mCurrentColour.alpha = 0; |
| 369 | validate = false; |
| 370 | } |
| 371 | |
| 372 | if (!validate) |
| 373 | value = MyGUI::utility::toString(mCurrentColour.alpha); |
| 374 | |
| 375 | size_t index = _sender->getTextCursor(); |
| 376 | _sender->setCaption(value); |
| 377 | _sender->setTextCursor(index); |
| 378 | |
| 379 | mAlphaSlider->setScrollPosition( |
| 380 | static_cast<size_t>(static_cast<float>(mAlphaSlider->getScrollRange() - 1) * mCurrentColour.alpha)); |
| 381 | mColourView->setAlpha(mCurrentColour.alpha); |
| 382 | |
| 383 | eventPreviewColour(mCurrentColour); |
| 384 | } |
| 385 | |
| 386 | void ColourPanel::notifyScrollChangePositionAlpha(MyGUI::ScrollBar* _sender, size_t _position) |
| 387 | { |
nothing calls this directly
no test coverage detected