diff options
author | Mark Tiefenbruck <mark@fluxbox.org> | 2008-09-01 15:00:04 (GMT) |
---|---|---|
committer | Mark Tiefenbruck <mark@fluxbox.org> | 2008-09-01 15:00:04 (GMT) |
commit | 13a73a78f604c2735089f98e2e89d097c2f324bc (patch) | |
tree | 0904944678da64987d13865876db70b24d1994e8 /src/FbTk | |
parent | 79eadb258f8cb975b4984e56b1f061b9d3e02dd5 (diff) | |
download | fluxbox-13a73a78f604c2735089f98e2e89d097c2f324bc.zip fluxbox-13a73a78f604c2735089f98e2e89d097c2f324bc.tar.bz2 |
highlight the nearest menu item when the current one is disabled, and add separators to focus model menu
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(); |