diff options
author | Eugene Sandulenko | 2019-10-04 00:35:21 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2019-10-04 00:35:21 +0200 |
commit | 9368323cdf182121577511b129f8d981c364a34b (patch) | |
tree | 0d0959014f2b8be3073cc4f1e61375793e954a40 /graphics/macgui | |
parent | 087c6c80d0eff9b65726ad5239febc25329ae149 (diff) | |
download | scummvm-rg350-9368323cdf182121577511b129f8d981c364a34b.tar.gz scummvm-rg350-9368323cdf182121577511b129f8d981c364a34b.tar.bz2 scummvm-rg350-9368323cdf182121577511b129f8d981c364a34b.zip |
GRAPHICS: MACGUI: Process Windows menu shortcuts
Diffstat (limited to 'graphics/macgui')
-rw-r--r-- | graphics/macgui/macmenu.cpp | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp index 873b2b92f0..d8b5a433f5 100644 --- a/graphics/macgui/macmenu.cpp +++ b/graphics/macgui/macmenu.cpp @@ -337,7 +337,18 @@ int MacMenu::addMenuItem(const Common::String &name) { } int MacMenu::addMenuItem(const Common::U32String &name) { - MacMenuItem *i = new MacMenuItem(name); + Common::U32String amp("&"); + Common::U32String res; + + for (uint i = 0; i < name.size(); i++) + if (name[i] == amp[0]) { + //shortcut = amp[0] & 0xff; + } else { + res += name[i]; + } + + + MacMenuItem *i = new MacMenuItem(res); _items.push_back(i); _dimensionsDirty = true; @@ -370,7 +381,17 @@ void MacMenu::addMenuSubItem(int id, const Common::U32String &text, int action, if (_items[id]->submenu == nullptr) _items[id]->submenu = new MacMenuSubMenu(); - _items[id]->submenu->subitems.push_back(new MacMenuSubItem(text, action, style, shortcut, enabled)); + Common::U32String amp("&"); + Common::U32String res; + + for (uint i = 0; i < text.size(); i++) + if (text[i] == amp[0]) { + shortcut = amp[0] & 0xff; + } else { + res += text[i]; + } + + _items[id]->submenu->subitems.push_back(new MacMenuSubItem(res, action, style, shortcut, enabled)); } void MacMenu::addSubMenuItem(MacMenuSubMenu *submenu, const Common::String &text, int action, int style, char shortcut, bool enabled) { @@ -386,7 +407,17 @@ void MacMenu::addSubMenuItem(MacMenuSubMenu *submenu, const Common::U32String &t _dimensionsDirty = true; - submenu->subitems.push_back(new MacMenuSubItem(text, action, style, shortcut, enabled)); + Common::U32String amp("&"); + Common::U32String res; + + for (uint i = 0; i < text.size(); i++) + if (text[i] == amp[0]) { + shortcut = amp[0] & 0xff; + } else { + res += text[i]; + } + + submenu->subitems.push_back(new MacMenuSubItem(res, action, style, shortcut, enabled)); } void MacMenu::calcDimensions() { |