From 8a258624c22a368fb3c51bcc467282f585fa66d6 Mon Sep 17 00:00:00 2001
From: looncraz <looncraz@looncraz.net>
Date: Sun, 17 Jan 2016 12:06:36 +0000
Subject: [PATCH] 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
---
src/kits/interface/MenuField.cpp | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/src/kits/interface/MenuField.cpp b/src/kits/interface/MenuField.cpp
index 3318dad..62aa993 100644
a
|
b
|
void
|
428 | 428 | BMenuField::AttachedToWindow() |
429 | 429 | { |
430 | 430 | CALLED(); |
431 | | AdoptParentColors(); |
| 431 | |
| 432 | // Our low color must match the parent's view color. |
| 433 | if (Parent() != NULL) { |
| 434 | AdoptParentColors(); |
| 435 | |
| 436 | float tint = B_NO_TINT; |
| 437 | color_which which = ViewUIColor(&tint); |
| 438 | |
| 439 | if (which == B_NO_COLOR) |
| 440 | SetLowColor(ViewColor()); |
| 441 | else |
| 442 | SetLowUIColor(which, tint); |
| 443 | } else |
| 444 | AdoptSystemColors(); |
432 | 445 | } |
433 | 446 | |
434 | 447 | |
… |
… |
BMenuField::_DrawLabel(BRect updateRect)
|
1065 | 1078 | flags |= BControlLook::B_DISABLED; |
1066 | 1079 | |
1067 | 1080 | // save the current low color |
1068 | | const rgb_color lowColor = LowColor(); |
| 1081 | PushState(); |
1069 | 1082 | rgb_color textColor; |
1070 | 1083 | |
1071 | 1084 | MenuPrivate menuPrivate(fMenuBar); |
… |
… |
BMenuField::_DrawLabel(BRect updateRect)
|
1082 | 1095 | BAlignment(fAlign, B_ALIGN_MIDDLE), &textColor); |
1083 | 1096 | |
1084 | 1097 | // restore the previous low color |
1085 | | SetLowColor(lowColor); |
| 1098 | PopState(); |
1086 | 1099 | } |
1087 | 1100 | |
1088 | 1101 | |