Fix occasional highlighting of menu nops+separators, sf.net patch

#1475268 (thanks Scott Kuhl; skuhl AT cs utah edu)
This commit is contained in:
simonb 2006-04-25 03:11:31 +00:00
parent cb65dae95f
commit e2bc57bc0f
5 changed files with 11 additions and 4 deletions

View file

@ -1,6 +1,9 @@
(Format: Year/Month/Day)
Changes for 0.9.16:
*06/04/25:
* Fix occasional highlighting of menu nops+separators, sf.net patch
#1475268 (thanks Scott Kuhl; skuhl AT cs utah edu)
FbTk/MenuSeparator.hh/cc FbTk/Menu.cc MenuCreator.cc
* fbrun: Move the cursor to the end when tab completing
(Simon + thanks Jonas Koelker), sf.net rfe #1333003, patch #1475578
util/fbrun/FbRun.hh/cc

View file

@ -1182,7 +1182,7 @@ void Menu::openSubmenu() {
return;
int item = m_which_sbl * menu.persub + m_which_press;
if (!validIndex(item))
if (!validIndex(item) || !menuitems[item]->isEnabled())
return;
clearItem(item);

View file

@ -38,8 +38,10 @@ void MenuSeparator::draw(FbDrawable &drawable,
if (draw_background) {
const GContext &tgc =
(highlight ? theme.hiliteTextGC() :
(isEnabled() ? theme.frameTextGC() : theme.disableTextGC() ) );
// its a separator, it shouldn't be highlighted! or shown as disabled
// (highlight ? theme.hiliteTextGC() :
// (isEnabled() ? theme.frameTextGC() : theme.disableTextGC() ) );
theme.frameTextGC();
drawable.drawRectangle(tgc.gc(),
x + theme.bevelWidth() + height + 1, y + height / 2,

View file

@ -36,6 +36,7 @@ public:
bool highlight, bool draw_foreground, bool draw_background,
int x, int y,
unsigned int width, unsigned int height) const;
virtual inline bool isEnabled() const { return false; }
};

View file

@ -186,7 +186,8 @@ static void translateMenuItem(Parser &parse, ParseItem &pitem) {
if (str_key == "end") {
return;
} else if (str_key == "nop") {
menu.insert(str_label.c_str());
int menuSize = menu.insert(str_label.c_str());
menu.setItemEnabled(menuSize-1, false);
} else if (str_key == "icons") {
FbTk::Menu *submenu = MenuCreator::createMenuType("iconmenu", menu.screenNumber());
if (submenu == 0)