void EditorFrameHandler::InitGUI() { MyGUI::Gui *gui = GUISystem::GetInstance()->GetGui(); // создание меню MainMenuBar = gui->createWidget<MyGUI::MenuBar>("MenuBar", MyGUI::IntCoord(0, 0, gui->getViewWidth(), 28), MyGUI::Align::Top | MyGUI::Align::HStretch, "Overlapped", "LayoutEditor_MenuBar"); MainMenuBar->addItem("File"); MainMenuBar->addItem("Options"); // FIXME менюбар сунуть в лейаут //interfaceWidgets.push_back(bar); PopupMenuFile = MainMenuBar->getItemMenu(0); PopupMenuFile->addItem("Load"); PopupMenuFile->addItem("Save"); PopupMenuFile->addItem("Save_as"); PopupMenuFile->addItem("Clear", false, true); PopupMenuFile->addItem("Settings"); PopupMenuFile->addItem("Quit"); PopupMenuOptions = MainMenuBar->getItemMenu(1); PopupMenuOptions->addItem("Environment"); //for (List<Ogre::UTFString>::ListNode *pos = XMLEditorNodes.GetBegin();pos!=NULL;pos=pos->Next) ObjectsList.Load(); std::map<Ogre::UTFString, SEditableDescription>::iterator iPos = EditorNodes.begin(), iEnd = EditorNodes.end(); for (;iPos!=iEnd;++iPos) { //PopupMenuWidgets->addItem(iPos->first); ObjectsList.AddItem(iPos->first); } MainMenuBar->eventPopupMenuAccept = MyGUI::newDelegate(this, &EditorFrameHandler::NotifyPopupMenuAccept); }
bool GUIMessageLayout::Load() { bool res = GUILayout::Load(); MyGUI::ButtonPtr button; MyGUI::Gui *gui = GUISystem::GetInstance()->GetGui(); button = gui->findWidget<MyGUI::Button>("MessageButtonOK"); button->eventMouseButtonClick = MyGUI::newDelegate(this, &GUIMessageLayout::mousePressed); MyGUI::WidgetPtr widget = Widgets.front(); widget->setPosition(gui->getViewWidth()/2-widget->getWidth()/2,gui->getViewHeight()/2-widget->getHeight()/2); return res; }
bool initialise() { mRoot = new Ogre::Root(PLUGINS_CFG, OGRE_CFG, OGRE_LOG); if (!mRoot->restoreConfig()) if (!mRoot->showConfigDialog()) return false; initResources(); mWindow = mRoot->initialise(true, "CS Clone Editor v0.0"); Ogre::WindowEventUtilities::addWindowEventListener(mWindow, this); mSceneMgr = mRoot->createSceneManager(Ogre::ST_GENERIC); mSceneMgr->setAmbientLight(Ogre::ColourValue(0.7, 0.7, 0.7)); mCamera = mSceneMgr->createCamera("camera"); mWindow->addViewport(mCamera); mCamera->setAutoAspectRatio(true); mCamera->setNearClipDistance(0.1); mCamera->setFarClipDistance(10000); mCamera->setPosition(10, 10, 10); // mCamera->lookAt(0, 0, 0); mRoot->addFrameListener(this); Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups(); //Initializing OIS Ogre::LogManager::getSingletonPtr()->logMessage("*-*-* OIS Initialising"); OIS::ParamList pl; size_t windowHnd = 0; mWindow->getCustomAttribute("WINDOW", &windowHnd); pl.insert(std::make_pair(std::string("WINDOW"), Ogre::StringConverter::toString(windowHnd))); #if OGRE_DEBUG_MODE == 1 #if OGRE_PLATFORM == OGRE_PLATFORM_LINUX #define NO_EXCLUSIVE_INPUT #endif #endif #ifdef NO_EXCLUSIVE_INPUT #if defined OIS_WIN32_PLATFORM pl.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_FOREGROUND" ))); pl.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_NONEXCLUSIVE"))); pl.insert(std::make_pair(std::string("w32_keyboard"), std::string("DISCL_FOREGROUND"))); pl.insert(std::make_pair(std::string("w32_keyboard"), std::string("DISCL_NONEXCLUSIVE"))); #elif defined OIS_LINUX_PLATFORM pl.insert(std::make_pair(std::string("x11_mouse_grab"), std::string("false"))); pl.insert(std::make_pair(std::string("x11_mouse_hide"), std::string("false"))); pl.insert(std::make_pair(std::string("x11_keyboard_grab"), std::string("false"))); pl.insert(std::make_pair(std::string("XAutoRepeatOn"), std::string("true"))); #endif #endif mInputManager = OIS::InputManager::createInputSystem(pl); mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject(OIS::OISKeyboard, true)); mKeyboard->setEventCallback(this); mMouse = static_cast<OIS::Mouse*>(mInputManager->createInputObject(OIS::OISMouse, true)); mMouse->setEventCallback(this); windowResized(mWindow); //Initialising GUI Ogre::LogManager::getSingletonPtr()->logMessage("*-*-* MyGUI Initialising"); mGUI = new MyGUI::Gui; mGUI->initialise(mWindow); mGUI->load("editor.layout"); mMenuBar = mGUI->createWidget<MyGUI::MenuBar>("MenuBar", MyGUI::IntCoord(0, 0, mGUI->getViewWidth(), 28), MyGUI::ALIGN_TOP | MyGUI::ALIGN_HSTRETCH, "Overlapped"); mMenuBar->addItem("File"); mPopupMenuFile = mMenuBar->getItemMenu(0); mPopupMenuFile->addItem("New"); mPopupMenuFile->addItem("Open ..."); mPopupMenuFile->addItem("Save"); mPopupMenuFile->addItem("Save as ...", false, true); mPopupMenuFile->addItem("Settings", false, true); mPopupMenuFile->addItem("Quit"); mMenuBar->addItem("Help"); mPopupMenuHelp = mMenuBar->getItemMenu(1); mPopupMenuHelp->addItem("Help"); mPopupMenuHelp->addItem("About ..."); return (true); }