BriefMenu::BriefMenu(MenuManager * m) : Menu(m, MENU_BRIEF, MENU_MAP, "mbrief.dat", "mbrieout.dat"), start_line_(0), p_briefing_(NULL), mm_renderer_() { addStatic(85, 35, 545, "#BRIEF_TITLE", FontManager::SIZE_4, false); txtTimeId_ = addStatic(500, 9, "", FontManager::SIZE_2, true); // Time // Briefing scroll button nextButId_ = addImageOption(461, 316, Sprite::MSPR_RIGHT_ARROW2_D, Sprite::MSPR_RIGHT_ARROW2_L); registerHotKey(KFC_RIGHT, nextButId_); prevButId_ = addImageOption(427, 316, Sprite::MSPR_LEFT_ARROW2_D, Sprite::MSPR_LEFT_ARROW2_L); registerHotKey(KFC_LEFT, prevButId_); // Accept button addOption(17, 347, 128, 25, "#MENU_ACC_BUT", FontManager::SIZE_2, MENU_SELECT); // Map button addOption(148, 347, 99, 25, "#BRIEF_MAP", FontManager::SIZE_2, MENU_MAP); // Main menu button addOption(500, 347, 128, 25, "#MENU_MAIN_BUT", FontManager::SIZE_2, MENU_MAIN); // Money txtMoneyId_ = addStatic(500, 87, 127, "0", FontManager::SIZE_2, true); // textfield // Info infosButId_ = addOption(500, 118, 127, 10, "#BRIEF_INFO", FontManager::SIZE_2); // info button txtInfoId_ = addStatic(500, 140, 127, "0", FontManager::SIZE_2, true); // Enhancement enhButId_ = addOption(500, 169, 127, 10, "#BRIEF_ENH", FontManager::SIZE_2); txtEnhId_ = addStatic(500, 195, 127, "0", FontManager::SIZE_2, true); a_page_ = new std::string[kMaxLinePerPage]; }
MainMenu::MainMenu(MenuManager * m):Menu(m, fs_game_menus::kMenuIdMain, fs_game_menus::kMenuIdMain, "moption.dat", "moptout.dat") { isCachable_ = false; addStatic(0, 40, g_Screen.gameScreenWidth(), "#MAIN_TITLE", FontManager::SIZE_4, false); int id = addOption(201, 130, 300, 25, "#MAIN_CONF", FontManager::SIZE_3, fs_game_menus::kMenuIdConf, true, false); registerHotKey(KFC_F1, id); id = addOption(201, 164, 300, 25, "#MAIN_BEGIN", FontManager::SIZE_3, fs_game_menus::kMenuIdMap, true, false); registerHotKey(KFC_F2, id); id = addOption(201, 198, 300, 25, "#MAIN_LOAD_SAVE", FontManager::SIZE_3, fs_game_menus::kMenuIdLdSave, true, false); registerHotKey(KFC_F3, id); resetButId_ = addOption(201, 232, 300, 25, "#MAIN_RESET", FontManager::SIZE_3, fs_game_menus::kMenuIdMain, true, false); registerHotKey(KFC_F4, resetButId_); quitButId_ = addOption(201, 266, 300, 25, "#MAIN_QUIT", FontManager::SIZE_3, MENU_NO_MENU, true, false); registerHotKey(KFC_F5, quitButId_); }
MyGlobalShortCut::MyGlobalShortCut(QString key, QObject *app) { m_key = QKeySequence(key); m_filter = new MyWinEventFilter(this); m_app->installNativeEventFilter(m_filter); registerHotKey(); }
/*! * Creates and adds a button to the menu. * \param x X coordinate * \param y Y coordinate * \param width Button width * \param height Button height * \param text Button label. If text starts with a '#' then * text is a property in the current language file and it is * replaced by its value. * \param size Font size * \param to Id of the next menu when button is clicked * \param visible True if button is visible on screen * \param centered True if text must centered regarding button width * \param dark_widget Widget drawn in front of the button when it's not highlighted * \param light_widget Widget drawn in front of the button when it's highlighted */ int Menu::addOption(int x, int y, int width, int height, const char *text, FontManager::EFontSize size, int to, bool visible, bool centered, int dark_widget, int light_widget) { Option *pOption = new Option(this, x, y, width, height, text, getMenuFont(size), to, visible, centered, dark_widget, light_widget); actions_.push_back(pOption); if (pOption->getHotKey().keyFunc != KFC_UNKNOWN || pOption->getHotKey().unicode != 0) { // The option already has an acceleration key registerHotKey(pOption->getHotKey().unicode, pOption->getId()); } return pOption->getId(); }