IK: Use panel text color for select control labels

NOTE: This should have no effect on the colors of these labels unless
you have changed the panel text color and control text colors to be
different. Both are black by default.

In the case of the menu field, spinner, check box, radio button,
slider, and text control labels we want to draw these labels using
the panel text color instead of the control text color because they
are drawn on top of the panel color. (the menu field label color was
changed in a previous commit in this push).

In all cases except the menu field the label color is specified by
temporarily unsetting the B_IS_CONTROL flag while drawing the label.
All use control look to draw the label.

The control text color is meant to be used for text INSIDE the control,
not the label text that accompanies the control -- at least that's the
way I understand it.
This commit is contained in:
John Scipione 2016-03-22 11:06:28 -07:00
parent 5b2aa7f856
commit 8b902d940a
5 changed files with 23 additions and 4 deletions

View File

@ -1453,9 +1453,11 @@ BAbstractSpinner::_DrawLabel(BRect updateRect)
- fontHeight.descent) / 2.0f)
+ fontHeight.ascent + kFrameMargin * 2;
uint32 flags = 0;
if (!IsEnabled())
flags |= BControlLook::B_DISABLED;
uint32 flags = be_control_look->Flags(this);
// erase the is control flag before drawing the label so that the label
// will get drawn using B_PANEL_TEXT_COLOR.
flags &= ~BControlLook::B_IS_CONTROL;
be_control_look->DrawLabel(this, label, LowColor(), flags, BPoint(x, y));
}

View File

@ -113,6 +113,10 @@ BCheckBox::Draw(BRect updateRect)
BRect rect(checkBoxRect);
be_control_look->DrawCheckBox(this, rect, updateRect, base, flags);
// erase the is control flag before drawing the label so that the label
// will get drawn using B_PANEL_TEXT_COLOR
flags &= ~BControlLook::B_IS_CONTROL;
BRect labelRect(Bounds());
labelRect.left = checkBoxRect.right + 1
+ be_control_look->DefaultLabelSpacing();

View File

@ -99,6 +99,10 @@ BRadioButton::Draw(BRect updateRect)
BRect rect(knobRect);
be_control_look->DrawRadioButton(this, rect, updateRect, base, flags);
// erase the is control flag before drawing the label so that the label
// will get drawn using B_PANEL_TEXT_COLOR.
flags &= ~BControlLook::B_IS_CONTROL;
BRect labelRect(Bounds());
labelRect.left = knobRect.right + 1
+ be_control_look->DefaultLabelSpacing();

View File

@ -1150,9 +1150,14 @@ BSlider::DrawText()
} else {
view->SetHighColor(tint_color(LowColor(), B_DISABLED_LABEL_TINT));
}
} else
} else {
flags = be_control_look->Flags(this);
// erase the is control flag before drawing the label so that the label
// will get drawn using B_PANEL_TEXT_COLOR
flags &= ~BControlLook::B_IS_CONTROL;
}
font_height fontHeight;
GetFontHeight(&fontHeight);
if (Orientation() == B_HORIZONTAL) {

View File

@ -376,6 +376,10 @@ BTextControl::Draw(BRect updateRect)
rect.right = fDivider - kLabelInputSpacing;
}
// erase the is control flag before drawing the label so that the label
// will get drawn using B_PANEL_TEXT_COLOR
flags &= ~BControlLook::B_IS_CONTROL;
be_control_look->DrawLabel(this, Label(), rect, updateRect,
base, flags, BAlignment(fLabelAlign, B_ALIGN_MIDDLE));
}