ScrollView class
#include <Jazz2/UI/Windows/Widgets.h>
Shows a part of its content and lets the rest be scrolled to.
Base classes
- class Element
- Element of the interface.
Constructors, destructors, conversion operators
- ScrollView()
- Creates a new instance.
Public functions
- auto GetContent() const -> Element*
- Returns the content, the only child.
-
template<class T, class... Args>auto SetContent(Args && ... args) -> T*
- Sets the content.
- auto GetScroll() const -> float
- Returns how far the content is scrolled in pixels.
- auto IsScrollable() const -> bool
- Returns
trueif the content is larger than what is shown of it. - void ScrollIntoView(float top, float bottom)
- Scrolls so that a part of the content in pixels from its top is visible.
- void ScrollTo(float scroll, bool immediate)
- Scrolls to a distance from the top in pixels, at once or gliding there.
- void Fling(float velocity)
- Goes on scrolling at a speed in pixels a frame, slowing down by itself, as after a flick of a finger, nothing with reduced motion.
- auto Measure(const Context& context, Vector2f available) -> Vector2f override
- Returns the size the element wants, in pixels.
- void Arrange(const Context& context, const Rectf& bounds) override
- Places the element and its children.
- void Draw(Painter& painter) override
- Draws the element and its children.
- void Update(float timeMult) override
- Advances animations of the element and its children.
- auto HitTest(Vector2f pos) -> Element* override
- Returns the element under a position that takes the pointer, or
nullptr. - auto AcceptsPointer() const -> bool override
- Returns
trueif the element takes the pointer itself. - auto OnPointerDown(const PointerEvent& event) -> bool override
- Called when the pointer is pressed over the element, returns
trueto keep getting it until released. - void OnPointerMove(const PointerEvent& event) override
- Called when the pointer moves while pressed over the element.
- void OnPointerUp(const PointerEvent& event, bool inside) override
- Called when the pointer is released,
insidetells whether it's still over the element. - void OnPointerCancel() override
- Called instead of OnPointerUp() when the press was taken away, such as by a finger scrolling the list it's in.
- auto OnWheel(const PointerEvent& event) -> bool override
- Called when the pointer is scrolled over the element, returns
trueif it was used.
Public variables
- bool FollowEnd
- Whether the view stays at the end of the content while it grows, as a log does.
- bool OverlayBar
- Whether the bar is only a thin mark over the edge of the content, which keeps the whole width.
- float OverlayBarOffset
- How far right of the edge of the content the thin mark of OverlayBar is moved, in units, into the padding around it.
Function documentation
Variable documentation
bool Jazz2:: UI:: Windows:: ScrollView:: FollowEnd
Whether the view stays at the end of the content while it grows, as a log does.
It starts at the end, and follows the content only while it's scrolled to the end, so a part scrolled back to stays in view.
bool Jazz2:: UI:: Windows:: ScrollView:: OverlayBar
Whether the bar is only a thin mark over the edge of the content, which keeps the whole width.
For a strip too narrow to give the bar room of its own. The bar can't be dragged then, the content is scrolled by the wheel or a finger.