diff --git a/src/emu/ui/menubar.c b/src/emu/ui/menubar.c index e10ebec786e..e1f72e63b74 100644 --- a/src/emu/ui/menubar.c +++ b/src/emu/ui/menubar.c @@ -634,7 +634,7 @@ void ui_menubar::draw_menu_item_text(menu_item *mi, float x0, float y0, float x1 fgcolor = UI_UNAVAILABLE_COLOR; bgcolor = UI_TEXT_BG_COLOR; } - else if (mi == m_selected_item) + else if (is_highlighted_selection(mi)) { // selected fgcolor = UI_SELECTED_COLOR; @@ -703,6 +703,34 @@ void ui_menubar::draw_menu_item_text(menu_item *mi, float x0, float y0, float x1 } +//------------------------------------------------- +// is_highlighted_selection +//------------------------------------------------- + +bool ui_menubar::is_highlighted_selection(menu_item *mi) +{ + bool result = false; + + if (mi == m_selected_item) + { + // this item _is_ the selection + result = true; + } + else if (m_selected_item != NULL) + { + // walk up the menu hierarchy; we want to also highlight ancestor sub menus + menu_item *selected_item_ancestor = m_selected_item; + do + { + selected_item_ancestor = selected_item_ancestor->parent(); + result = (mi == selected_item_ancestor) && selected_item_ancestor->is_sub_menu(); + } + while(!result && selected_item_ancestor->is_sub_menu()); + } + return result; +} + + //------------------------------------------------- // find_mouse //------------------------------------------------- diff --git a/src/emu/ui/menubar.h b/src/emu/ui/menubar.h index 57417e0f0e4..44b2f433e85 100644 --- a/src/emu/ui/menubar.h +++ b/src/emu/ui/menubar.h @@ -241,6 +241,7 @@ private: void draw_child_menu(menu_item *menu, float x, float y); bool is_child_menu_visible(menu_item *menu) const; void draw_menu_item_text(menu_item *mi, float x0, float y0, float x1, float y1, bool decorations, const float *column_widths = NULL); + bool is_highlighted_selection(menu_item *mi); bool event_loop(); bool poll_navigation_keys(); bool poll_shortcut_keys(bool swallow);