Skip to main content

ScrollView

Struct ScrollView 

Source
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).

Implementations§

Source§

impl ScrollView

Source

pub fn new() -> ScrollView

Scrolls vertically.

Source

pub fn horizontal() -> ScrollView

Source

pub fn both() -> ScrollView

Source

pub fn children(self, children: impl Children) -> ScrollView

Source

pub fn child(self, child: impl View) -> ScrollView

Source

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

Source§

fn default() -> ScrollView

Returns the “default value” for a type. Read more
Source§

impl ElementBuilder for ScrollView

Source§

fn element(&mut self) -> &mut Element

Source§

fn style(self, f: impl FnOnce(&mut Style)) -> Self

Escape hatch: edit the style directly (static).
Source§

fn style_with(self, f: impl Fn(&mut Style) + 'static) -> Self

Escape hatch: edit the style reactively. f re-runs whenever the signals it reads change, and must set every field it cares about.
Source§

fn width(self, value: impl IntoValue<Length>) -> Self

Source§

fn height(self, value: impl IntoValue<Length>) -> Self

Source§

fn min_width(self, value: impl IntoValue<Length>) -> Self

Source§

fn min_height(self, value: impl IntoValue<Length>) -> Self

Source§

fn max_width(self, value: impl IntoValue<Length>) -> Self

Source§

fn max_height(self, value: impl IntoValue<Length>) -> Self

Source§

fn aspect_ratio(self, value: impl IntoValue<f32>) -> Self

Source§

fn padding(self, value: impl IntoValue<Length>) -> Self

Source§

fn padding_x(self, value: impl IntoValue<Length>) -> Self

Source§

fn padding_y(self, value: impl IntoValue<Length>) -> Self

Source§

fn padding_start(self, value: impl IntoValue<Length>) -> Self

Source§

fn padding_end(self, value: impl IntoValue<Length>) -> Self

Source§

fn padding_top(self, value: impl IntoValue<Length>) -> Self

Source§

fn padding_bottom(self, value: impl IntoValue<Length>) -> Self

Source§

fn margin(self, value: impl IntoValue<Length>) -> Self

Source§

fn margin_x(self, value: impl IntoValue<Length>) -> Self

Source§

fn margin_y(self, value: impl IntoValue<Length>) -> Self

Source§

fn margin_start(self, value: impl IntoValue<Length>) -> Self

Source§

fn margin_end(self, value: impl IntoValue<Length>) -> Self

Source§

fn margin_top(self, value: impl IntoValue<Length>) -> Self

Source§

fn margin_bottom(self, value: impl IntoValue<Length>) -> Self

Source§

fn grow(self, value: impl IntoValue<f32>) -> Self

Source§

fn shrink(self, value: impl IntoValue<f32>) -> Self

Source§

fn basis(self, value: impl IntoValue<Length>) -> Self

Source§

fn align_self(self, value: impl IntoValue<Align>) -> Self

Source§

fn justify_self(self, value: impl IntoValue<Align>) -> Self

Alignment inside a grid cell along the inline axis.
Source§

fn top(self, value: impl IntoValue<Length>) -> Self

Inset from the top of the containing block (with absolute()).
Source§

fn bottom(self, value: impl IntoValue<Length>) -> Self

Source§

fn start(self, value: impl IntoValue<Length>) -> Self

Inset from the inline start (left in LTR, right in RTL).
Source§

fn end(self, value: impl IntoValue<Length>) -> Self

Source§

fn grid_column(self, value: impl IntoValue<GridPlacement>) -> Self

Source§

fn grid_row(self, value: impl IntoValue<GridPlacement>) -> Self

Source§

fn direction(self, value: impl IntoValue<TextDirection>) -> Self

Source§

fn hidden(self, value: impl IntoValue<bool>) -> Self

Not laid out, not visible, not focusable, not in the a11y tree. Un-hiding restores whatever display the node had.
Source§

fn size( self, width: impl IntoValue<Length>, height: impl IntoValue<Length>, ) -> Self

Source§

fn absolute(self) -> Self

Takes the node out of flow; position it with top/start/….
Source§

fn a11y_label(self, label: impl Into<String>) -> Self

Source§

fn a11y_description(self, description: impl Into<String>) -> Self

Source§

fn a11y_role(self, role: Role) -> Self

Source§

fn a11y_hidden(self) -> Self

Source§

fn on_focus(self, handler: impl Fn() + 'static) -> Self

Called when this control gains keyboard focus.
Source§

fn on_blur(self, handler: impl Fn() + 'static) -> Self

Called when this control loses keyboard focus.
Source§

fn tab_index(self, index: u32) -> Self

Moves this control ahead in the Tab order. Controls with a tab index come first (lowest first); the rest follow in reading order. Prefer arranging the tree in the order users should visit it.
Source§

fn test_id(self, id: impl Into<String>) -> Self

Last-resort handle for tests; prefer finding nodes by role and name.
Source§

impl View for ScrollView

Source§

fn build(self, ui: &Ui) -> NodeId

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<V> Children for V
where V: View,

Source§

fn into_views(self, out: &mut Vec<AnyView>)

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.