From 8a3ae7a49df54e17c89b58de29e256bcd48b6536 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Wed, 14 Oct 2015 11:04:16 -0700 Subject: [PATCH] Restore the BMenuField label background Highlighting was added in hrev45983, stopped working in hrev49614, specifically d8919236503108a2db13c454109d7c7696677514. Add comment to explain what is happening and hopefully deter this from being removed again in the future. Fixes #12359 --- src/kits/interface/MenuField.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/kits/interface/MenuField.cpp b/src/kits/interface/MenuField.cpp index c3284c8085..fd312af307 100644 --- a/src/kits/interface/MenuField.cpp +++ b/src/kits/interface/MenuField.cpp @@ -1068,16 +1068,30 @@ BMenuField::_DrawLabel(BRect updateRect) rect = Bounds(); rect.right = fDivider; } + if (!rect.IsValid() || !rect.Intersects(updateRect)) return; - rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR); uint32 flags = 0; if (!IsEnabled()) flags |= BControlLook::B_DISABLED; - be_control_look->DrawLabel(this, label, rect, updateRect, base, flags, + // save the current low color + const rgb_color lowColor = LowColor(); + + MenuPrivate menuPrivate(fMenuBar); + if (menuPrivate.State() != MENU_STATE_CLOSED) { + // highlight the background of the label grey (like BeOS R5) + SetLowColor(ui_color(B_MENU_SELECTED_BACKGROUND_COLOR)); + BRect fillRect(rect.InsetByCopy(0, kVMargin)); + FillRect(fillRect, B_SOLID_LOW); + } + + be_control_look->DrawLabel(this, label, rect, updateRect, LowColor(), flags, BAlignment(fAlign, B_ALIGN_MIDDLE)); + + // restore the previous low color + SetLowColor(lowColor); }