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