pub struct ScrollView { /* private fields */ }Expand description
A box that shows part of its child, which may be taller, and scrolls it with the mouse wheel or touchpad. Children are cut to the box. Give it a height through its style, or let its parent size it.
use crabshell_ui::{Column, ScrollView, Style, Text};
let log = ScrollView::new(Column::new().child(Text::new("first line")))
.style(Style::new().height(200.0));Implementations§
Source§impl ScrollView
impl ScrollView
Sourcepub fn new(child: impl Widget) -> ScrollView
pub fn new(child: impl Widget) -> ScrollView
A scroll view of child.
Sourcepub fn offset(self, offset: Signal<f32>) -> ScrollView
pub fn offset(self, offset: Signal<f32>) -> ScrollView
Shares the offset: how many logical pixels of the child are scrolled out of view above, or to the left in a horizontal view. Scrolling writes it, and setting it scrolls, stopping a fling. Values past either end show that end.
Sourcepub fn horizontal(self, horizontal: impl IntoProp<bool>) -> ScrollView
pub fn horizontal(self, horizontal: impl IntoProp<bool>) -> ScrollView
Scrolls sideways instead: the child is laid out at its full width rather than its full height, and the wheel, tilted or turned, and the touchpad’s sideways motion scroll it. Both at once isn’t offered.
Sourcepub fn kinetic(self, kinetic: impl IntoProp<bool>) -> ScrollView
pub fn kinetic(self, kinetic: impl IntoProp<bool>) -> ScrollView
Keeps the child moving after a touchpad fling or a drag of the child
ends, slowing down by 1500 logical pixels a second each second from
at most 2500 a second, as Qt’s Flickable. On by default. A mouse
wheel’s notch still moves 48 pixels at once.
Sourcepub fn overshoot(self, overshoot: impl IntoProp<bool>) -> ScrollView
pub fn overshoot(self, overshoot: impl IntoProp<bool>) -> ScrollView
Lets a touchpad, a drag or a fling carry the child past either end,
against a pull that grows with the distance and stops it within a
quarter of the box, and springs it back once let go, as Qt’s
DragAndOvershootBounds. Only shown: the offset stays within the
content. On by default.
Sourcepub fn scroll_bar(self, style: impl IntoProp<Option<Style>>) -> ScrollView
pub fn scroll_bar(self, style: impl IntoProp<Option<Style>>) -> ScrollView
Draws a scroll bar while the child is longer than the box: a handle
along the right edge, or the bottom of a horizontal view, inside the
border, as long as the part shown and placed by the offset, over
the child. Its style’s background and radius draw the handle,
and its width, 6 by default, is its thickness. Dragging the handle
scrolls, and a press beside it pages toward the press. None, the
default, draws none.
Sourcepub fn style(self, style: impl IntoProp<Style>) -> ScrollView
pub fn style(self, style: impl IntoProp<Style>) -> ScrollView
Sets the style. A scroll view cuts its child to the inside of its
border whatever clip says.
Sourcepub fn visible(self, visible: impl IntoProp<bool>) -> Self
pub fn visible(self, visible: impl IntoProp<bool>) -> Self
Shows or hides the widget. Hidden, it is taken out of the layout, so its space goes to the others, and it isn’t drawn, hit or reached by Tab; it drops the keyboard focus and the pointer. Its bindings and state stay, so it shows again as it was. Shown by default.
Sourcepub fn geometry(self, geometry: Signal<Rect>) -> Self
pub fn geometry(self, geometry: Signal<Rect>) -> Self
Shares where the widget is: after each layout that moves or
resizes it, its laid-out rectangle in the window’s logical
pixels, scrolled with any scroll view around it but not moved by
a style’s translate, scale or rotate, is written to geometry. A
hidden widget writes nothing. An effect that reads it may change
the layout: the window is laid out again at once, until nothing
moves.