IK: Update scroll bars for alternative control look

Scroll bars should look and work identically to before on
HaikuControlLook.

Add DrawScrollBarButton() and DrawScrollBarThumb() and
DrawScrollBarBorder() methods. These methods are used to draw scroll
bars in a generic way so that they can be drawn differently by alternative
control look's (e.g. BeControlLook). Also it gives us back drawing of
scroll bar knobs.  However the knob setting is not exposed in the
interface in this commit.

These methods are in addition to the 2 existing DrawScrollBarBackground()
methods that draw the scroll bar background. One draws the area above and
below the thumb and the other is called by the first to actually draw the
area.

The rest of the drawing besides the backgrounds was being done in
BScrollBar before. To draw the scroll bar arrows and thumb we were recyling
other ControlLook methods, while this worked well enough on HaikuControlLook
it wasn't flexible enough for alternative control looks.

DrawScrollBarButton() is used to draw the four scroll buttons and is
typically (so far) used in combination with DrawArrowShape().

DrawScrollBarThumb() draws the scroll bar thumb.

DrawScrollBarBorder() draws a 1px border around the entire scroll bar,
potentially B_KEYBOARD_NAVIGATION_COLOR if focused (although this is
feature not currently used.)

Draw unscrollable scroll bars as if they were disabled including the
buttons with their arrow shapes, background, and thumb.

Add FBC backwords compatibility macros in ControlLook.cpp

Change-Id: I9237c5ce45d17d674785111d51de951e5686306b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/351
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
John Scipione
2020-04-11 16:57:54 +00:00
committed by waddlesplash
parent 67597f4204
commit 1482b250a7
6 changed files with 495 additions and 323 deletions
+23 -4
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2017, Haiku, Inc. All rights reserved.
* Copyright 2009-2020 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _CONTROL_LOOK_H
@@ -90,6 +90,12 @@ public:
B_BLEND_FRAME = 1 << 16,
};
enum {
B_KNOB_NONE = 0,
B_KNOB_DOTS,
B_KNOB_LINES
};
virtual BAlignment DefaultLabelAlignment() const = 0;
virtual float DefaultLabelSpacing() const = 0;
@@ -401,11 +407,24 @@ public:
uint32 borders = B_ALL_BORDERS,
border_style borderStyle = B_FANCY_BORDER,
uint32 side = B_TOP_BORDER) = 0;
virtual void DrawScrollBarButton(BView* view,
BRect rect, const BRect& updateRect,
const rgb_color& base, uint32 flags,
int32 direction, orientation orientation,
bool down = false) = 0;
virtual void DrawScrollBarThumb(BView* view,
BRect& rect, const BRect& updateRect,
const rgb_color& base, uint32 flags,
orientation orientation,
uint32 knobStyle = B_KNOB_NONE) = 0;
virtual void DrawScrollBarBorder(BView* view,
BRect rect, const BRect& updateRect,
const rgb_color& base, uint32 flags,
orientation orientation) = 0;
private:
// FBC padding
virtual void _ReservedControlLook2();
virtual void _ReservedControlLook3();
virtual void _ReservedControlLook4();
virtual void _ReservedControlLook5();
virtual void _ReservedControlLook6();
virtual void _ReservedControlLook7();