mirror of
https://github.com/holub/mame
synced 2025-10-07 09:25:34 +03:00
Now highlighting menu items ancestral to the selection
This commit is contained in:
parent
b605b791dd
commit
3a22c7ec12
@ -634,7 +634,7 @@ void ui_menubar::draw_menu_item_text(menu_item *mi, float x0, float y0, float x1
|
|||||||
fgcolor = UI_UNAVAILABLE_COLOR;
|
fgcolor = UI_UNAVAILABLE_COLOR;
|
||||||
bgcolor = UI_TEXT_BG_COLOR;
|
bgcolor = UI_TEXT_BG_COLOR;
|
||||||
}
|
}
|
||||||
else if (mi == m_selected_item)
|
else if (is_highlighted_selection(mi))
|
||||||
{
|
{
|
||||||
// selected
|
// selected
|
||||||
fgcolor = UI_SELECTED_COLOR;
|
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
|
// find_mouse
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
@ -241,6 +241,7 @@ private:
|
|||||||
void draw_child_menu(menu_item *menu, float x, float y);
|
void draw_child_menu(menu_item *menu, float x, float y);
|
||||||
bool is_child_menu_visible(menu_item *menu) const;
|
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);
|
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 event_loop();
|
||||||
bool poll_navigation_keys();
|
bool poll_navigation_keys();
|
||||||
bool poll_shortcut_keys(bool swallow);
|
bool poll_shortcut_keys(bool swallow);
|
||||||
|
Loading…
Reference in New Issue
Block a user