aboutsummaryrefslogtreecommitdiff
path: root/engines/wage
diff options
context:
space:
mode:
authorEugene Sandulenko2019-10-04 15:54:01 +0200
committerEugene Sandulenko2019-10-04 15:54:48 +0200
commit35773e76b9835bcd07416c0ffc5d494cb8afe0ee (patch)
tree9a5e9bd297d47b88d8e4adfafe8fc354f0f8e065 /engines/wage
parent48b261cf6b3714ed5e9f224149272e2808e00f09 (diff)
downloadscummvm-rg350-35773e76b9835bcd07416c0ffc5d494cb8afe0ee.tar.gz
scummvm-rg350-35773e76b9835bcd07416c0ffc5d494cb8afe0ee.tar.bz2
scummvm-rg350-35773e76b9835bcd07416c0ffc5d494cb8afe0ee.zip
GRAPHICS: MACGUI: Unify MacMenuItem and MacMenuSubItem
Diffstat (limited to 'engines/wage')
-rw-r--r--engines/wage/gui.cpp15
1 files changed, 10 insertions, 5 deletions
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) {