aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2008-09-01 15:00:04 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2008-09-01 15:00:04 (GMT)
commit13a73a78f604c2735089f98e2e89d097c2f324bc (patch)
tree0904944678da64987d13865876db70b24d1994e8 /src
parent79eadb258f8cb975b4984e56b1f061b9d3e02dd5 (diff)
downloadfluxbox_pavel-13a73a78f604c2735089f98e2e89d097c2f324bc.zip
fluxbox_pavel-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')
-rw-r--r--src/FbTk/Menu.cc15
-rw-r--r--src/Screen.cc3
2 files changed, 18 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();
diff --git a/src/Screen.cc b/src/Screen.cc
index 4340ef1..23f85a5 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -37,6 +37,7 @@
37// menu items 37// menu items
38#include "FbTk/BoolMenuItem.hh" 38#include "FbTk/BoolMenuItem.hh"
39#include "FbTk/IntMenuItem.hh" 39#include "FbTk/IntMenuItem.hh"
40#include "FbTk/MenuSeparator.hh"
40#include "FocusModelMenuItem.hh" 41#include "FocusModelMenuItem.hh"
41#include "RadioMenuItem.hh" 42#include "RadioMenuItem.hh"
42 43
@@ -1619,12 +1620,14 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
1619 FocusControl::MOUSEFOCUS); 1620 FocusControl::MOUSEFOCUS);
1620#undef _FOCUSITEM 1621#undef _FOCUSITEM
1621 1622
1623 focus_menu->insert(new FbTk::MenuSeparator());
1622 focus_menu->insert(new TabFocusModelMenuItem(_FB_XTEXT(Configmenu, 1624 focus_menu->insert(new TabFocusModelMenuItem(_FB_XTEXT(Configmenu,
1623 ClickTabFocus, "ClickTabFocus", "Click tab to focus windows"), 1625 ClickTabFocus, "ClickTabFocus", "Click tab to focus windows"),
1624 focusControl(), FocusControl::CLICKTABFOCUS, save_and_reconfigure)); 1626 focusControl(), FocusControl::CLICKTABFOCUS, save_and_reconfigure));
1625 focus_menu->insert(new TabFocusModelMenuItem(_FB_XTEXT(Configmenu, 1627 focus_menu->insert(new TabFocusModelMenuItem(_FB_XTEXT(Configmenu,
1626 MouseTabFocus, "MouseTabFocus", "Hover over tab to focus windows"), 1628 MouseTabFocus, "MouseTabFocus", "Hover over tab to focus windows"),
1627 focusControl(), FocusControl::MOUSETABFOCUS, save_and_reconfigure)); 1629 focusControl(), FocusControl::MOUSETABFOCUS, save_and_reconfigure));
1630 focus_menu->insert(new FbTk::MenuSeparator());
1628 1631
1629 try { 1632 try {
1630 focus_menu->insert(new FbTk::BoolMenuItem(_FB_XTEXT(Configmenu, FocusNew, 1633 focus_menu->insert(new FbTk::BoolMenuItem(_FB_XTEXT(Configmenu, FocusNew,