MenuField Low Color (for frame)

BMenuField's frame is drawn from the LowColor() which is adopted from its
parent.  However, we should be adopting the parent's view color for our low
color, otherwise we sometimes end up with a miscolored border (most often white).

This was not noticed earlier as most views have matching view and low colors.

Fixes ticket #12603

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
This commit is contained in:
looncraz 2016-01-17 12:06:36 +00:00 committed by Augustin Cavalier
parent 220f79d835
commit 3e08f21606

View File

@ -428,7 +428,20 @@ void
BMenuField::AttachedToWindow()
{
CALLED();
AdoptParentColors();
// Our low color must match the parent's view color.
if (Parent() != NULL) {
AdoptParentColors();
float tint = B_NO_TINT;
color_which which = ViewUIColor(&tint);
if (which == B_NO_COLOR)
SetLowColor(ViewColor());
else
SetLowUIColor(which, tint);
} else
AdoptSystemColors();
}
@ -1065,7 +1078,7 @@ BMenuField::_DrawLabel(BRect updateRect)
flags |= BControlLook::B_DISABLED;
// save the current low color
const rgb_color lowColor = LowColor();
PushState();
rgb_color textColor;
MenuPrivate menuPrivate(fMenuBar);
@ -1082,7 +1095,7 @@ BMenuField::_DrawLabel(BRect updateRect)
BAlignment(fAlign, B_ALIGN_MIDDLE), &textColor);
// restore the previous low color
SetLowColor(lowColor);
PopState();
}