Struct ScrollView
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: f32Progress of scroll position between 0 and 1 for the x axis
scroll_y: f32Progress 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: f32Width of the inner VStack which holds the content (typically bigger than container_width)
inner_height: f32Height of the inner VStack which holds the content (typically bigger than container_height)
container_width: f32Width of the outer ScrollView which wraps the inner (typically smaller than inner_width)
container_height: f32Height of the outer ScrollView which wraps the inner (typically smaller than inner_height)
scroll_to_cursor: boolWhether the scrollbar should move to the cursor when pressed.
show_horizontal_scrollbar: boolWhether the horizontal scrollbar should be visible.
show_vertical_scrollbar: boolWhether the vertical scrollbar should be visible.
Implementations§
§impl ScrollView
impl ScrollView
pub 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§
§impl Clone for ScrollView
impl Clone for ScrollView
§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 more§impl Data for ScrollView
impl Data for ScrollView
§fn same(&self, other: &ScrollView) -> bool
fn same(&self, other: &ScrollView) -> bool
§impl View for ScrollView
impl View for ScrollView
§fn element(&self) -> Option<&'static str>
fn element(&self) -> Option<&'static str>
§fn event(&mut self, cx: &mut EventContext<'_>, event: &mut Event)
fn event(&mut self, cx: &mut EventContext<'_>, event: &mut Event)
§fn build<F>(self, cx: &mut Context, content: F) -> Handle<'_, Self>
fn build<F>(self, cx: &mut Context, content: F) -> Handle<'_, Self>
§fn draw(&self, cx: &mut DrawContext<'_>, canvas: &Canvas)
fn draw(&self, cx: &mut DrawContext<'_>, canvas: &Canvas)
§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.