MCPcopy Create free account
hub / github.com/MyGUI/mygui / notifyEditTextChangeAlpha

Method notifyEditTextChangeAlpha

Tools/EditorFramework/ColourPanel.cpp:354–384  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 8

toStringFunction · 0.85
getTextCursorMethod · 0.80
setTextCursorMethod · 0.80
getScrollRangeMethod · 0.80
getOnlyTextMethod · 0.45
setCaptionMethod · 0.45
setScrollPositionMethod · 0.45
setAlphaMethod · 0.45

Tested by

no test coverage detected