diff options
Diffstat (limited to 'src/FbTk')
-rw-r--r-- | src/FbTk/Menu.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc index ce751d9..f4e8f3d 100644 --- a/src/FbTk/Menu.cc +++ b/src/FbTk/Menu.cc | |||
@@ -374,6 +374,21 @@ void Menu::updateMenu(int active_index) { | |||
374 | } else | 374 | } else |
375 | menu.item_w = 1; | 375 | menu.item_w = 1; |
376 | 376 | ||
377 | if (validIndex(m_active_index) && !menuitems[m_active_index]->isEnabled()) { | ||
378 | // find the nearest enabled menuitem and highlight it | ||
379 | for (size_t i = 1; i < menuitems.size(); i++) { | ||
380 | if (validIndex(m_active_index + i) && | ||
381 | menuitems[m_active_index + i]->isEnabled()) { | ||
382 | m_active_index += i; | ||
383 | break; | ||
384 | } else if (validIndex(m_active_index - i) && | ||
385 | menuitems[m_active_index - i]->isEnabled()) { | ||
386 | m_active_index -= i; | ||
387 | break; | ||
388 | } | ||
389 | } | ||
390 | } | ||
391 | |||
377 | unsigned int ii = 0; | 392 | unsigned int ii = 0; |
378 | Menuitems::iterator it = menuitems.begin(); | 393 | Menuitems::iterator it = menuitems.begin(); |
379 | Menuitems::iterator it_end = menuitems.end(); | 394 | Menuitems::iterator it_end = menuitems.end(); |