void SettingsUpdateResourcesControl::notifyClickAdd(MyGUI::Widget* _sender) { mResources->addItem(""); mResources->beginToItemAt(mResources->getItemCount() - 1); mTextFieldControl->setCaption(replaceTags("CaptionAddResource")); mTextFieldControl->setTextField(""); MyGUI::Widget* widget = mResources->getWidgetByIndex(mResources->getItemCount() - 1); if (widget != nullptr) mTextFieldControl->setCoord(MyGUI::IntCoord(widget->getAbsoluteLeft(), widget->getAbsoluteTop(), widget->getWidth(), widget->getHeight())); mTextFieldControl->doModal(); }
void ColourPanel::notifyMouseDrag(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id) { if (_id != MyGUI::MouseButton::Left) return; MyGUI::Widget* parent = mImageColourPicker->getParent(); MyGUI::IntPoint point(_left - parent->getAbsoluteLeft(), _top - parent->getAbsoluteTop()); if (point.left < 0) point.left = 0; if (point.top < 0) point.top = 0; if (point.left > mColourRect->getWidth()) point.left = mColourRect->getWidth(); if (point.top > mColourRect->getHeight()) point.top = mColourRect->getHeight(); mImageColourPicker->setPosition(point.left - (mImageColourPicker->getWidth() / 2), point.top - (mImageColourPicker->getHeight() / 2)); updateFromPoint(point); }
void ListBoxDataControl::OnRenameData() { size_t index = mListBox->getIndexSelected(); if (index != MyGUI::ITEM_NONE) { mListBox->beginToItemAt(index); MyGUI::Widget* widget = mListBox->getWidgetByIndex(index); if (widget != nullptr) { DataPtr data = *mListBox->getItemDataAt<DataPtr>(index); mTextFieldControl->setCaption(replaceTags("CaptionEnterName")); mTextFieldControl->setTextField(data->getPropertyValue(mPropertyForName)); mTextFieldControl->setUserData(data); mTextFieldControl->setCoord(MyGUI::IntCoord(widget->getAbsoluteLeft(), widget->getAbsoluteTop(), widget->getWidth(), widget->getHeight())); mTextFieldControl->doModal(); } } }