pub struct ScrollView { /* private fields */ }Expand description
A native scroll container. Its children go into a content box that keeps its natural size, so it can be larger than the scroll view.
Give the scroll view a bounded size (a fixed height, or grow inside a
sized parent); otherwise it grows with its content and never scrolls.
As in CSS, its natural size is its content’s, so in a flex container its
siblings shrink along with it unless they have .shrink(0.0).
Also as in CSS, a flex item doesn’t shrink below its content’s width:
a horizontal scroll view in a column that grows in a row needs
.min_width(0) on that column, or both are as wide as the content, and
there’s nothing to scroll.
Implementations§
Source§impl ScrollView
impl ScrollView
Sourcepub fn new() -> ScrollView
pub fn new() -> ScrollView
Scrolls vertically.
pub fn horizontal() -> ScrollView
pub fn both() -> ScrollView
Sourcepub fn axes(self, axes: ScrollAxes) -> ScrollView
pub fn axes(self, axes: ScrollAxes) -> ScrollView
The axes it scrolls along. In view!, where there’s no constructor
to pick them: <ScrollView axes=ScrollAxes::Horizontal>.
pub fn children(self, children: impl Children) -> ScrollView
pub fn child(self, child: impl View) -> ScrollView
Sourcepub fn scroll_bars(self, show: impl IntoValue<bool>) -> ScrollView
pub fn scroll_bars(self, show: impl IntoValue<bool>) -> ScrollView
Whether it shows scroll bars, on by default. They’re the platform’s, shown as it shows them (overlay bars, say, as the user set on macOS). Without, it still scrolls by wheel, trackpad and touch, as a strip of photos or a carousel does.
Sourcepub fn native(self, tweak: Tweak<ScrollView>) -> ScrollView
pub fn native(self, tweak: Tweak<ScrollView>) -> ScrollView
Raw platform settings, past the semantic ones: see Tweak. What
the platforms offer (elasticity and a border on AppKit, classic
scroll bars on GTK, overshoot on Qt, always-expanded scroll bars and
zoom on WinUI) is each one’s own.
Sourcepub fn on_scroll(self, handler: impl Fn(Point) + 'static) -> ScrollView
pub fn on_scroll(self, handler: impl Fn(Point) + 'static) -> ScrollView
Called with the new offset whenever the content scrolls.
Trait Implementations§
Source§impl Default for ScrollView
impl Default for ScrollView
Source§fn default() -> ScrollView
fn default() -> ScrollView
Source§impl ElementBuilder for ScrollView
impl ElementBuilder for ScrollView
fn element(&mut self) -> &mut Element
Source§fn style(self, f: impl FnOnce(&mut Style)) -> Self
fn style(self, f: impl FnOnce(&mut Style)) -> Self
Source§fn style_with(self, f: impl Fn(&mut Style) + 'static) -> Self
fn style_with(self, f: impl Fn(&mut Style) + 'static) -> Self
f re-runs whenever the
signals it reads change, and must set every field it cares about.fn width(self, value: impl IntoValue<Length>) -> Self
fn height(self, value: impl IntoValue<Length>) -> Self
fn min_width(self, value: impl IntoValue<Length>) -> Self
fn min_height(self, value: impl IntoValue<Length>) -> Self
fn max_width(self, value: impl IntoValue<Length>) -> Self
fn max_height(self, value: impl IntoValue<Length>) -> Self
fn aspect_ratio(self, value: impl IntoValue<f32>) -> Self
fn padding(self, value: impl IntoValue<Length>) -> Self
fn padding_x(self, value: impl IntoValue<Length>) -> Self
fn padding_y(self, value: impl IntoValue<Length>) -> Self
fn padding_start(self, value: impl IntoValue<Length>) -> Self
fn padding_end(self, value: impl IntoValue<Length>) -> Self
fn padding_top(self, value: impl IntoValue<Length>) -> Self
fn padding_bottom(self, value: impl IntoValue<Length>) -> Self
fn margin(self, value: impl IntoValue<Length>) -> Self
fn margin_x(self, value: impl IntoValue<Length>) -> Self
fn margin_y(self, value: impl IntoValue<Length>) -> Self
fn margin_start(self, value: impl IntoValue<Length>) -> Self
fn margin_end(self, value: impl IntoValue<Length>) -> Self
fn margin_top(self, value: impl IntoValue<Length>) -> Self
fn margin_bottom(self, value: impl IntoValue<Length>) -> Self
fn grow(self, value: impl IntoValue<f32>) -> Self
fn shrink(self, value: impl IntoValue<f32>) -> Self
fn basis(self, value: impl IntoValue<Length>) -> Self
fn align_self(self, value: impl IntoValue<Align>) -> Self
Source§fn justify_self(self, value: impl IntoValue<Align>) -> Self
fn justify_self(self, value: impl IntoValue<Align>) -> Self
Source§fn top(self, value: impl IntoValue<Length>) -> Self
fn top(self, value: impl IntoValue<Length>) -> Self
absolute()).fn bottom(self, value: impl IntoValue<Length>) -> Self
Source§fn start(self, value: impl IntoValue<Length>) -> Self
fn start(self, value: impl IntoValue<Length>) -> Self
fn end(self, value: impl IntoValue<Length>) -> Self
fn grid_column(self, value: impl IntoValue<GridPlacement>) -> Self
fn grid_row(self, value: impl IntoValue<GridPlacement>) -> Self
fn direction(self, value: impl IntoValue<TextDirection>) -> Self
display the node had.fn size( self, width: impl IntoValue<Length>, height: impl IntoValue<Length>, ) -> Self
Source§fn tooltip(self, text: impl IntoValue<String>) -> Self
fn tooltip(self, text: impl IntoValue<String>) -> Self
entries, and built again whenever what it
reads changes, as Menu::children_with builds its entries.entries each time the platform opens it,
for a menu that depends on what’s selected or under the pointer at
that moment: a table row’s menu acting on the selection. What it
reads is read then, not followed.