| 17 | } |
| 18 | |
| 19 | void ColourPanel::OnInitialise(Control* _parent, MyGUI::Widget* _place, std::string_view /*_layoutName*/) |
| 20 | { |
| 21 | Control::OnInitialise(_parent, _place, GetLayoutName(this)); |
| 22 | |
| 23 | InitialiseByAttributes(this); |
| 24 | |
| 25 | setDialogRoot(mMainWidget); |
| 26 | |
| 27 | mTextureName = MyGUI::utility::toString((size_t)this, "_ColourGradient"); |
| 28 | |
| 29 | mCurrentColour = MyGUI::Colour::Green; |
| 30 | mBaseColour = MyGUI::Colour::Green; |
| 31 | |
| 32 | mColourRect->eventMouseButtonPressed += MyGUI::newDelegate(this, &ColourPanel::notifyMouseButtonPressed); |
| 33 | mColourRect->eventMouseDrag += MyGUI::newDelegate(this, &ColourPanel::notifyMouseDrag); |
| 34 | mImageColourPicker->eventMouseDrag += MyGUI::newDelegate(this, &ColourPanel::notifyMouseDrag); |
| 35 | mScrollRange->eventScrollChangePosition += MyGUI::newDelegate(this, &ColourPanel::notifyScrollChangePosition); |
| 36 | mAlphaSlider->eventScrollChangePosition += |
| 37 | MyGUI::newDelegate(this, &ColourPanel::notifyScrollChangePositionAlpha); |
| 38 | |
| 39 | mEditRed->eventEditTextChange += MyGUI::newDelegate(this, &ColourPanel::notifyEditTextChange); |
| 40 | mEditGreen->eventEditTextChange += MyGUI::newDelegate(this, &ColourPanel::notifyEditTextChange); |
| 41 | mEditBlue->eventEditTextChange += MyGUI::newDelegate(this, &ColourPanel::notifyEditTextChange); |
| 42 | mInputAlpha->eventEditTextChange += MyGUI::newDelegate(this, &ColourPanel::notifyEditTextChangeAlpha); |
| 43 | |
| 44 | CommandManager::getInstance().getEvent("Command_ColorAccept")->connect(this, &ColourPanel::commandColorAccept); |
| 45 | CommandManager::getInstance().getEvent("Command_ColorCancel")->connect(this, &ColourPanel::commandColorCancel); |
| 46 | |
| 47 | mColourRange.emplace_back(1, 0, 0); |
| 48 | mColourRange.emplace_back(1, 0, 1); |
| 49 | mColourRange.emplace_back(0, 0, 1); |
| 50 | mColourRange.emplace_back(0, 1, 1); |
| 51 | mColourRange.emplace_back(0, 1, 0); |
| 52 | mColourRange.emplace_back(1, 1, 0); |
| 53 | mColourRange.push_back(mColourRange[0]); |
| 54 | |
| 55 | mMainWidget->setVisible(false); |
| 56 | |
| 57 | createTexture(); |
| 58 | |
| 59 | updateFirst(); |
| 60 | } |
| 61 | |
| 62 | void ColourPanel::updateFirst() |
| 63 | { |
nothing calls this directly
no test coverage detected