BScrollBar: Add lines and dots knob styles to scroll bar
Fixes #9137 Move scroll bar drawing into HaikuControlLook Added B_SCROLLABLE flag to BControlLook Update FakeScrollBar in Appearance to also draw using HaikuControlLook. Focus works on scroll bars again, used by FakeScrollBar... and probably nowhere else. Added private _ScrollingEnabled() convenience method to BScrollBar and use it in a few places making. Create ScrollBarPrivate.h header to share a couple of scroll bar related enums with HaikuControlLook that come from BeOS Scroll Bar prefs. Stuff arrow_direction enum into BScrollBar::Private as it has been succeeded by a similar enum already present in BControlLook and is only around now for BScrollBar::Private::DrawScrollBarButton. Change-Id: Idc31ee41de091ba45ded2f0315a004af00143803
This commit is contained in:
committed by
waddlesplash
parent
70f1070b6f
commit
ec1b18c58a
@@ -86,6 +86,7 @@ public:
|
||||
B_FLAT = 1 << 8, // flat look (e.g. button background)
|
||||
B_INVALID = 1 << 9, // invalid value, use B_FAILURE_COLOR
|
||||
B_IS_CONTROL = 1 << 10, // use control colors
|
||||
B_SCROLLABLE = 1 << 11, // scroll bar within bounds
|
||||
|
||||
B_BLEND_FRAME = 1 << 16,
|
||||
};
|
||||
@@ -224,15 +225,17 @@ public:
|
||||
const rgb_color& base,
|
||||
uint32 flags = 0) = 0;
|
||||
|
||||
virtual void DrawScrollBarBackground(BView* view,
|
||||
BRect& rect1, BRect& rect2,
|
||||
virtual void DrawScrollBar(BView* view, BRect& rect,
|
||||
const BRect& updateRect,
|
||||
const rgb_color& base, uint32 flags,
|
||||
orientation orientation) = 0;
|
||||
virtual void DrawScrollBarBackground(BView* view,
|
||||
BRect& rect, const BRect& updateRect,
|
||||
orientation orientation,
|
||||
bool doubleArrows = false,
|
||||
int32 buttonDown = -1) = 0;
|
||||
virtual void DrawScrollBarThumb(BView* view, BRect& rect,
|
||||
BRect& thumbRect, const BRect& updateRect,
|
||||
const rgb_color& base, uint32 flags,
|
||||
orientation orientation) = 0;
|
||||
orientation orientation,
|
||||
uint32 knobStyle = 0) = 0;
|
||||
|
||||
virtual void DrawScrollViewFrame(BView* view,
|
||||
BRect& rect, const BRect& updateRect,
|
||||
|
||||
@@ -114,6 +114,7 @@ private:
|
||||
// disabled
|
||||
BScrollBar& operator=(const BScrollBar& other);
|
||||
|
||||
bool _ScrollingEnabled() const;
|
||||
bool _DoubleArrows() const;
|
||||
void _UpdateThumbFrame();
|
||||
float _ValueFor(BPoint where) const;
|
||||
@@ -121,14 +122,6 @@ private:
|
||||
BRect _ButtonRectFor(int32 button) const;
|
||||
void _UpdateTargetValue(BPoint where);
|
||||
void _UpdateArrowButtons();
|
||||
void _DrawDisabledBackground(BRect area,
|
||||
const rgb_color& light,
|
||||
const rgb_color& dark,
|
||||
const rgb_color& fill);
|
||||
void _DrawArrowButton(int32 direction,
|
||||
bool doubleArrows, BRect frame,
|
||||
const BRect& updateRect,
|
||||
bool enabled, bool down);
|
||||
|
||||
BSize _MinSize() const;
|
||||
|
||||
|
||||
@@ -157,15 +157,17 @@ public:
|
||||
const rgb_color& base,
|
||||
uint32 flags = 0);
|
||||
|
||||
virtual void DrawScrollBarBackground(BView* view,
|
||||
BRect& rect1, BRect& rect2,
|
||||
virtual void DrawScrollBar(BView* view, BRect& rect,
|
||||
const BRect& updateRect,
|
||||
const rgb_color& base, uint32 flags,
|
||||
orientation orientation);
|
||||
virtual void DrawScrollBarBackground(BView* view,
|
||||
BRect& rect, const BRect& updateRect,
|
||||
orientation orientation,
|
||||
bool doubleArrows = false,
|
||||
int32 buttonDown = -1);
|
||||
virtual void DrawScrollBarThumb(BView* view, BRect& rect,
|
||||
BRect& thumbRect, const BRect& updateRect,
|
||||
const rgb_color& base, uint32 flags,
|
||||
orientation orientation);
|
||||
orientation orientation,
|
||||
uint32 knobStyle = 0);
|
||||
|
||||
virtual void DrawScrollViewFrame(BView* view,
|
||||
BRect& rect, const BRect& updateRect,
|
||||
@@ -559,6 +561,26 @@ protected:
|
||||
const rgb_color& base, rgb_color& color,
|
||||
uint32 flags) const;
|
||||
|
||||
void _DrawScrollBarBackground(BView* view,
|
||||
BRect& rect1, BRect& rect2,
|
||||
const BRect& updateRect,
|
||||
const rgb_color& base, uint32 flags,
|
||||
orientation orientation);
|
||||
void _DrawScrollBarBackground(BView* view,
|
||||
BRect& rect, const BRect& updateRect,
|
||||
const rgb_color& base, uint32 flags,
|
||||
orientation orientation);
|
||||
void _DrawDisabledScrollBarBackground(BView* view,
|
||||
BRect rect, orientation orientation,
|
||||
const rgb_color& light,
|
||||
const rgb_color& dark,
|
||||
const rgb_color& fill);
|
||||
void _DrawScrollBarArrowButton(BView* view,
|
||||
BRect rect, const BRect& updateRect,
|
||||
const rgb_color& base, uint32 flags,
|
||||
int32 direction, orientation orientation,
|
||||
bool doubleArrows, bool down);
|
||||
|
||||
private:
|
||||
bool fCachedOutline;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2018 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* John Scipione, [email protected]
|
||||
*/
|
||||
#ifndef _SCROLL_BAR_PRIVATE_H
|
||||
#define _SCROLL_BAR_PRIVATE_H
|
||||
|
||||
// Constants for determining which arrow is down and are defined with respect
|
||||
// to double arrow mode. ARROW_1 and ARROW_4 refer to the outer pair of arrows
|
||||
// while ARROW_2 and ARROW_3 refer to the inner ones. ARROW_1 point left/up
|
||||
// and ARROW_4 points right/down. THUMB is the scroll bar thumb.
|
||||
enum {
|
||||
SCROLL_NO_ARROW = -1,
|
||||
SCROLL_ARROW_1,
|
||||
SCROLL_ARROW_2,
|
||||
SCROLL_ARROW_3,
|
||||
SCROLL_ARROW_4,
|
||||
SCROLL_THUMB
|
||||
};
|
||||
|
||||
// constants for determining which knob style to draw on scroll bar
|
||||
typedef enum {
|
||||
KNOB_NONE = 0,
|
||||
KNOB_DOTS,
|
||||
KNOB_LINES
|
||||
} knob_style;
|
||||
|
||||
|
||||
#endif // _SCROLL_BAR_PRIVATE_H
|
||||
Reference in New Issue
Block a user