diff options
author | Eugene Sandulenko | 2019-10-04 15:54:01 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2019-10-04 15:54:48 +0200 |
commit | 35773e76b9835bcd07416c0ffc5d494cb8afe0ee (patch) | |
tree | 9a5e9bd297d47b88d8e4adfafe8fc354f0f8e065 /engines | |
parent | 48b261cf6b3714ed5e9f224149272e2808e00f09 (diff) | |
download | scummvm-rg350-35773e76b9835bcd07416c0ffc5d494cb8afe0ee.tar.gz scummvm-rg350-35773e76b9835bcd07416c0ffc5d494cb8afe0ee.tar.bz2 scummvm-rg350-35773e76b9835bcd07416c0ffc5d494cb8afe0ee.zip |
GRAPHICS: MACGUI: Unify MacMenuItem and MacMenuSubItem
Diffstat (limited to 'engines')
-rw-r--r-- | engines/macventure/gui.cpp | 7 | ||||
-rw-r--r-- | engines/wage/gui.cpp | 15 |
2 files changed, 14 insertions, 8 deletions
diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp index cc1de7cab2..d7b640571d 100644 --- a/engines/macventure/gui.cpp +++ b/engines/macventure/gui.cpp @@ -410,7 +410,7 @@ bool Gui::loadMenus() { if ((resArray = _resourceManager->getResIDArray(MKTAG('M', 'E', 'N', 'U'))).size() == 0) return false; - _menu->addMenuSubItem(0, "Abb", kMenuActionAbout, 0, 'A', true); + _menu->addMenuItem(nullptr, "Abb", kMenuActionAbout, 0, 'A', true); int i = 1; for (iter = resArray.begin(); iter != resArray.end(); ++iter) { @@ -430,7 +430,8 @@ bool Gui::loadMenus() { title[titleLength] = '\0'; if (titleLength > 1) { - _menu->addMenuItem(title); + _menu->addMenuItem(nullptr, title); + Graphics::MacMenuSubMenu *submenu = _menu->addSubMenu(nullptr); // Read submenu items while ((titleLength = res->readByte())) { @@ -445,7 +446,7 @@ bool Gui::loadMenus() { res->readUint16BE(); // Read style style = res->readUint16BE(); - _menu->addMenuSubItem(i, title, 0, style, key, false); + _menu->addMenuItem(submenu, title, 0, style, key, false); } } diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp index 9538da1513..99dcfca8dd 100644 --- a/engines/wage/gui.cpp +++ b/engines/wage/gui.cpp @@ -100,13 +100,14 @@ Gui::Gui(WageEngine *engine) { _menu->setCommandsCallback(menuCommandsCallback, this); _menu->addStaticMenus(menuSubItems); - _menu->addMenuSubItem(kMenuAbout, _engine->_world->getAboutMenuItemName(), kMenuActionAbout); + _menu->addSubMenu(nullptr, kMenuAbout); + _menu->addMenuItem(_menu->getSubmenu(nullptr, kMenuAbout), _engine->_world->getAboutMenuItemName(), kMenuActionAbout); - _commandsMenuId = _menu->addMenuItem(_engine->_world->_commandsMenuName); + _commandsMenuId = _menu->addMenuItem(nullptr, _engine->_world->_commandsMenuName); regenCommandsMenu(); if (!_engine->_world->_weaponMenuDisabled) { - _weaponsMenuId = _menu->addMenuItem(_engine->_world->_weaponsMenuName); + _weaponsMenuId = _menu->addMenuItem(nullptr, _engine->_world->_weaponsMenuName); regenWeaponsMenu(); } else { @@ -221,6 +222,10 @@ void Gui::regenWeaponsMenu() { bool empty = true; + Graphics::MacMenuSubMenu *submenu = _menu->getSubmenu(nullptr, _weaponsMenuId); + if (submenu == nullptr) + submenu = _menu->addSubMenu(nullptr, _weaponsMenuId); + for (uint i = 0; i < weapons->size(); i++) { Obj *obj = (*weapons)[i]; if (obj->_type == Obj::REGULAR_WEAPON || @@ -230,7 +235,7 @@ void Gui::regenWeaponsMenu() { command += " "; command += obj->_name; - _menu->addMenuSubItem(_weaponsMenuId, command, kMenuActionCommand, 0, 0, true); + _menu->addMenuItem(submenu, command, kMenuActionCommand, 0, 0, true); empty = false; } @@ -238,7 +243,7 @@ void Gui::regenWeaponsMenu() { delete weapons; if (empty) - _menu->addMenuSubItem(_weaponsMenuId, "You have no weapons", 0, 0, 0, false); + _menu->addMenuItem(submenu, "You have no weapons", 0, 0, 0, false); } bool Gui::processEvent(Common::Event &event) { |