Skip to content

Commit

Permalink
WAGE: Show accelerator keys for submenus
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Jan 13, 2016
1 parent a6cf968 commit f941292
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions engines/wage/menu.cpp
Expand Up @@ -137,7 +137,7 @@ Menu::Menu(Gui *gui) : _gui(gui) {
for (int i = 0; menuSubItems[i].menunum; i++) {
MenuData *m = &menuSubItems[i];

_items[m->menunum]->subitems.push_back(new MenuSubItem(m->title, m->action, m->shortcut));
_items[m->menunum]->subitems.push_back(new MenuSubItem(m->title, m->action, 0, m->shortcut));
}

MenuItem *commands = new MenuItem("Commands");
Expand Down Expand Up @@ -200,7 +200,7 @@ const char *Menu::getAcceleratorString(MenuSubItem *item) {
*res = 0;

if (item->shortcut != 0)
sprintf(res, " \u2318%c", item->shortcut);
sprintf(res, " \x11%c", item->shortcut);

return res;
}
Expand Down Expand Up @@ -282,7 +282,12 @@ void Menu::renderSubmenu(MenuItem *menu) {
int x = r->left + kMenuDropdownPadding;
int y = r->top;
for (int i = 0; i < menu->subitems.size(); i++) {
_font->drawString(&_gui->_screen, menu->subitems[i]->text, x, y, r->width(), kColorBlack);
Common::String text(menu->subitems[i]->text);
Common::String acceleratorText(getAcceleratorString(menu->subitems[i]));
if (acceleratorText.size()) {
text += acceleratorText;
}
_font->drawString(&_gui->_screen, text, x, y, r->width(), kColorBlack);

y += kMenuDropdownItemHeight;
}
Expand Down

0 comments on commit f941292

Please sign in to comment.