Struct iced_native::widget::scrollable::Scrollable
source · [−]pub struct Scrollable<'a, Message, Renderer> { /* private fields */ }
Expand description
A widget that can vertically display an infinite amount of content with a scrollbar.
Implementations
sourceimpl<'a, Message, Renderer: Renderer> Scrollable<'a, Message, Renderer>
impl<'a, Message, Renderer: Renderer> Scrollable<'a, Message, Renderer>
sourcepub fn new(state: &'a mut State) -> Self
pub fn new(state: &'a mut State) -> Self
Creates a new Scrollable
with the given State
.
sourcepub fn spacing(self, units: u16) -> Self
pub fn spacing(self, units: u16) -> Self
Sets the vertical spacing between elements.
Custom margins per element do not exist in Iced. You should use this method instead! While less flexible, it helps you keep spacing between elements consistent.
sourcepub fn width(self, width: Length) -> Self
pub fn width(self, width: Length) -> Self
Sets the width of the Scrollable
.
sourcepub fn height(self, height: Length) -> Self
pub fn height(self, height: Length) -> Self
Sets the height of the Scrollable
.
sourcepub fn max_width(self, max_width: u32) -> Self
pub fn max_width(self, max_width: u32) -> Self
Sets the maximum width of the Scrollable
.
sourcepub fn max_height(self, max_height: u32) -> Self
pub fn max_height(self, max_height: u32) -> Self
Sets the maximum height of the Scrollable
in pixels.
sourcepub fn align_items(self, align_items: Alignment) -> Self
pub fn align_items(self, align_items: Alignment) -> Self
Sets the horizontal alignment of the contents of the Scrollable
.
sourcepub fn scrollbar_width(self, scrollbar_width: u16) -> Self
pub fn scrollbar_width(self, scrollbar_width: u16) -> Self
Sets the scrollbar width of the Scrollable
.
Silently enforces a minimum value of 1.
sourcepub fn scrollbar_margin(self, scrollbar_margin: u16) -> Self
pub fn scrollbar_margin(self, scrollbar_margin: u16) -> Self
Sets the scrollbar margin of the Scrollable
.
sourcepub fn scroller_width(self, scroller_width: u16) -> Self
pub fn scroller_width(self, scroller_width: u16) -> Self
Sets the scroller width of the Scrollable
.
It silently enforces a minimum value of 1.
sourcepub fn on_scroll(self, f: impl Fn(f32) -> Message + 'static) -> Self
pub fn on_scroll(self, f: impl Fn(f32) -> Message + 'static) -> Self
Sets a function to call when the Scrollable
is scrolled.
The function takes the new relative offset of the Scrollable
(e.g. 0
means top, while 1
means bottom).
sourcepub fn style(self, style_sheet: impl Into<Box<dyn StyleSheet + 'a>>) -> Self
pub fn style(self, style_sheet: impl Into<Box<dyn StyleSheet + 'a>>) -> Self
Sets the style of the Scrollable
.
sourcepub fn push<E>(self, child: E) -> Self where
E: Into<Element<'a, Message, Renderer>>,
pub fn push<E>(self, child: E) -> Self where
E: Into<Element<'a, Message, Renderer>>,
Adds an element to the Scrollable
.
Trait Implementations
sourceimpl<'a, Message, Renderer> From<Scrollable<'a, Message, Renderer>> for Element<'a, Message, Renderer> where
Renderer: 'a + Renderer,
Message: 'a,
impl<'a, Message, Renderer> From<Scrollable<'a, Message, Renderer>> for Element<'a, Message, Renderer> where
Renderer: 'a + Renderer,
Message: 'a,
sourcefn from(
scrollable: Scrollable<'a, Message, Renderer>
) -> Element<'a, Message, Renderer>
fn from(
scrollable: Scrollable<'a, Message, Renderer>
) -> Element<'a, Message, Renderer>
Converts to this type from the input type.
sourceimpl<'a, Message, Renderer> Widget<Message, Renderer> for Scrollable<'a, Message, Renderer> where
Renderer: Renderer,
impl<'a, Message, Renderer> Widget<Message, Renderer> for Scrollable<'a, Message, Renderer> where
Renderer: Renderer,
sourcefn on_event(
&mut self,
event: Event,
layout: Layout<'_>,
cursor_position: Point,
renderer: &Renderer,
clipboard: &mut dyn Clipboard,
shell: &mut Shell<'_, Message>
) -> Status
fn on_event(
&mut self,
event: Event,
layout: Layout<'_>,
cursor_position: Point,
renderer: &Renderer,
clipboard: &mut dyn Clipboard,
shell: &mut Shell<'_, Message>
) -> Status
sourcefn mouse_interaction(
&self,
layout: Layout<'_>,
cursor_position: Point,
_viewport: &Rectangle,
renderer: &Renderer
) -> Interaction
fn mouse_interaction(
&self,
layout: Layout<'_>,
cursor_position: Point,
_viewport: &Rectangle,
renderer: &Renderer
) -> Interaction
Returns the current mouse::Interaction
of the Widget
. Read more
Auto Trait Implementations
impl<'a, Message, Renderer> !RefUnwindSafe for Scrollable<'a, Message, Renderer>
impl<'a, Message, Renderer> !Send for Scrollable<'a, Message, Renderer>
impl<'a, Message, Renderer> !Sync for Scrollable<'a, Message, Renderer>
impl<'a, Message, Renderer> Unpin for Scrollable<'a, Message, Renderer>
impl<'a, Message, Renderer> !UnwindSafe for Scrollable<'a, Message, Renderer>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more