ControlLook: Use B_PANEL_TEXT_COLOR for scrollbar arrows
Change-Id: I7a291842eeaaba00176cb4473a075fad1d3d6293 Reviewed-on: https://review.haiku-os.org/c/haiku/+/8895 Reviewed-by: nephele nephele <[email protected]> Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
0328ffe12a
commit
6670202514
@@ -415,8 +415,8 @@ public:
|
||||
|
||||
virtual void DrawScrollBarButton(BView* view,
|
||||
BRect rect, const BRect& updateRect,
|
||||
const rgb_color& base, uint32 flags,
|
||||
int32 direction, orientation orientation,
|
||||
const rgb_color& base, const rgb_color& text,
|
||||
uint32 flags, int32 direction, orientation orientation,
|
||||
bool down = false) = 0;
|
||||
virtual void DrawScrollBarThumb(BView* view,
|
||||
BRect& rect, const BRect& updateRect,
|
||||
|
||||
@@ -161,8 +161,8 @@ public:
|
||||
orientation orientation);
|
||||
virtual void DrawScrollBarButton(BView* view,
|
||||
BRect rect, const BRect& updateRect,
|
||||
const rgb_color& base, uint32 flags,
|
||||
int32 direction, orientation orientation,
|
||||
const rgb_color& base, const rgb_color& text,
|
||||
uint32 flags, int32 direction, orientation orientation,
|
||||
bool down = false);
|
||||
virtual void DrawScrollBarBackground(BView* view,
|
||||
BRect& rect1, BRect& rect2,
|
||||
|
||||
@@ -424,8 +424,8 @@ BeControlLook::DrawScrollBarBorder(BView* view, BRect rect,
|
||||
|
||||
void
|
||||
BeControlLook::DrawScrollBarButton(BView* view, BRect rect,
|
||||
const BRect& updateRect, const rgb_color& base, uint32 flags,
|
||||
int32 direction, orientation orientation, bool down)
|
||||
const BRect& updateRect, const rgb_color& base, const rgb_color& text,
|
||||
uint32 flags, int32 direction, orientation orientation, bool down)
|
||||
{
|
||||
view->PushState();
|
||||
|
||||
|
||||
@@ -84,8 +84,8 @@ public:
|
||||
orientation orientation);
|
||||
virtual void DrawScrollBarButton(BView* view,
|
||||
BRect rect, const BRect& updateRect,
|
||||
const rgb_color& base, uint32 flags,
|
||||
int32 direction, orientation orientation,
|
||||
const rgb_color& base, const rgb_color& text,
|
||||
uint32 flags, int32 direction, orientation orientation,
|
||||
bool down = false);
|
||||
virtual void DrawScrollBarBackground(BView* view,
|
||||
BRect& rect1, BRect& rect2,
|
||||
|
||||
@@ -360,8 +360,8 @@ FlatControlLook::DrawScrollBarBorder(BView* view, BRect rect,
|
||||
|
||||
void
|
||||
FlatControlLook::DrawScrollBarButton(BView* view, BRect rect,
|
||||
const BRect& updateRect, const rgb_color& base, uint32 flags,
|
||||
int32 direction, orientation orientation, bool down)
|
||||
const BRect& updateRect, const rgb_color& base, const rgb_color& text,
|
||||
uint32 flags, int32 direction, orientation orientation, bool down)
|
||||
{
|
||||
if (!ShouldDraw(view, rect, updateRect))
|
||||
return;
|
||||
@@ -371,16 +371,16 @@ FlatControlLook::DrawScrollBarButton(BView* view, BRect rect,
|
||||
bool isEnabled = (flags & B_DISABLED) == 0;
|
||||
|
||||
if (isEnabled) {
|
||||
arrowColor = tint_color(ui_color(B_CONTROL_TEXT_COLOR), 0.6);
|
||||
arrowColor = tint_color(text, 0.6);
|
||||
// if the base color is too dark, then lets make it lighter
|
||||
if (base.IsDark()) {
|
||||
arrowColor = tint_color(ui_color(B_CONTROL_TEXT_COLOR), 1.3);;
|
||||
arrowColor = tint_color(text, 1.3);
|
||||
}
|
||||
} else {
|
||||
arrowColor = tint_color(ui_color(B_CONTROL_TEXT_COLOR), 0.4);
|
||||
arrowColor = tint_color(text, 0.4);
|
||||
// if the base color is too dark, then lets make it lighter
|
||||
if (base.IsDark()) {
|
||||
arrowColor = tint_color(ui_color(B_CONTROL_TEXT_COLOR), 1.5);;
|
||||
arrowColor = tint_color(text, 1.5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -86,8 +86,8 @@ public:
|
||||
orientation orientation);
|
||||
virtual void DrawScrollBarButton(BView* view,
|
||||
BRect rect, const BRect& updateRect,
|
||||
const rgb_color& base, uint32 flags,
|
||||
int32 direction, orientation orientation,
|
||||
const rgb_color& base, const rgb_color& text,
|
||||
uint32 flags, int32 direction, orientation orientation,
|
||||
bool down = false);
|
||||
virtual void DrawScrollBarBackground(BView* view,
|
||||
BRect& rect1, BRect& rect2,
|
||||
|
||||
@@ -151,11 +151,11 @@ extern "C" void
|
||||
B_IF_GCC_2(_ReservedControlLook2__Q28BPrivate12BControlLook,
|
||||
_ZN8BPrivate12BControlLook21_ReservedControlLook2Ev)(
|
||||
BControlLook* controlLook, BView* view, BRect rect,
|
||||
const BRect& updateRect, const rgb_color& base, uint32 flags,
|
||||
int32 direction, orientation orientation, bool down)
|
||||
const BRect& updateRect, const rgb_color& base, const rgb_color& text,
|
||||
uint32 flags, int32 direction, orientation orientation, bool down)
|
||||
{
|
||||
controlLook->DrawScrollBarButton(view, rect, updateRect, base, flags,
|
||||
direction, orientation, down);
|
||||
controlLook->DrawScrollBarButton(view, rect, updateRect, base, text,
|
||||
flags, direction, orientation, down);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -615,8 +615,8 @@ HaikuControlLook::DrawScrollBarBorder(BView* view, BRect rect,
|
||||
|
||||
void
|
||||
HaikuControlLook::DrawScrollBarButton(BView* view, BRect rect,
|
||||
const BRect& updateRect, const rgb_color& base, uint32 flags,
|
||||
int32 direction, orientation orientation, bool down)
|
||||
const BRect& updateRect, const rgb_color& base, const rgb_color& text,
|
||||
uint32 flags, int32 direction, orientation orientation, bool down)
|
||||
{
|
||||
if (!ShouldDraw(view, rect, updateRect))
|
||||
return;
|
||||
@@ -634,8 +634,7 @@ HaikuControlLook::DrawScrollBarButton(BView* view, BRect rect,
|
||||
BControlLook::B_ALL_BORDERS, orientation);
|
||||
|
||||
rect.InsetBy(-1, -1);
|
||||
DrawArrowShape(view, rect, updateRect, base, direction, flags, 1.9f);
|
||||
// almost but not quite B_DARKEN_MAX_TINT
|
||||
DrawArrowShape(view, rect, updateRect, text, direction, flags, 1);
|
||||
|
||||
// revert clipping constraints
|
||||
view->PopState();
|
||||
|
||||
@@ -388,6 +388,7 @@ void
|
||||
BScrollBar::Draw(BRect updateRect)
|
||||
{
|
||||
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
rgb_color text = ui_color(B_PANEL_TEXT_COLOR);
|
||||
|
||||
uint32 flags = 0;
|
||||
bool scrollingEnabled = fMin < fMax
|
||||
@@ -419,7 +420,7 @@ BScrollBar::Draw(BRect updateRect)
|
||||
rect.left + rect.Height(), rect.bottom);
|
||||
|
||||
be_control_look->DrawScrollBarButton(this, buttonFrame, updateRect,
|
||||
base, flags | (fPrivateData->fButtonDown == ARROW1
|
||||
base, text, flags | (fPrivateData->fButtonDown == ARROW1
|
||||
? BControlLook::B_ACTIVATED : 0),
|
||||
BControlLook::B_LEFT_ARROW, fOrientation,
|
||||
fPrivateData->fButtonDown == ARROW1);
|
||||
@@ -427,7 +428,7 @@ BScrollBar::Draw(BRect updateRect)
|
||||
if (doubleArrows) {
|
||||
buttonFrame.OffsetBy(rect.Height() + 1, 0.0f);
|
||||
be_control_look->DrawScrollBarButton(this, buttonFrame, updateRect,
|
||||
base, flags | (fPrivateData->fButtonDown == ARROW2
|
||||
base, text, flags | (fPrivateData->fButtonDown == ARROW2
|
||||
? BControlLook::B_ACTIVATED : 0),
|
||||
BControlLook::B_RIGHT_ARROW, fOrientation,
|
||||
fPrivateData->fButtonDown == ARROW2);
|
||||
@@ -435,7 +436,7 @@ BScrollBar::Draw(BRect updateRect)
|
||||
buttonFrame.OffsetTo(rect.right - ((rect.Height() * 2) + 1),
|
||||
rect.top);
|
||||
be_control_look->DrawScrollBarButton(this, buttonFrame, updateRect,
|
||||
base, flags | (fPrivateData->fButtonDown == ARROW3
|
||||
base, text, flags | (fPrivateData->fButtonDown == ARROW3
|
||||
? BControlLook::B_ACTIVATED : 0),
|
||||
BControlLook::B_LEFT_ARROW, fOrientation,
|
||||
fPrivateData->fButtonDown == ARROW3);
|
||||
@@ -449,7 +450,7 @@ BScrollBar::Draw(BRect updateRect)
|
||||
|
||||
buttonFrame.OffsetTo(rect.right - rect.Height(), rect.top);
|
||||
be_control_look->DrawScrollBarButton(this, buttonFrame, updateRect,
|
||||
base, flags | (fPrivateData->fButtonDown == ARROW4
|
||||
base, text, flags | (fPrivateData->fButtonDown == ARROW4
|
||||
? BControlLook::B_ACTIVATED : 0),
|
||||
BControlLook::B_RIGHT_ARROW, fOrientation,
|
||||
fPrivateData->fButtonDown == ARROW4);
|
||||
@@ -458,7 +459,7 @@ BScrollBar::Draw(BRect updateRect)
|
||||
rect.top + rect.Width());
|
||||
|
||||
be_control_look->DrawScrollBarButton(this, buttonFrame, updateRect,
|
||||
base, flags | (fPrivateData->fButtonDown == ARROW1
|
||||
base, text, flags | (fPrivateData->fButtonDown == ARROW1
|
||||
? BControlLook::B_ACTIVATED : 0),
|
||||
BControlLook::B_UP_ARROW, fOrientation,
|
||||
fPrivateData->fButtonDown == ARROW1);
|
||||
@@ -466,7 +467,7 @@ BScrollBar::Draw(BRect updateRect)
|
||||
if (doubleArrows) {
|
||||
buttonFrame.OffsetBy(0, rect.Width() + 1);
|
||||
be_control_look->DrawScrollBarButton(this, buttonFrame,
|
||||
updateRect, base, flags | (fPrivateData->fButtonDown == ARROW2
|
||||
updateRect, base, text, flags | (fPrivateData->fButtonDown == ARROW2
|
||||
? BControlLook::B_ACTIVATED : 0),
|
||||
BControlLook::B_DOWN_ARROW, fOrientation,
|
||||
fPrivateData->fButtonDown == ARROW2);
|
||||
@@ -474,7 +475,7 @@ BScrollBar::Draw(BRect updateRect)
|
||||
buttonFrame.OffsetTo(rect.left, rect.bottom
|
||||
- ((rect.Width() * 2) + 1));
|
||||
be_control_look->DrawScrollBarButton(this, buttonFrame,
|
||||
updateRect, base, flags | (fPrivateData->fButtonDown == ARROW3
|
||||
updateRect, base, text, flags | (fPrivateData->fButtonDown == ARROW3
|
||||
? BControlLook::B_ACTIVATED : 0),
|
||||
BControlLook::B_UP_ARROW, fOrientation,
|
||||
fPrivateData->fButtonDown == ARROW3);
|
||||
@@ -488,7 +489,7 @@ BScrollBar::Draw(BRect updateRect)
|
||||
|
||||
buttonFrame.OffsetTo(rect.left, rect.bottom - rect.Width());
|
||||
be_control_look->DrawScrollBarButton(this, buttonFrame, updateRect,
|
||||
base, flags | (fPrivateData->fButtonDown == ARROW4
|
||||
base, text, flags | (fPrivateData->fButtonDown == ARROW4
|
||||
? BControlLook::B_ACTIVATED : 0),
|
||||
BControlLook::B_DOWN_ARROW, fOrientation,
|
||||
fPrivateData->fButtonDown == ARROW4);
|
||||
|
||||
@@ -49,6 +49,7 @@ void
|
||||
FakeScrollBar::Draw(BRect updateRect)
|
||||
{
|
||||
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
rgb_color text = ui_color(B_PANEL_TEXT_COLOR);
|
||||
|
||||
uint32 flags = BControlLook::B_PARTIALLY_ACTIVATED;
|
||||
|
||||
@@ -82,21 +83,21 @@ FakeScrollBar::Draw(BRect updateRect)
|
||||
BRect buttonFrame(rect.left, rect.top, rect.left + rect.Height(),
|
||||
rect.bottom);
|
||||
be_control_look->DrawScrollBarButton(this, buttonFrame, updateRect,
|
||||
base, flags, BControlLook::B_LEFT_ARROW, B_HORIZONTAL);
|
||||
base, text, flags, BControlLook::B_LEFT_ARROW, B_HORIZONTAL);
|
||||
if (fDoubleArrows) {
|
||||
buttonFrame.OffsetBy(rect.Height() + 1, 0.0f);
|
||||
be_control_look->DrawScrollBarButton(this, buttonFrame,
|
||||
updateRect, base, flags, BControlLook::B_RIGHT_ARROW,
|
||||
updateRect, base, text, flags, BControlLook::B_RIGHT_ARROW,
|
||||
B_HORIZONTAL);
|
||||
buttonFrame.OffsetTo(rect.right - ((rect.Height() * 2) + 1),
|
||||
rect.top);
|
||||
be_control_look->DrawScrollBarButton(this, buttonFrame,
|
||||
updateRect, base, flags, BControlLook::B_LEFT_ARROW,
|
||||
updateRect, base, text, flags, BControlLook::B_LEFT_ARROW,
|
||||
B_HORIZONTAL);
|
||||
}
|
||||
buttonFrame.OffsetTo(rect.right - rect.Height(), rect.top);
|
||||
be_control_look->DrawScrollBarButton(this, buttonFrame, updateRect,
|
||||
base, flags, BControlLook::B_RIGHT_ARROW, B_HORIZONTAL);
|
||||
base, text, flags, BControlLook::B_RIGHT_ARROW, B_HORIZONTAL);
|
||||
}
|
||||
|
||||
// inset rect to make room for arrows
|
||||
|
||||
Reference in New Issue
Block a user