pub struct ScrollView {
pub scroll_x: f32,
pub scroll_y: f32,
pub on_scroll: Option<Arc<dyn Fn(&mut EventContext<'_>, f32, f32) + Sync + Send>>,
pub inner_width: f32,
pub inner_height: f32,
pub container_width: f32,
pub container_height: f32,
pub scroll_to_cursor: bool,
pub show_horizontal_scrollbar: bool,
pub show_vertical_scrollbar: bool,
}
Expand description
A container a view which allows the user to scroll any overflowed content.
Fields§
§scroll_x: f32
Progress of scroll position between 0 and 1 for the x axis
scroll_y: f32
Progress of scroll position between 0 and 1 for the y axis
on_scroll: Option<Arc<dyn Fn(&mut EventContext<'_>, f32, f32) + Sync + Send>>
Callback called when the scrollview is scrolled.
inner_width: f32
Width of the inner VStack which holds the content (typically bigger than container_width)
inner_height: f32
Height of the inner VStack which holds the content (typically bigger than container_height)
container_width: f32
Width of the outer ScrollView
which wraps the inner (typically smaller than inner_width)
container_height: f32
Height of the outer ScrollView
which wraps the inner (typically smaller than inner_height)
scroll_to_cursor: bool
Whether the scrollbar should move to the cursor when pressed.
show_horizontal_scrollbar: bool
Whether the horizontal scrollbar should be visible.
show_vertical_scrollbar: bool
Whether the vertical scrollbar should be visible.
Implementations§
Source§impl ScrollView
impl ScrollView
Sourcepub fn new<F>(cx: &mut Context, content: F) -> Handle<'_, ScrollView>
pub fn new<F>(cx: &mut Context, content: F) -> Handle<'_, ScrollView>
Creates a new ScrollView.
Trait Implementations§
Source§impl Clone for ScrollView
impl Clone for ScrollView
Source§fn clone(&self) -> ScrollView
fn clone(&self) -> ScrollView
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Data for ScrollView
impl Data for ScrollView
Source§fn same(&self, other: &ScrollView) -> bool
fn same(&self, other: &ScrollView) -> bool
Source§impl View for ScrollView
impl View for ScrollView
Source§fn element(&self) -> Option<&'static str>
fn element(&self) -> Option<&'static str>
Source§fn event(&mut self, cx: &mut EventContext<'_>, event: &mut Event)
fn event(&mut self, cx: &mut EventContext<'_>, event: &mut Event)
Source§fn build<F>(self, cx: &mut Context, content: F) -> Handle<'_, Self>
fn build<F>(self, cx: &mut Context, content: F) -> Handle<'_, Self>
Source§fn draw(&self, cx: &mut DrawContext<'_>, canvas: &Canvas)
fn draw(&self, cx: &mut DrawContext<'_>, canvas: &Canvas)
Source§fn accessibility(&self, cx: &mut AccessContext<'_>, node: &mut AccessNode)
fn accessibility(&self, cx: &mut AccessContext<'_>, node: &mut AccessNode)
Auto Trait Implementations§
impl Freeze for ScrollView
impl !RefUnwindSafe for ScrollView
impl Send for ScrollView
impl Sync for ScrollView
impl Unpin for ScrollView
impl !UnwindSafe for ScrollView
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.