void FontManager::initialise() { MYGUI_ASSERT(!mIsInitialise, getClassTypeName() << " initialised twice"); MYGUI_LOG(Info, "* Initialise: " << getClassTypeName()); ResourceManager::getInstance().registerLoadXmlDelegate(XML_TYPE) = newDelegate(this, &FontManager::_load); FactoryManager::getInstance().registerFactory<ResourceManualFont>(XML_TYPE_RESOURCE); FactoryManager::getInstance().registerFactory<ResourceTrueTypeFont>(XML_TYPE_RESOURCE); mDefaultName = "Default"; MYGUI_LOG(Info, getClassTypeName() << " successfully initialized"); mIsInitialise = true; }
RenderBoxWrap::RenderBoxWrap(MyGUI::RenderBoxPtr _box) : mEntity(nullptr), mRttCam(nullptr), mCamNode(nullptr), mRotationSpeed(RENDER_BOX_AUTO_ROTATION_SPEED), mMouseRotation(false), mLeftPressed(false), mAutoRotation(false), mEntityState(nullptr), mScale(1.0f), mCurrentScale(1.0f), mUseScale(false), mNodeForSync(nullptr), mSceneManagerForSync(nullptr), mRenderBox(_box), mFrameAdvise(false) { createScene(); mRenderBox->eventMouseDrag = newDelegate(this, &RenderBoxWrap::notifyMouseDrag); mRenderBox->eventMouseWheel = newDelegate(this, &RenderBoxWrap::notifyMouseWheel); mRenderBox->eventMouseButtonPressed = newDelegate(this, &RenderBoxWrap::notifyMouseButtonPressed); mRenderBox->eventMouseButtonReleased = newDelegate(this, &RenderBoxWrap::notifyMouseButtonReleased); mRenderBox->eventUpdateViewport = newDelegate(this, &RenderBoxWrap::notifyUpdateViewport); }
void WidgetManager::shutdown() { MYGUI_ASSERT(mIsInitialise, getClassTypeName() << " is not initialised"); MYGUI_LOG(Info, "* Shutdown: " << getClassTypeName()); Gui::getInstance().eventFrameStart -= newDelegate(this, &WidgetManager::notifyEventFrameStart); _deleteDelayWidgets(); mVectorIUnlinkWidget.clear(); FactoryManager::getInstance().unregisterFactory("Widget"); MYGUI_LOG(Info, getClassTypeName() << " successfully shutdown"); mIsInitialise = false; }
void ComboBox::hideList() { mListShow = false; if (mShowSmooth) { ControllerFadeAlpha* controller = createControllerFadeAlpha(COMBO_ALPHA_MIN, COMBO_ALPHA_COEF, false); controller->eventPostAction += newDelegate(this, &ComboBox::actionWidgetHide); ControllerManager::getInstance().addItem(mList, controller); } else { mList->setVisible(false); } }
Console::Console() : BaseLayout("Console.layout") { assignWidget(mListHistory, "list_History"); assignWidget(mComboCommand, "combo_Command"); assignWidget(mButtonSubmit, "button_Submit"); MyGUI::Window* window = mMainWidget->castType<MyGUI::Window>(false); if (window != nullptr) window->eventWindowButtonPressed += newDelegate(this, &Console::notifyWindowButtonPressed); mStringCurrent = mMainWidget->getUserString("Current"); mStringError = mMainWidget->getUserString("Error"); mStringSuccess = mMainWidget->getUserString("Success"); mStringUnknow = mMainWidget->getUserString("Unknown"); mStringFormat = mMainWidget->getUserString("Format"); mAutocomleted = false; mComboCommand->eventComboAccept += newDelegate(this, &Console::notifyComboAccept); mComboCommand->eventKeyButtonPressed += newDelegate(this, &Console::notifyButtonPressed); mButtonSubmit->eventMouseButtonClick += newDelegate(this, &Console::notifyMouseButtonClick); mListHistory->setOverflowToTheLeft(true); mMainWidget->setVisible(false); }
void PointerManager::initialise() { MYGUI_ASSERT(!mIsInitialise, getClassTypeName() << " initialised twice"); MYGUI_LOG(Info, "* Initialise: " << getClassTypeName()); Gui::getInstance().eventFrameStart += newDelegate(this, &PointerManager::notifyFrameStart); InputManager::getInstance().eventChangeMouseFocus += newDelegate(this, &PointerManager::notifyChangeMouseFocus); WidgetManager::getInstance().registerUnlinker(this); ResourceManager::getInstance().registerLoadXmlDelegate(XML_TYPE) = newDelegate(this, &PointerManager::_load); FactoryManager::getInstance().registerFactory<ResourceManualPointer>(XML_TYPE_RESOURCE); FactoryManager::getInstance().registerFactory<ResourceImageSetPointer>(XML_TYPE_RESOURCE); mPointer = nullptr; mMousePointer = nullptr; mWidgetOwner = nullptr; mVisible = true; mSkinName = "ImageBox"; MYGUI_LOG(Info, getClassTypeName() << " successfully initialized"); mIsInitialise = true; }
void MenuControl::_wrapItem(MenuItem* _item, size_t _index, const UString& _name, MenuItemType _type, const std::string& _id, Any _data) { _item->setAlign(mVerticalAlignment ? Align::Top | Align::HStretch : Align::Default); _item->eventRootKeyChangeFocus += newDelegate(this, &MenuControl::notifyRootKeyChangeFocus); _item->eventMouseButtonClick += newDelegate(this, &MenuControl::notifyMouseButtonClick); _item->eventMouseSetFocus += newDelegate(this, &MenuControl::notifyMouseSetFocus); _item->setImageName(getIconIndexByType(_type )); MenuControl* submenu = nullptr; ItemInfo info = ItemInfo(_item, _name, _type, submenu, _id, _data); mItemsInfo.insert(mItemsInfo.begin() + _index, info); mChangeChildSkin = true; _item->changeWidgetSkin(getSkinByType(_type)); mChangeChildSkin = false; // его сет капшен, обновит размер _item->setCaption(_name); update(); }
void ListBox::initialiseOverride() { Base::initialiseOverride(); // FIXME нам нужен фокус клавы setNeedKeyFocus(true); // парсим свойства if (isUserString("SkinLine")) mSkinLine = getUserString("SkinLine"); if (isUserString("HeightLine")) mHeightLine = utility::parseInt(getUserString("HeightLine")); if (mHeightLine < 1) mHeightLine = 1; assignWidget(mClient, "Client"); if (mClient != nullptr) { mClient->eventMouseButtonPressed += newDelegate(this, &ListBox::notifyMousePressed); setWidgetClient(mClient); } assignWidget(mWidgetScroll, "VScroll"); if (mWidgetScroll != nullptr) { mWidgetScroll->eventScrollChangePosition += newDelegate(this, &ListBox::notifyScrollChangePosition); mWidgetScroll->eventMouseButtonPressed += newDelegate(this, &ListBox::notifyMousePressed); mWidgetScroll->setScrollPage((size_t)mHeightLine); mWidgetScroll->setScrollViewPage((size_t)mHeightLine); } updateScroll(); updateLine(); }
TextInputDialog::TextInputDialog() : WindowModal("openmw_text_input.layout") { // Centre dialog center(); getWidget(mTextEdit, "TextEdit"); mTextEdit->eventEditSelectAccept += newDelegate(this, &TextInputDialog::onTextAccepted); MyGUI::Button* okButton; getWidget(okButton, "OKButton"); okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &TextInputDialog::onOkClicked); // Make sure the edit box has focus MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mTextEdit); }
void SkinManager::initialise() { MYGUI_ASSERT(!mIsInitialise, getClassTypeName() << " initialised twice"); MYGUI_LOG(Info, "* Initialise: " << getClassTypeName()); ResourceManager::getInstance().registerLoadXmlDelegate(mXmlSkinTagName) = newDelegate(this, &SkinManager::_load); std::string resourceCategory = ResourceManager::getInstance().getCategoryName(); FactoryManager::getInstance().registerFactory<ResourceSkin>(resourceCategory); mDefaultName = "skin_Default"; createDefault(mDefaultName); MYGUI_LOG(Info, getClassTypeName() << " successfully initialized"); mIsInitialise = true; }
MessageFactory::MessageFactory() { MyGUI::WidgetManager & manager = MyGUI::WidgetManager::getInstance(); initialise(); // регестрируем все парсеры manager.registerDelegate("Message_Caption") = newDelegate(this, &MessageFactory::Message_Caption); manager.registerDelegate("Message_Message") = newDelegate(this, &MessageFactory::Message_Message); manager.registerDelegate("Message_Modal") = newDelegate(this, &MessageFactory::Message_Modal); manager.registerDelegate("Message_Button") = newDelegate(this, &MessageFactory::Message_Button); manager.registerDelegate("Message_AddButton") = newDelegate(this, &MessageFactory::Message_AddButton); manager.registerDelegate("Message_SmoothShow") = newDelegate(this, &MessageFactory::Message_SmoothShow); manager.registerDelegate("Message_Fade") = newDelegate(this, &MessageFactory::Message_Fade); }
TabFactory::TabFactory() { MyGUI::WidgetManager & manager = MyGUI::WidgetManager::getInstance(); // регестрируем все парсеры manager.registerDelegate("Tab_ButtonWidth") = newDelegate(this, &TabFactory::Tab_ButtonWidth); manager.registerDelegate("Tab_ButtonAutoWidth") = newDelegate(this, &TabFactory::Tab_ButtonAutoWidth); manager.registerDelegate("Tab_SmoothShow") = newDelegate(this, &TabFactory::Tab_SmoothShow); manager.registerDelegate("Tab_AddItem") = newDelegate(this, &TabFactory::Tab_AddItem); manager.registerDelegate("Tab_SelectItem") = newDelegate(this, &TabFactory::Tab_SelectItem); // OBSOLETE manager.registerDelegate("Tab_AddSheet") = newDelegate(this, &TabFactory::Tab_AddItem); // OBSOLETE manager.registerDelegate("Tab_SelectSheet") = newDelegate(this, &TabFactory::Tab_SelectItem); }
void DemoKeeper::createScene() { MyGUI::LayoutManager::getInstance().loadLayout("Wallpaper.layout"); const MyGUI::VectorWidgetPtr& root = MyGUI::LayoutManager::getInstance().loadLayout("HelpPanel.layout"); root.at(0)->findWidget("Text")->castType<MyGUI::TextBox>()->setCaption("You can drag and drop items from one ItemBox to another. Hold mouse over item to see tool tip. Resize windows to see vertical and horizontal ItebBox alignments."); // регестрируем тип нашего ресурса MyGUI::FactoryManager::getInstance().registerFactory<ResourceItemInfo>("Resource"); MyGUI::ResourceManager::getInstance().load("Resources.xml"); //MyGUI::ResourceManager::getInstance().load("ItemBox_skin.xml"); mToolTip = new ToolTip(); mToolTip->hide(); mItemBoxV = new ItemBoxWindow("ItemBoxV.layout"); mItemBoxV->getItemBox()->addItem(new ItemData()); mItemBoxV->getItemBox()->addItem(new ItemData("info_Crystal_Clear_Item1", 5)); mItemBoxV->getItemBox()->addItem(new ItemData("info_Crystal_Clear_Item2", 5)); mItemBoxV->getItemBox()->addItem(new ItemData("info_Crystal_Clear_Item3", 5)); mItemBoxV->getItemBox()->addItem(new ItemData("info_Crystal_Clear_Item4", 5)); mItemBoxV->getItemBox()->addItem(new ItemData("info_Crystal_Clear_Item5", 5)); mItemBoxV->getItemBox()->addItem(new ItemData("info_Crystal_Clear_Item6", 5)); mItemBoxV->getItemBox()->addItem(new ItemData("info_Crystal_Clear_Item7", 5)); mItemBoxV->getItemBox()->addItem(new ItemData("info_Crystal_Clear_Item8", 5)); mItemBoxV->getItemBox()->addItem(new ItemData("info_Crystal_Clear_Item9", 5)); mItemBoxV->getItemBox()->eventStartDrag = MyGUI::newDelegate(this, &DemoKeeper::notifyStartDrop); mItemBoxV->getItemBox()->eventRequestDrop = MyGUI::newDelegate(this, &DemoKeeper::notifyRequestDrop); mItemBoxV->getItemBox()->eventDropResult = MyGUI::newDelegate(this, &DemoKeeper::notifyEndDrop); mItemBoxV->getItemBox()->eventChangeDDState = newDelegate(this, &DemoKeeper::notifyDropState); mItemBoxV->getItemBox()->eventNotifyItem = newDelegate(this, &DemoKeeper::notifyNotifyItem); mItemBoxV->getItemBox()->eventToolTip = newDelegate(this, &DemoKeeper::notifyToolTip); mItemBoxH = new ItemBoxWindow("ItemBoxH.layout"); mItemBoxH->getItemBox()->addItem(new ItemData()); mItemBoxH->getItemBox()->addItem(new ItemData("info_Crystal_Clear_Item1", 5)); mItemBoxH->getItemBox()->addItem(new ItemData("info_Crystal_Clear_Item2", 5)); mItemBoxH->getItemBox()->addItem(new ItemData("info_Crystal_Clear_Item3", 5)); mItemBoxH->getItemBox()->addItem(new ItemData("info_Crystal_Clear_Item4", 5)); mItemBoxH->getItemBox()->addItem(new ItemData("info_Crystal_Clear_Item5", 5)); mItemBoxH->getItemBox()->addItem(new ItemData("info_Crystal_Clear_Item6", 5)); mItemBoxH->getItemBox()->addItem(new ItemData("info_Crystal_Clear_Item7", 5)); mItemBoxH->getItemBox()->addItem(new ItemData("info_Crystal_Clear_Item8", 5)); mItemBoxH->getItemBox()->addItem(new ItemData("info_Crystal_Clear_Item9", 5)); mItemBoxH->getItemBox()->eventStartDrag = MyGUI::newDelegate(this, &DemoKeeper::notifyStartDrop); mItemBoxH->getItemBox()->eventRequestDrop = MyGUI::newDelegate(this, &DemoKeeper::notifyRequestDrop); mItemBoxH->getItemBox()->eventDropResult = MyGUI::newDelegate(this, &DemoKeeper::notifyEndDrop); mItemBoxH->getItemBox()->eventChangeDDState = newDelegate(this, &DemoKeeper::notifyDropState); mItemBoxH->getItemBox()->eventNotifyItem = newDelegate(this, &DemoKeeper::notifyNotifyItem); mItemBoxH->getItemBox()->eventToolTip = newDelegate(this, &DemoKeeper::notifyToolTip); }
void ToolTipManager::initialise() { MYGUI_ASSERT(!mIsInitialise, getClassTypeName() << " initialised twice"); MYGUI_LOG(Info, "* Initialise: " << getClassTypeName()); mDelayVisible = 0.5f; mOldFocusWidget = nullptr; mToolTipVisible = false; mCurrentTime = 0; mOldIndex = ITEM_NONE; mNeedToolTip = false; Gui::getInstance().eventFrameStart += newDelegate(this, &ToolTipManager::notifyEventFrameStart); WidgetManager::getInstance().registerUnlinker(this); MYGUI_LOG(Info, getClassTypeName() << " successfully initialized"); mIsInitialise = true; }
void EditorState::notifyLoad() { if (um->isUnsaved()) { MyGUI::Message* message = MyGUI::Message::createMessageBox( "Message", localise("Warning"), localise("Warn_unsaved_data"), MyGUI::MessageBoxStyle::IconWarning | MyGUI::MessageBoxStyle::Yes | MyGUI::MessageBoxStyle::No | MyGUI::MessageBoxStyle::Cancel ); message->eventMessageBoxResult = newDelegate(this, &EditorState::notifyConfirmLoadMessage); message->setUserString("FileName", fileName); return; } setModeSaveLoadDialog(false, fileName); }
void Message::_destroyMessage(MessageBoxStyle _result) { eventMessageBoxResult(this, _result); if (nullptr != mWidgetFade) { if (mSmoothShow) { ControllerFadeAlpha* controller = createControllerFadeAlpha(MESSAGE_ALPHA_MIN, MESSAGE_SPEED_COEF, false); controller->eventPostAction = newDelegate(action::actionWidgetDestroy); ControllerManager::getInstance().addItem(mWidgetFade, controller); } else { WidgetManager::getInstance().destroyWidget(mWidgetFade); } } if (mSmoothShow) destroySmooth(); else WidgetManager::getInstance().destroyWidget(this); }
void ScrollView::initialiseWidgetSkin(ResourceSkin* _info) { // нам нужен фокус клавы mNeedKeyFocus = true; for (VectorWidgetPtr::iterator iter=mWidgetChildSkin.begin(); iter!=mWidgetChildSkin.end(); ++iter) { if (*(*iter)->_getInternalData<std::string>() == "Client") { MYGUI_DEBUG_ASSERT( ! mScrollClient, "widget already assigned"); mScrollClient = (*iter); mScrollClient->eventMouseSetFocus = newDelegate(this, &ScrollView::notifyMouseSetFocus); mScrollClient->eventMouseLostFocus = newDelegate(this, &ScrollView::notifyMouseLostFocus); mScrollClient->eventMouseWheel = newDelegate(this, &ScrollView::notifyMouseWheel); mClient = mScrollClient; // создаем холcт, реальный владелец детей mWidgetClient = mScrollClient->createWidget<Widget>("Default", IntCoord(), Align::Default); mWidgetClient->eventMouseWheel = newDelegate(this, &ScrollView::notifyMouseWheel); mWidgetClient->eventMouseSetFocus = newDelegate(this, &ScrollView::notifyMouseSetFocus); mWidgetClient->eventMouseLostFocus = newDelegate(this, &ScrollView::notifyMouseLostFocus); } else if (*(*iter)->_getInternalData<std::string>() == "VScroll") { MYGUI_DEBUG_ASSERT( ! mVScroll, "widget already assigned"); mVScroll = (*iter)->castType<VScroll>(); mVScroll->eventScrollChangePosition = newDelegate(this, &ScrollView::notifyScrollChangePosition); } else if (*(*iter)->_getInternalData<std::string>() == "HScroll") { MYGUI_DEBUG_ASSERT( ! mHScroll, "widget already assigned"); mHScroll = (*iter)->castType<HScroll>(); mHScroll->eventScrollChangePosition = newDelegate(this, &ScrollView::notifyScrollChangePosition); } } //MYGUI_ASSERT(nullptr != mScrollClient, "Child Widget Client not found in skin (ScrollView must have Client)"); updateView(); }
PropertyFieldEnum::PropertyFieldEnum(IPropertyObj * obj, const Property * prop, PropertyGroup* _parent) : BaseLayout("PropertyFieldComboBox.layout", _parent->getClient()) , IPropertyField(obj, prop) , mText(nullptr) , mField(nullptr) { assignWidget(mText, "Text"); assignWidget(mField, "Field"); d_assert (prop->enumObj != NULL && prop->type == PT_Int); mText->setCaption(prop->displayName.c_wstr()); for (int i = 0; i < prop->enumObj->GetEnumCount(); ++i) { mField->insertItemAt(i, prop->enumObj->GetEnum(i)->name.c_str()); } setTarget(obj); mField->eventComboAccept += newDelegate (this, &PropertyFieldEnum::notifyComboAccept); }
PropertyFieldBool::PropertyFieldBool(IPropertyObj * obj, const Property * prop, PropertyGroup* _parent) : BaseLayout("PropertyFieldComboBox.layout", _parent->getClient()) , IPropertyField(obj, prop) , mText(nullptr) , mField(nullptr) { assignWidget(mText, "Text"); assignWidget(mField, "Field"); d_assert (prop->type == PT_Bool); mText->setCaption(prop->displayName.c_str()); mField->insertItemAt(0, "true"); mField->insertItemAt(1, "false"); setTarget(obj); //mField->setEnabled(false); mField->eventComboAccept += newDelegate (this, &PropertyFieldBool::notifyComboAccept); }
void MessageFactory::initialise() { mVectorButtonName.push_back("Ok"); mVectorButtonTag.push_back("MyGUI_MessageBox_Ok"); mVectorButtonName.push_back("Yes"); mVectorButtonTag.push_back("MyGUI_MessageBox_Yes"); mVectorButtonName.push_back("No"); mVectorButtonTag.push_back("MyGUI_MessageBox_No"); mVectorButtonName.push_back("Abort"); mVectorButtonTag.push_back("MyGUI_MessageBox_Abort"); mVectorButtonName.push_back("Retry"); mVectorButtonTag.push_back("MyGUI_MessageBox_Retry"); mVectorButtonName.push_back("Ignore"); mVectorButtonTag.push_back("MyGUI_MessageBox_Ignore"); mVectorButtonName.push_back("Cancel"); mVectorButtonTag.push_back("MyGUI_MessageBox_Cancel"); mVectorButtonName.push_back("Try"); mVectorButtonTag.push_back("MyGUI_MessageBox_Try"); mVectorButtonName.push_back("Continue"); mVectorButtonTag.push_back("MyGUI_MessageBox_Continue"); LanguageManager::getInstance().eventChangeLanguage += newDelegate(MessageFactory::changeLanguage); }
void WidgetManager::initialise() { MYGUI_ASSERT(!mIsInitialise, getClassTypeName() << " initialised twice"); MYGUI_LOG(Info, "* Initialise: " << getClassTypeName()); FactoryManager& factory = FactoryManager::getInstance(); factory.registerFactory<Button>("Widget"); factory.registerFactory<Canvas>("Widget"); factory.registerFactory<ComboBox>("Widget"); factory.registerFactory<DDContainer>("Widget"); factory.registerFactory<EditBox>("Widget"); factory.registerFactory<ItemBox>("Widget"); factory.registerFactory<ListBox>("Widget"); factory.registerFactory<MenuBar>("Widget"); factory.registerFactory<MenuControl>("Widget"); factory.registerFactory<MenuItem>("Widget"); factory.registerFactory<MultiListBox>("Widget"); factory.registerFactory<MultiListItem>("Widget"); factory.registerFactory<PopupMenu>("Widget"); factory.registerFactory<ProgressBar>("Widget"); factory.registerFactory<ScrollBar>("Widget"); factory.registerFactory<ScrollView>("Widget"); factory.registerFactory<ImageBox>("Widget"); factory.registerFactory<TextBox>("Widget"); factory.registerFactory<TabControl>("Widget"); factory.registerFactory<TabItem>("Widget"); factory.registerFactory<Widget>("Widget"); factory.registerFactory<Window>("Widget"); BackwardCompatibility::registerWidgetTypes(); Gui::getInstance().eventFrameStart += newDelegate(this, &WidgetManager::notifyEventFrameStart); MYGUI_LOG(Info, getClassTypeName() << " successfully initialized"); mIsInitialise = true; }
void BerkeliumWidget::initialiseOverride() { Base::initialiseOverride(); // FIXME нам нужен фокус клавы setNeedKeyFocus(true); updateSize(); createTexture(mOldWidth, mOldHeight, TRM_PT_VIEW_REQUESTED); requestUpdateCanvas = newDelegate(this, &BerkeliumWidget::notifyUpdateCanvas); Berkelium::Context *context = Berkelium::Context::create(); mWindow = Berkelium::Window::create(context); updateSize(); mBuffer.resize(mOldWidth, mOldHeight); mWindow->resize(mOldWidth, mOldHeight); mWindowDelegate = new BerkeliumDelegate(); setWindowDelegate(mWindowDelegate); MyGUI::Gui::getInstance().eventFrameStart += MyGUI::newDelegate(this, &BerkeliumWidget::notifyFrameStart); }
void TabControl::_showItem(TabItem* _item, bool _show, bool _smooth) { if (!_smooth) { ControllerManager::getInstance().removeItem(_item); _item->setAlpha(ALPHA_MAX); _item->setVisible(_show); return; } if (_show) { ControllerFadeAlpha* controller = createControllerFadeAlpha(ALPHA_MAX, TAB_SPEED_FADE_COEF, true); ControllerManager::getInstance().addItem(_item, controller); } else { ControllerFadeAlpha* controller = createControllerFadeAlpha(ALPHA_MIN, TAB_SPEED_FADE_COEF, false); controller->eventPostAction += newDelegate(this, &TabControl::actionWidgetHide); ControllerManager::getInstance().addItem(_item, controller); } }
void InputManager::initialise() { MYGUI_ASSERT(!mIsInitialise, getClassTypeName() << " initialised twice"); MYGUI_LOG(Info, "* Initialise: " << getClassTypeName()); mWidgetMouseFocus = 0; mWidgetKeyFocus = 0; mLayerMouseFocus = 0; mLeftMouseCapture = false; mRightMouseCapture = false; mIsShiftPressed = false; mIsControlPressed = false; mHoldKey = KeyCode::None; mHoldChar = 0; mFirstPressKey = true; mTimerKey = 0.0f; mOldAbsZ = 0; WidgetManager::getInstance().registerUnlinker(this); Gui::getInstance().eventFrameStart += newDelegate(this, &InputManager::frameEntered); MYGUI_LOG(Info, getClassTypeName() << " successfully initialized"); mIsInitialise = true; }
MessageBoxStyle Message::addButtonName(const UString& _name) { //FIXME if (mVectorButton.size() >= MessageBoxStyle::_CountUserButtons) { MYGUI_LOG(Warning, "Too many buttons in message box, ignored"); return MessageBoxStyle::None; } // бит, номер кнопки + смещение до Button1 MessageBoxStyle info = MessageBoxStyle(MessageBoxStyle::Enum(MYGUI_FLAG(mVectorButton.size() + MessageBoxStyle::_IndexUserButton1))); // запоминаем кнопки для отмены и подтверждения if (mVectorButton.empty()) mInfoOk = info; mInfoCancel = info; Widget* button = createWidgetT(mButtonType, mButtonSkin, IntCoord(), Align::Left | Align::Bottom); button->eventMouseButtonClick = newDelegate(this, &Message::notifyButtonClick); button->setCaption(_name); button->_setInternalData(info); mVectorButton.push_back(button); updateSize(); return info; }
void EditorState::createMainMenu() { MyGUI::VectorWidgetPtr menu_items = MyGUI::LayoutManager::getInstance().load("interface_menu.layout"); MYGUI_ASSERT(menu_items.size() == 1, "Error load main menu"); bar = menu_items[0]->castType<MyGUI::MenuBar>(); bar->setCoord(0, 0, getGUI()->getViewSize().width, bar->getHeight()); // главное меню MyGUI::MenuItem* menu_file = bar->getItemById("File"); mPopupMenuFile = menu_file->getItemChild(); // список последних открытых файлов if (recentFiles.size()) { MyGUI::MenuItem* menu_item = mPopupMenuFile->getItemById("File/Quit"); for (std::vector<MyGUI::UString>::reverse_iterator iter = recentFiles.rbegin(); iter != recentFiles.rend(); ++iter) { mPopupMenuFile->insertItem(menu_item, *iter, MyGUI::MenuItemType::Normal, "File/RecentFiles", *iter); } // если есть файлы, то еще один сепаратор mPopupMenuFile->insertItem(menu_item, "", MyGUI::MenuItemType::Separator); } //хак, дл¤ меню тест двойна¤ замена MyGUI::MenuItem* menu_item_test = mPopupMenuFile->getItemById("File/Test"); menu_item_test->setCaption(MyGUI::LanguageManager::getInstance().replaceTags(menu_item_test->getCaption())); // меню дл¤ виджетов MyGUI::MenuItem* menu_widget = bar->getItemById("Widgets"); mPopupMenuWidgets = menu_widget->createItemChild(); //FIXME mPopupMenuWidgets->setPopupAccept(true); bar->eventMenuCtrlAccept = newDelegate(this, &EditorState::notifyPopupMenuAccept); interfaceWidgets.push_back(bar); }
void VScroll::initialiseOverride() { Base::initialiseOverride(); // при нуле, будет игнорировать кнопки mScrollPage = 1; mScrollViewPage = 1; mMinTrackSize = 0; mSkinRangeStart = 0; mSkinRangeEnd = 0; assignWidget(mWidgetStart, "Start"); if (mWidgetStart != nullptr) { mWidgetStart->eventMouseButtonPressed += newDelegate(this, &VScroll::notifyMousePressed); mWidgetStart->eventMouseWheel += newDelegate(this, &VScroll::notifyMouseWheel); } assignWidget(mWidgetEnd, "End"); if (mWidgetEnd != nullptr) { mWidgetEnd->eventMouseButtonPressed += newDelegate(this, &VScroll::notifyMousePressed); mWidgetEnd->eventMouseWheel += newDelegate(this, &VScroll::notifyMouseWheel); } assignWidget(mWidgetTrack, "Track"); if (mWidgetTrack) { mWidgetTrack->eventMouseDrag += newDelegate(this, &VScroll::notifyMouseDrag); mWidgetTrack->eventMouseButtonPressed += newDelegate(this, &VScroll::notifyMousePressed); mWidgetTrack->eventMouseButtonReleased += newDelegate(this, &VScroll::notifyMouseReleased); mWidgetTrack->eventMouseWheel += newDelegate(this, &VScroll::notifyMouseWheel); mWidgetTrack->setVisible(false); } assignWidget(mWidgetFirstPart, "FirstPart"); if (mWidgetFirstPart != nullptr) { mWidgetFirstPart->eventMouseButtonPressed += newDelegate(this, &VScroll::notifyMousePressed); mWidgetFirstPart->eventMouseWheel += newDelegate(this, &VScroll::notifyMouseWheel); } assignWidget(mWidgetSecondPart, "SecondPart"); if (mWidgetSecondPart != nullptr) { mWidgetSecondPart->eventMouseButtonPressed += newDelegate(this, &VScroll::notifyMousePressed); mWidgetSecondPart->eventMouseWheel += newDelegate(this, &VScroll::notifyMouseWheel); } if (isUserString("MinTrackSize")) mMinTrackSize = utility::parseValue<int>(getUserString("MinTrackSize")); if (isUserString("TrackRangeMargins")) utility::parseComplex<size_t>(getUserString("TrackRangeMargins"), mSkinRangeStart, mSkinRangeEnd); }
void Window::initialiseOverride() { Base::initialiseOverride(); // FIXME нам нужен фокус клавы setNeedKeyFocus(true); // дефолтные размеры mMinmax.set( (std::numeric_limits<int>::min)(), (std::numeric_limits<int>::min)(), (std::numeric_limits<int>::max)(), (std::numeric_limits<int>::max)()); bool main_move = false; if (isUserString("MainMove")) { setUserString("Scale", "1 1 0 0"); main_move = true; } ///@wskin_child{Window, Widget, Client} Клиентская зона. assignWidget(mClient, "Client"); if (mClient != nullptr) { if (main_move) { mClient->setUserString("Scale", "1 1 0 0"); mClient->eventMouseButtonPressed += newDelegate(this, &Window::notifyMousePressed); mClient->eventMouseButtonReleased += newDelegate(this, &Window::notifyMouseReleased); mClient->eventMouseDrag += newDelegate(this, &Window::notifyMouseDrag); } setWidgetClient(mClient); } ///@wskin_child{Window, TextBox, Caption} Caption for window. assignWidget(mWidgetCaption, "Caption"); if (mWidgetCaption != nullptr) { mWidgetCaption->setUserString("Scale", "1 1 0 0"); mWidgetCaption->eventMouseButtonPressed += newDelegate(this, &Window::notifyMousePressed); mWidgetCaption->eventMouseButtonReleased += newDelegate(this, &Window::notifyMouseReleased); mWidgetCaption->eventMouseDrag += newDelegate(this, &Window::notifyMouseDrag); } VectorWidgetPtr buttons = getSkinWidgetsByName("Button"); for (VectorWidgetPtr::iterator iter = buttons.begin(); iter != buttons.end(); ++iter) { (*iter)->eventMouseButtonClick += newDelegate(this, &Window::notifyPressedButtonEvent); } VectorWidgetPtr actions = getSkinWidgetsByName("Action"); for (VectorWidgetPtr::iterator iter = actions.begin(); iter != actions.end(); ++iter) { (*iter)->eventMouseButtonPressed += newDelegate(this, &Window::notifyMousePressed); (*iter)->eventMouseButtonReleased += newDelegate(this, &Window::notifyMouseReleased); (*iter)->eventMouseDrag += newDelegate(this, &Window::notifyMouseDrag); (*iter)->eventMouseWheel += newDelegate(this, &Window::notifyMouseWheel); } const size_t countNames = 8; const char* resizers[2][countNames] = { {"ResizeLeftTop", "ResizeTop", "ResizeRightTop", "ResizeRight", "ResizeRightBottom", "ResizeBottom", "ResizeLeftBottom", "ResizeLeft"}, {"Left Top", "Top", "Right Top", "Right", "Right Bottom", "Bottom", "Left Bottom", "Left"} }; for (size_t index = 0; index < countNames; ++ index) { Widget* widget = nullptr; assignWidget(widget, resizers[0][index]); if (widget != nullptr) { widget->eventMouseButtonPressed += newDelegate(this, &Window::notifyMousePressed); widget->eventMouseButtonReleased += newDelegate(this, &Window::notifyMouseReleased); widget->eventMouseDrag += newDelegate(this, &Window::notifyMouseDrag); widget->eventMouseWheel += newDelegate(this, &Window::notifyMouseWheel); widget->setUserString("Action", resizers[1][index]); } } }
void WindowsClipboardHandler::shutdown() { ClipboardManager::getInstance().eventClipboardChanged -= newDelegate(this, &WindowsClipboardHandler::handleClipboardChanged); ClipboardManager::getInstance().eventClipboardRequested -= newDelegate(this, &WindowsClipboardHandler::handleClipboardRequested); }
void Window::destroySmooth() { ControllerFadeAlpha* controller = createControllerFadeAlpha(ALPHA_MIN, WINDOW_SPEED_COEF, false); controller->eventPostAction += newDelegate(action::actionWidgetDestroy); ControllerManager::getInstance().addItem(this, controller); }