Struct cursive::views::ScrollView
source · pub struct ScrollView<V> { /* private fields */ }
Expand description
Wraps a view in a scrollable area.
Implementations
sourceimpl<V> ScrollView<V>where
V: View,
impl<V> ScrollView<V>where
V: View,
sourcepub fn content_viewport(&self) -> Rect
pub fn content_viewport(&self) -> Rect
Returns the viewport in the inner content.
sourcepub fn set_scroll_strategy(&mut self, strategy: ScrollStrategy)
pub fn set_scroll_strategy(&mut self, strategy: ScrollStrategy)
Defines the way scrolling is adjusted on content or size change.
The scroll strategy defines how the scrolling position is adjusted when the size of the view or the content change.
It is reset to ScrollStrategy::KeepRow
whenever the user scrolls
manually.
sourcepub fn scroll_strategy(self, strategy: ScrollStrategy) -> Self
pub fn scroll_strategy(self, strategy: ScrollStrategy) -> Self
Defines the way scrolling is adjusted on content or size change.
Chainable variant.
sourcepub fn set_offset<S>(&mut self, offset: S)where
S: Into<Vec2>,
pub fn set_offset<S>(&mut self, offset: S)where
S: Into<Vec2>,
Sets the scroll offset to the given value
sourcepub fn set_scroll_y(&mut self, enabled: bool)
pub fn set_scroll_y(&mut self, enabled: bool)
Controls whether this view can scroll vertically.
Defaults to true
.
sourcepub fn set_scroll_x(&mut self, enabled: bool)
pub fn set_scroll_x(&mut self, enabled: bool)
Controls whether this view can scroll horizontally.
Defaults to false
.
sourcepub fn scroll_y(self, enabled: bool) -> Self
pub fn scroll_y(self, enabled: bool) -> Self
Controls whether this view can scroll vertically.
Defaults to true
.
Chainable variant.
sourcepub fn scroll_x(self, enabled: bool) -> Self
pub fn scroll_x(self, enabled: bool) -> Self
Controls whether this view can scroll horizontally.
Defaults to false
.
Chainable variant.
sourcepub fn scroll_to_top(&mut self)
pub fn scroll_to_top(&mut self)
Programmatically scroll to the top of the view.
sourcepub fn scroll_to_bottom(&mut self)
pub fn scroll_to_bottom(&mut self)
Programmatically scroll to the bottom of the view.
sourcepub fn scroll_to_left(&mut self)
pub fn scroll_to_left(&mut self)
Programmatically scroll to the leftmost side of the view.
sourcepub fn scroll_to_right(&mut self)
pub fn scroll_to_right(&mut self)
Programmatically scroll to the rightmost side of the view.
sourcepub fn into_inner(self) -> V
pub fn into_inner(self) -> V
Returns the wrapped view.
sourcepub fn get_inner_mut(&mut self) -> &mut V
pub fn get_inner_mut(&mut self) -> &mut V
Gets mutable access to the inner view.
Trait Implementations
sourceimpl<V> View for ScrollView<V>where
V: View,
impl<V> View for ScrollView<V>where
V: View,
sourcefn draw(&self, printer: &Printer<'_, '_>)
fn draw(&self, printer: &Printer<'_, '_>)
sourcefn on_event(&mut self, event: Event) -> EventResult
fn on_event(&mut self, event: Event) -> EventResult
sourcefn layout(&mut self, size: Vec2)
fn layout(&mut self, size: Vec2)
sourcefn needs_relayout(&self) -> bool
fn needs_relayout(&self) -> bool
true
if the view content changed since last layout phase. Read more