BScrollView: Automatically update the scrollbar proportions in layout mode.

Since we know what size the target view is / wants to be, we can automatically
set the range, steps, and proportion trivially. In non-layout mode, we retain
the old behavior. Applications or views that need custom scrolling behavior almost
certainly will be using BScrollBars directly and not this, so this should not be
"wasted computation" in pretty much any case.

Greatly improves the appearance and UX of the default case of a layouted
view inside a BScrollView.

Change-Id: Ia6ff6ee14df96799c579e15d274fd4c849675577
Reviewed-on: https://review.haiku-os.org/c/892
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Augustin Cavalier
2019-01-24 18:52:39 +00:00
committed by waddlesplash
parent 2502d45aca
commit 5b0e5c0ac6
2 changed files with 45 additions and 12 deletions
+5 -4
View File
@@ -1,13 +1,13 @@
/*
* Copyright 2014 Haiku, Inc. All rights reserved.
* Copyright 2014-2019, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* John Scipione, [email protected]
*
* Corresponds to:
* headers/os/interface/ScrollView.h hrev47312
* src/kits/interface/ScrollView.cpp hrev47312
* headers/os/interface/ScrollView.h hrev52792
* src/kits/interface/ScrollView.cpp hrev52792
*/
@@ -216,7 +216,8 @@
\fn void BScrollView::FrameResized(float newWidth, float newHeight)
\brief Hook method called when the scroll view is resized.
\copydetails BView::FrameResized()
If the scroll view is part of a layout, the default implementation will
re-proportion the attached scrollbars relative to the new size.
*/