pub struct ScrollViewState { /* private fields */ }Implementations§
Source§impl ScrollViewState
impl ScrollViewState
pub fn new() -> Self
pub fn with_offset(offset: Position) -> Self
pub const fn set_offset(&mut self, offset: Position)
pub const fn offset(&self) -> Position
pub const fn scroll_up(&mut self)
pub const fn scroll_down(&mut self)
pub fn scroll_page_down(&mut self)
pub fn scroll_page_up(&mut self)
pub const fn scroll_left(&mut self)
pub const fn scroll_right(&mut self)
pub const fn scroll_to_top(&mut self)
pub fn scroll_to_bottom(&mut self)
Sourcepub const fn size(&self) -> Option<Size>
pub const fn size(&self) -> Option<Size>
The content size (the full scrollable buffer). None before the first render.
Sourcepub const fn page_size(&self) -> Option<Size>
pub const fn page_size(&self) -> Option<Size>
The visible page size (viewport after scrollbars). None before the first render.
Sourcepub fn is_at_bottom(&self) -> bool
pub fn is_at_bottom(&self) -> bool
Whether the last content row is visible in the current page.
Returns true before the first render (size unknown). Ported from upstream
tui-scrollview; relies on page_size meaning the visible viewport.
Sourcepub fn scroll_to_visible(&mut self, y: u16, height: u16)
pub fn scroll_to_visible(&mut self, y: u16, height: u16)
Scroll the vertical offset the minimum amount so the row range
[y, y + height) is inside the visible page. No-op if already visible.
The render pass re-clamps against the content, so this only needs to move the offset toward the target.
Sourcepub fn child_area(&self, index: usize) -> Option<Rect>
pub fn child_area(&self, index: usize) -> Option<Rect>
The content-buffer area of the direct child at index (in child order),
as recorded by ScrollView on the last render. None before the first
render or when index is out of range.
Sourcepub fn scroll_to_index(&mut self, index: usize)
pub fn scroll_to_index(&mut self, index: usize)
Scroll so the direct child at index (in child order) is visible.
This is the “follow the selection” primitive: after a page moves its
selection over a list of ScrollView children, call this with the
selected index so the viewport tracks it. No-op if index is unknown
(e.g. before the first render). Child geometry is selection-independent,
so the last recorded layout is correct for the new selection.
Sourcepub fn handle_event(&mut self, event: &Event) -> bool
pub fn handle_event(&mut self, event: &Event) -> bool
Returns true if the event was a scroll input this state acted on.
Trait Implementations§
Source§impl Clone for ScrollViewState
impl Clone for ScrollViewState
Source§fn clone(&self) -> ScrollViewState
fn clone(&self) -> ScrollViewState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ScrollViewState
impl Debug for ScrollViewState
Source§impl Default for ScrollViewState
impl Default for ScrollViewState
Source§fn default() -> ScrollViewState
fn default() -> ScrollViewState
impl Eq for ScrollViewState
Source§impl Hash for ScrollViewState
impl Hash for ScrollViewState
Source§impl PartialEq for ScrollViewState
impl PartialEq for ScrollViewState
impl StructuralPartialEq for ScrollViewState
Auto Trait Implementations§
impl Freeze for ScrollViewState
impl RefUnwindSafe for ScrollViewState
impl Send for ScrollViewState
impl Sync for ScrollViewState
impl Unpin for ScrollViewState
impl UnsafeUnpin for ScrollViewState
impl UnwindSafe for ScrollViewState
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more