Decorator: Introduce Scroll bar size call
Change-Id: I07f08c2893d832e431c29ae753e0a93d6e619701 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3892 Reviewed-by: Adrien Destugues <[email protected]> Reviewed-by: X512 <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
e158326d29
commit
409d65c0d6
@@ -426,10 +426,11 @@ public:
|
|||||||
BRect rect, const BRect& updateRect,
|
BRect rect, const BRect& updateRect,
|
||||||
const rgb_color& base, uint32 flags,
|
const rgb_color& base, uint32 flags,
|
||||||
orientation orientation) = 0;
|
orientation orientation) = 0;
|
||||||
|
virtual float GetScrollBarWidth(
|
||||||
|
orientation orientation = B_VERTICAL);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// FBC padding
|
// FBC padding
|
||||||
virtual void _ReservedControlLook5();
|
|
||||||
virtual void _ReservedControlLook6();
|
virtual void _ReservedControlLook6();
|
||||||
virtual void _ReservedControlLook7();
|
virtual void _ReservedControlLook7();
|
||||||
virtual void _ReservedControlLook8();
|
virtual void _ReservedControlLook8();
|
||||||
|
|||||||
@@ -339,6 +339,8 @@ public:
|
|||||||
uint32 flags = 0,
|
uint32 flags = 0,
|
||||||
uint32 borders = B_ALL_BORDERS,
|
uint32 borders = B_ALL_BORDERS,
|
||||||
orientation orientation = B_HORIZONTAL);
|
orientation orientation = B_HORIZONTAL);
|
||||||
|
virtual float GetScrollBarWidth(
|
||||||
|
orientation orientation = B_VERTICAL);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _DrawButtonFrame(BView* view, BRect& rect,
|
void _DrawButtonFrame(BView* view, BRect& rect,
|
||||||
|
|||||||
@@ -71,6 +71,15 @@ BControlLook::GetInsets(frame_type frameType, background_type backgroundType,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float
|
||||||
|
BControlLook::GetScrollBarWidth(orientation orientation)
|
||||||
|
{
|
||||||
|
// this matches HaikuControlLook.cpp currently
|
||||||
|
if (be_plain_font->Size() <= 12.0f) { return 14.0f; }
|
||||||
|
return be_plain_font->Size() / 12.0f * 14.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BControlLook::SetBackgroundInfo(const BMessage& backgroundInfo)
|
BControlLook::SetBackgroundInfo(const BMessage& backgroundInfo)
|
||||||
{
|
{
|
||||||
@@ -127,7 +136,15 @@ B_IF_GCC_2(_ReservedControlLook4__Q28BPrivate12BControlLook,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BControlLook::_ReservedControlLook5() {}
|
extern "C" float
|
||||||
|
B_IF_GCC_2(_ReservedControlLook5__Q28BPrivate12BControlLook,
|
||||||
|
_ZN8BPrivate12BControlLook21_ReservedControlLook5Ev)(
|
||||||
|
BControlLook* controlLook, orientation orientation)
|
||||||
|
{
|
||||||
|
return controlLook->GetScrollBarWidth(orientation);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void BControlLook::_ReservedControlLook6() {}
|
void BControlLook::_ReservedControlLook6() {}
|
||||||
void BControlLook::_ReservedControlLook7() {}
|
void BControlLook::_ReservedControlLook7() {}
|
||||||
void BControlLook::_ReservedControlLook8() {}
|
void BControlLook::_ReservedControlLook8() {}
|
||||||
|
|||||||
@@ -3832,6 +3832,16 @@ HaikuControlLook::_FillGlossyGradient(BView* view, const BRect& rect,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float
|
||||||
|
HaikuControlLook::GetScrollBarWidth(orientation orientation)
|
||||||
|
{
|
||||||
|
// HaikuControlLook does not make a distinction between the
|
||||||
|
// width and height of the scrollbar, but other controllooks may
|
||||||
|
if (be_plain_font->Size() <= 12.0f) { return 14.0f; }
|
||||||
|
return be_plain_font->Size() / 12.0f * 14.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
HaikuControlLook::_MakeGradient(BGradientLinear& gradient, const BRect& rect,
|
HaikuControlLook::_MakeGradient(BGradientLinear& gradient, const BRect& rect,
|
||||||
const rgb_color& base, float topTint, float bottomTint,
|
const rgb_color& base, float topTint, float bottomTint,
|
||||||
|
|||||||
@@ -995,10 +995,9 @@ BScrollBar::SetBorderHighlighted(bool highlight)
|
|||||||
void
|
void
|
||||||
BScrollBar::GetPreferredSize(float* _width, float* _height)
|
BScrollBar::GetPreferredSize(float* _width, float* _height)
|
||||||
{
|
{
|
||||||
const float scale = std::max(be_plain_font->Size() / 12.0f, 1.0f);
|
|
||||||
if (fOrientation == B_VERTICAL) {
|
if (fOrientation == B_VERTICAL) {
|
||||||
if (_width)
|
if (_width)
|
||||||
*_width = B_V_SCROLL_BAR_WIDTH * scale;
|
*_width = be_control_look->GetScrollBarWidth(B_VERTICAL);
|
||||||
|
|
||||||
if (_height)
|
if (_height)
|
||||||
*_height = _MinSize().Height();
|
*_height = _MinSize().Height();
|
||||||
@@ -1007,7 +1006,7 @@ BScrollBar::GetPreferredSize(float* _width, float* _height)
|
|||||||
*_width = _MinSize().Width();
|
*_width = _MinSize().Width();
|
||||||
|
|
||||||
if (_height)
|
if (_height)
|
||||||
*_height = B_H_SCROLL_BAR_HEIGHT * scale;
|
*_height = be_control_look->GetScrollBarWidth(B_HORIZONTAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user