Previous 199869 Revisions Next

r29603 Sunday 13th April, 2014 at 13:27:05 UTC by Nathan Woods
Now highlighting menu items ancestral to the selection
[src/emu/ui]menubar.c menubar.h

trunk/src/emu/ui/menubar.c
r29602r29603
634634      fgcolor = UI_UNAVAILABLE_COLOR;
635635      bgcolor = UI_TEXT_BG_COLOR;
636636   }
637   else if (mi == m_selected_item)
637   else if (is_highlighted_selection(mi))
638638   {
639639      // selected
640640      fgcolor = UI_SELECTED_COLOR;
r29602r29603
704704
705705
706706//-------------------------------------------------
707//  is_highlighted_selection
708//-------------------------------------------------
709
710bool 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//-------------------------------------------------
707735//  find_mouse
708736//-------------------------------------------------
709737
trunk/src/emu/ui/menubar.h
r29602r29603
241241   void draw_child_menu(menu_item *menu, float x, float y);
242242   bool is_child_menu_visible(menu_item *menu) const;
243243   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);
244245   bool event_loop();
245246   bool poll_navigation_keys();
246247   bool poll_shortcut_keys(bool swallow);

Previous 199869 Revisions Next


© 1997-2024 The MAME Team