Interface Kit: Adopt parent colors on checkboxes and radio buttons
We do not always use radio buttons and check boxes on panel color,
use the parent colors instead if you have them. The label is left-
center aligned.
Change-Id: Id5cbd98e8ae88d3a65fb0735d45b2ad19c4afdf9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8233
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
(cherry picked from commit 5333610f85f043f71ca2c7d220990fefbe43f6fa)
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8204
Diff
src/kits/interface/CheckBox.cpp | 14 +++++++++++++-
src/kits/interface/RadioButton.cpp | 17 +++++++++++++++--
2 files changed, 23 insertions(+), 8 deletions(-)
@@ -103,7 +103,14 @@
void
BCheckBox::Draw(BRect updateRect)
{
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
rgb_color base, textColor;
if (Parent() != NULL) {
base = Parent()->ViewColor();
textColor = Parent()->HighColor();
} else {
base = ui_color(B_PANEL_BACKGROUND_COLOR);
textColor = ui_color(B_PANEL_TEXT_COLOR);
}
uint32 flags = be_control_look->Flags(this);
if (fOutlined)
@@ -123,9 +130,10 @@
const BBitmap* icon = IconBitmap(
B_INACTIVE_ICON_BITMAP | (IsEnabled() ? 0 : B_DISABLED_ICON_BITMAP));
const BAlignment alignment = BAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_CENTER);
be_control_look->DrawLabel(this, Label(), icon, labelRect, updateRect,
base, flags);
be_control_look->DrawLabel(this, Label(), icon, labelRect, updateRect, base, flags, alignment,
&textColor);
}
@@ -89,7 +89,14 @@
font_height fontHeight;
GetFontHeight(&fontHeight);
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
rgb_color base, textColor;
if (Parent() != NULL) {
base = Parent()->ViewColor();
textColor = Parent()->HighColor();
} else {
base = ui_color(B_PANEL_BACKGROUND_COLOR);
textColor = ui_color(B_PANEL_TEXT_COLOR);
}
uint32 flags = be_control_look->Flags(this);
if (fOutlined)
@@ -104,14 +111,14 @@
flags &= ~BControlLook::B_IS_CONTROL;
BRect labelRect(Bounds());
labelRect.left = knobRect.right + 1
+ be_control_look->DefaultLabelSpacing();
labelRect.left = knobRect.right + 1 + be_control_look->DefaultLabelSpacing();
const BBitmap* icon = IconBitmap(
B_INACTIVE_ICON_BITMAP | (IsEnabled() ? 0 : B_DISABLED_ICON_BITMAP));
const BAlignment alignment = BAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_CENTER);
be_control_look->DrawLabel(this, Label(), icon, labelRect, updateRect,
base, flags);
be_control_look->DrawLabel(this, Label(), icon, labelRect, updateRect, base, flags, alignment,
&textColor);
}