BColumnListView: Dynamic scrollbar size support.

Improves appearance on HiDPI.
This commit is contained in:
Augustin Cavalier 2022-08-30 22:14:16 -04:00
parent 8d18358cdf
commit 861282ffa7

View File

@ -2148,18 +2148,21 @@ void
BColumnListView::_GetChildViewRects(const BRect& bounds, BRect& titleRect,
BRect& outlineRect, BRect& vScrollBarRect, BRect& hScrollBarRect)
{
const float vScrollBarWidth = be_control_look->GetScrollBarWidth(B_VERTICAL),
hScrollBarHeight = be_control_look->GetScrollBarWidth(B_HORIZONTAL);
titleRect = bounds;
titleRect.bottom = titleRect.top + std::max(kMinTitleHeight,
ceilf(be_plain_font->Size() * kTitleSpacing));
#if !LOWER_SCROLLBAR
titleRect.right -= B_V_SCROLL_BAR_WIDTH;
titleRect.right -= vScrollBarWidth;
#endif
outlineRect = bounds;
outlineRect.top = titleRect.bottom + 1.0;
outlineRect.right -= B_V_SCROLL_BAR_WIDTH;
outlineRect.right -= vScrollBarWidth;
if (fShowingHorizontalScrollBar)
outlineRect.bottom -= B_H_SCROLL_BAR_HEIGHT;
outlineRect.bottom -= hScrollBarHeight;
vScrollBarRect = bounds;
#if LOWER_SCROLLBAR
@ -2167,13 +2170,13 @@ BColumnListView::_GetChildViewRects(const BRect& bounds, BRect& titleRect,
ceilf(be_plain_font->Size() * kTitleSpacing));
#endif
vScrollBarRect.left = vScrollBarRect.right - B_V_SCROLL_BAR_WIDTH;
vScrollBarRect.left = vScrollBarRect.right - vScrollBarWidth;
if (fShowingHorizontalScrollBar)
vScrollBarRect.bottom -= B_H_SCROLL_BAR_HEIGHT;
vScrollBarRect.bottom -= hScrollBarHeight;
hScrollBarRect = bounds;
hScrollBarRect.top = hScrollBarRect.bottom - B_H_SCROLL_BAR_HEIGHT;
hScrollBarRect.right -= B_V_SCROLL_BAR_WIDTH;
hScrollBarRect.top = hScrollBarRect.bottom - hScrollBarHeight;
hScrollBarRect.right -= vScrollBarWidth;
// Adjust stuff so the border will fit.
if (fBorderStyle == B_PLAIN_BORDER || fBorderStyle == B_NO_BORDER) {