[][src]Struct druid::widget::Scroll

pub struct Scroll<T, W> { /* fields omitted */ }

A container that scrolls its contents.

This container holds a single child, and uses the wheel to scroll it when the child's bounds are larger than the viewport.

The child is laid out with completely unconstrained layout bounds by default. Restrict to a specific axis with vertical or horizontal. When restricted to scrolling on a specific axis the child's size is locked on the opposite axis.

Implementations

impl<T, W: Widget<T>> Scroll<T, W>[src]

pub fn new(child: W) -> Scroll<T, W>[src]

Create a new scroll container.

This method will allow scrolling in all directions if child's bounds are larger than the viewport. Use vertical and horizontal methods to limit scrolling to a specific axis.

pub fn vertical(self) -> Self[src]

Restrict scrolling to the vertical axis while locking child width.

pub fn horizontal(self) -> Self[src]

Restrict scrolling to the horizontal axis while locking child height.

pub fn child(&self) -> &W[src]

Returns a reference to the child widget.

pub fn child_mut(&mut self) -> &mut W[src]

Returns a mutable reference to the child widget.

pub fn child_size(&self) -> Size[src]

Returns the size of the child widget.

pub fn offset(&self) -> Vec2[src]

Returns the current scroll offset.

pub fn scroll_by(&mut self, delta: Vec2) -> bool[src]

Scroll delta units.

Returns true if the scroll offset has changed.

pub fn scroll_to(&mut self, region: Rect) -> bool[src]

Scroll the minimal distance to show the target rect.

If the target region is larger than the viewport, we will display the portion that fits, prioritizing the portion closest to the origin.

Trait Implementations

impl<T: Data, W: Widget<T>> Widget<T> for Scroll<T, W>[src]

Auto Trait Implementations

impl<T, W> !RefUnwindSafe for Scroll<T, W>[src]

impl<T, W> !Send for Scroll<T, W>[src]

impl<T, W> !Sync for Scroll<T, W>[src]

impl<T, W> Unpin for Scroll<T, W> where
    T: Unpin,
    W: Unpin
[src]

impl<T, W> !UnwindSafe for Scroll<T, W>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> RoundFrom<T> for T

impl<T, U> RoundInto<U> for T where
    U: RoundFrom<T>, 

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.