pub struct ScrollState { /* private fields */ }Expand description
Scroll state for navigating large datasets
Manages scroll position with bounds checking and page navigation.
Implementations§
Source§impl ScrollState
impl ScrollState
Sourcepub fn new(total_rows: usize, visible_rows: usize) -> Self
pub fn new(total_rows: usize, visible_rows: usize) -> Self
Create a new scroll state
§Arguments
total_rows- Total number of rows in the datasetvisible_rows- Number of rows visible in the viewport
Sourcepub fn set_offset(&mut self, offset: usize)
pub fn set_offset(&mut self, offset: usize)
Set scroll offset with bounds clamping
Sourcepub fn total_rows(&self) -> usize
pub fn total_rows(&self) -> usize
Get total row count
Sourcepub fn set_total_rows(&mut self, total: usize)
pub fn set_total_rows(&mut self, total: usize)
Update total row count
Sourcepub fn visible_rows(&self) -> usize
pub fn visible_rows(&self) -> usize
Get visible row count
Sourcepub fn set_visible_rows(&mut self, visible: usize)
pub fn set_visible_rows(&mut self, visible: usize)
Update visible row count
Sourcepub fn set_selected(&mut self, row: Option<usize>)
pub fn set_selected(&mut self, row: Option<usize>)
Set selected row with bounds checking
Sourcepub fn select_next(&mut self)
pub fn select_next(&mut self)
Select the next row
Sourcepub fn select_prev(&mut self)
pub fn select_prev(&mut self)
Select the previous row
Sourcepub fn scroll_down(&mut self)
pub fn scroll_down(&mut self)
Scroll down by one row
Sourcepub fn ensure_visible(&mut self, row: usize)
pub fn ensure_visible(&mut self, row: usize)
Ensure a specific row is visible
Sourcepub fn needs_scrollbar(&self) -> bool
pub fn needs_scrollbar(&self) -> bool
Check if scrolling is needed (content exceeds viewport)
Sourcepub fn scrollbar_position(&self) -> f32
pub fn scrollbar_position(&self) -> f32
Calculate scrollbar position (0.0 to 1.0)
Sourcepub fn scrollbar_size(&self) -> f32
pub fn scrollbar_size(&self) -> f32
Calculate scrollbar size (0.0 to 1.0)
Sourcepub fn is_visible(&self, row: usize) -> bool
pub fn is_visible(&self, row: usize) -> bool
Check if a row index is currently visible
Sourcepub fn to_viewport_row(&self, global_row: usize) -> Option<usize>
pub fn to_viewport_row(&self, global_row: usize) -> Option<usize>
Convert a global row index to viewport-relative row
Sourcepub fn to_global_row(&self, viewport_row: usize) -> usize
pub fn to_global_row(&self, viewport_row: usize) -> usize
Convert a viewport-relative row to global row index
Trait Implementations§
Source§impl Clone for ScrollState
impl Clone for ScrollState
Source§fn clone(&self) -> ScrollState
fn clone(&self) -> ScrollState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ScrollState
impl Debug for ScrollState
Source§impl Default for ScrollState
impl Default for ScrollState
Source§fn default() -> ScrollState
fn default() -> ScrollState
Returns the “default value” for a type. Read more
impl Copy for ScrollState
Auto Trait Implementations§
impl Freeze for ScrollState
impl RefUnwindSafe for ScrollState
impl Send for ScrollState
impl Sync for ScrollState
impl Unpin for ScrollState
impl UnsafeUnpin for ScrollState
impl UnwindSafe for ScrollState
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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 moreCreates a shared type from an unshared type.