highlight the nearest menu item when the current one is disabled, and add separators to focus model menu

This commit is contained in:
Mark Tiefenbruck 2008-09-01 11:00:04 -04:00
parent 79eadb258f
commit 13a73a78f6
3 changed files with 22 additions and 0 deletions

View file

@ -1,5 +1,9 @@
(Format: Year/Month/Day)
Changes for 1.1
*08/09/01:
* When the current menu item gets disabled, highlight its nearest neighbor
and add separators to the focus model menu (Mark)
Screen.cc FbTk/Menu.cc
*08/08/22:
* Remove borders from maximized windows (Mark)
FbWinFrame.cc

View file

@ -374,6 +374,21 @@ void Menu::updateMenu(int active_index) {
} else
menu.item_w = 1;
if (validIndex(m_active_index) && !menuitems[m_active_index]->isEnabled()) {
// find the nearest enabled menuitem and highlight it
for (size_t i = 1; i < menuitems.size(); i++) {
if (validIndex(m_active_index + i) &&
menuitems[m_active_index + i]->isEnabled()) {
m_active_index += i;
break;
} else if (validIndex(m_active_index - i) &&
menuitems[m_active_index - i]->isEnabled()) {
m_active_index -= i;
break;
}
}
}
unsigned int ii = 0;
Menuitems::iterator it = menuitems.begin();
Menuitems::iterator it_end = menuitems.end();

View file

@ -37,6 +37,7 @@
// menu items
#include "FbTk/BoolMenuItem.hh"
#include "FbTk/IntMenuItem.hh"
#include "FbTk/MenuSeparator.hh"
#include "FocusModelMenuItem.hh"
#include "RadioMenuItem.hh"
@ -1619,12 +1620,14 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
FocusControl::MOUSEFOCUS);
#undef _FOCUSITEM
focus_menu->insert(new FbTk::MenuSeparator());
focus_menu->insert(new TabFocusModelMenuItem(_FB_XTEXT(Configmenu,
ClickTabFocus, "ClickTabFocus", "Click tab to focus windows"),
focusControl(), FocusControl::CLICKTABFOCUS, save_and_reconfigure));
focus_menu->insert(new TabFocusModelMenuItem(_FB_XTEXT(Configmenu,
MouseTabFocus, "MouseTabFocus", "Hover over tab to focus windows"),
focusControl(), FocusControl::MOUSETABFOCUS, save_and_reconfigure));
focus_menu->insert(new FbTk::MenuSeparator());
try {
focus_menu->insert(new FbTk::BoolMenuItem(_FB_XTEXT(Configmenu, FocusNew,