[−][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 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]
pub fn event(
&mut self,
ctx: &mut EventCtx<'_, '_>,
event: &Event,
data: &mut T,
env: &Env
)
[src]
&mut self,
ctx: &mut EventCtx<'_, '_>,
event: &Event,
data: &mut T,
env: &Env
)
pub 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
)
pub fn update(
&mut self,
ctx: &mut UpdateCtx<'_, '_>,
old_data: &T,
data: &T,
env: &Env
)
[src]
&mut self,
ctx: &mut UpdateCtx<'_, '_>,
old_data: &T,
data: &T,
env: &Env
)
pub 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
pub fn paint(&mut self, ctx: &mut PaintCtx<'_, '_, '_>, data: &T, env: &Env)
[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]
T: Unpin,
W: Unpin,
impl<T, W> !UnwindSafe for Scroll<T, W>
[src]
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,
pub 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
pub fn round_from(x: T) -> T
impl<T, U> RoundInto<U> for T where
U: RoundFrom<T>,
U: RoundFrom<T>,
pub fn round_into(self) -> U
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]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub 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>,