void MainMenuControlLE::updateRecentProjectsMenu() { MyGUI::MenuItem* recentProjectsMenu = mBar->findItemById("RecentProjects", true); if (recentProjectsMenu != nullptr) { recentProjectsMenu->getItemChild()->removeAllItems(); // список последних открытых проектов const RecentFilesManager::VectorUString& recentProjects = RecentFilesManager::getInstance().getRecentProjects(); if (!recentProjects.empty()) { size_t index = 1; for (RecentFilesManager::VectorUString::const_iterator iter = recentProjects.begin(); iter != recentProjects.end(); ++iter, ++index) { addUserTag("IndexRecentProject", MyGUI::utility::toString(index)); addUserTag("RecentProject", *iter); recentProjectsMenu->getItemChild()->addItem(replaceTags("FormatRecentProject"), MyGUI::MenuItemType::Normal, "Command_OpenRecentProject", *iter); } } } }
void MainMenuControlLE::updateMenuScale(size_t _scale) { MyGUI::MenuItem* scaleMenu = mBar->findItemById("Scale", true); if (scaleMenu != nullptr) { MyGUI::MenuControl* popup = scaleMenu->getItemChild(); if (popup != nullptr) { std::string id = MyGUI::utility::toString("Command_ChangeScale.", (int)_scale); for (size_t index = 0; index < popup->getItemCount(); index ++) { MyGUI::MenuItem* item = popup->getItemAt(index); item->setItemChecked(item->getItemId() == id); } } } }
void MainMenu::Init() { // scene { MyGUI::MenuItem* menuScene = mMainMenu->findItemById("Scene", true); d_assert (menuScene); MyGUI::MenuControl * ctrl = menuScene->getItemChild(); if (ctrl == NULL) ctrl = menuScene->createItemChild(); ctrl->addItem("Load ...", MyGUI::MenuItemType::Normal, "CTRL_Menu_Load"); ctrl->addItem("New", MyGUI::MenuItemType::Normal, "CTRL_Menu_New"); ctrl->addItem("Save", MyGUI::MenuItemType::Normal, "CTRL_Menu_Save"); ctrl->addItem("Import", MyGUI::MenuItemType::Normal, "CTRL_Menu_Import"); ctrl->addItem("Export", MyGUI::MenuItemType::Normal, "CTRL_Menu_Export"); } }