trunk/src/emu/ui/menubar.c
| r29602 | r29603 | |
| 634 | 634 | fgcolor = UI_UNAVAILABLE_COLOR; |
| 635 | 635 | bgcolor = UI_TEXT_BG_COLOR; |
| 636 | 636 | } |
| 637 | | else if (mi == m_selected_item) |
| 637 | else if (is_highlighted_selection(mi)) |
| 638 | 638 | { |
| 639 | 639 | // selected |
| 640 | 640 | fgcolor = UI_SELECTED_COLOR; |
| r29602 | r29603 | |
| 704 | 704 | |
| 705 | 705 | |
| 706 | 706 | //------------------------------------------------- |
| 707 | // is_highlighted_selection |
| 708 | //------------------------------------------------- |
| 709 | |
| 710 | bool ui_menubar::is_highlighted_selection(menu_item *mi) |
| 711 | { |
| 712 | bool result = false; |
| 713 | |
| 714 | if (mi == m_selected_item) |
| 715 | { |
| 716 | // this item _is_ the selection |
| 717 | result = true; |
| 718 | } |
| 719 | else if (m_selected_item != NULL) |
| 720 | { |
| 721 | // walk up the menu hierarchy; we want to also highlight ancestor sub menus |
| 722 | menu_item *selected_item_ancestor = m_selected_item; |
| 723 | do |
| 724 | { |
| 725 | selected_item_ancestor = selected_item_ancestor->parent(); |
| 726 | result = (mi == selected_item_ancestor) && selected_item_ancestor->is_sub_menu(); |
| 727 | } |
| 728 | while(!result && selected_item_ancestor->is_sub_menu()); |
| 729 | } |
| 730 | return result; |
| 731 | } |
| 732 | |
| 733 | |
| 734 | //------------------------------------------------- |
| 707 | 735 | // find_mouse |
| 708 | 736 | //------------------------------------------------- |
| 709 | 737 | |
trunk/src/emu/ui/menubar.h
| r29602 | r29603 | |
| 241 | 241 | void draw_child_menu(menu_item *menu, float x, float y); |
| 242 | 242 | bool is_child_menu_visible(menu_item *menu) const; |
| 243 | 243 | void draw_menu_item_text(menu_item *mi, float x0, float y0, float x1, float y1, bool decorations, const float *column_widths = NULL); |
| 244 | bool is_highlighted_selection(menu_item *mi); |
| 244 | 245 | bool event_loop(); |
| 245 | 246 | bool poll_navigation_keys(); |
| 246 | 247 | bool poll_shortcut_keys(bool swallow); |