Interface Kit: Adopt parent colors on controls

BControl adopts parent colors on AttachedToWindow(). Use the
adopted view and high colors for BControl derivatives before
using B_CONTROL or B_PANEL colors.

Affects the following controls:
Spinners
Checkboxes
Radio buttons
Sliders
Text controls
Buttons (get control text color already, don't pass it in.)

Affects control colors in HaikuControlLook and BeControlLook,
FlatControlLook control colors derived from HaikuControlLook.

Do not remove control flag before drawing label, we get the
correct label color now. The fallback colors are only for if
you override AttachedToWindow() on your BControl subclass to
prevent adopting parent colors.

Change-Id: I9357c0287898bff48c695a7869f3b8be108c02ad
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8235
Haiku-Format: Haiku-format Bot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
John Scipione
2024-09-05 17:45:01 +00:00
committed by waddlesplash
parent 5333610f85
commit 42df4f9689
9 changed files with 26 additions and 67 deletions
+1 -6
View File
@@ -367,8 +367,7 @@ BTextControl::Draw(BRect updateRect)
if (active)
flags |= BControlLook::B_FOCUSED;
be_control_look->DrawTextControlBorder(this, rect, updateRect, base,
flags);
be_control_look->DrawTextControlBorder(this, rect, updateRect, base, flags);
if (Label() != NULL) {
if (fLayoutData->label_layout_item != NULL) {
@@ -378,10 +377,6 @@ 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));
}