[−][src]Struct druid::widget::Scroll
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.
Methods
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 scroll behavior.
pub fn vertical(self) -> Self
[src]
Limit scroll behavior to allow only vertical scrolling (Y-axis). The child is laid out with constrained width and infinite height.
pub fn horizontal(self) -> Self
[src]
Limit scroll behavior to allow only horizontal scrolling (X-axis). The child is laid out with constrained height and infinite width.
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 scroll(&mut self, delta: Vec2, size: Size) -> bool
[src]
Update the scroll.
Returns true
if the scroll has been updated.
pub fn reset_scrollbar_fade(&mut self, ctx: &mut EventCtx, env: &Env)
[src]
Makes the scrollbars visible, and resets the fade timer.
pub fn offset(&self) -> Vec2
[src]
Returns the current scroll offset.
Trait Implementations
impl<T: Data, W: Widget<T>> Widget<T> for Scroll<T, W>
[src]
fn event(&mut self, ctx: &mut EventCtx, event: &Event, data: &mut T, env: &Env)
[src]
fn lifecycle(
&mut self,
ctx: &mut LifeCycleCtx,
event: &LifeCycle,
data: &T,
env: &Env
)
[src]
&mut self,
ctx: &mut LifeCycleCtx,
event: &LifeCycle,
data: &T,
env: &Env
)
fn update(&mut self, ctx: &mut UpdateCtx, _old_data: &T, data: &T, env: &Env)
[src]
fn layout(
&mut self,
ctx: &mut LayoutCtx,
bc: &BoxConstraints,
data: &T,
env: &Env
) -> Size
[src]
&mut self,
ctx: &mut LayoutCtx,
bc: &BoxConstraints,
data: &T,
env: &Env
) -> Size
fn paint(&mut self, ctx: &mut PaintCtx, data: &T, env: &Env)
[src]
Auto Trait Implementations
impl<T, W> !RefUnwindSafe for Scroll<T, W>
impl<T, W> !Send for Scroll<T, W>
impl<T, W> !Sync for Scroll<T, W>
impl<T, W> Unpin for Scroll<T, W> where
T: Unpin,
W: Unpin,
T: Unpin,
W: Unpin,
impl<T, W> !UnwindSafe for Scroll<T, W>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> RoundFrom<T> for T
fn round_from(x: T) -> T
impl<T, U> RoundInto<U> for T where
U: RoundFrom<T>,
U: RoundFrom<T>,
fn round_into(self) -> U
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,