pub struct VirtualizedListState {
pub selected: Option<usize>,
/* private fields */
}Expand description
State for the VirtualizedList widget.
Fields§
§selected: Option<usize>Currently selected index.
Implementations§
Source§impl VirtualizedListState
impl VirtualizedListState
Sourcepub fn with_overscan(self, overscan: usize) -> Self
pub fn with_overscan(self, overscan: usize) -> Self
Create with overscan.
Sourcepub fn with_follow(self, follow: bool) -> Self
pub fn with_follow(self, follow: bool) -> Self
Create with follow mode enabled.
Sourcepub fn with_persistence_id(self, id: impl Into<String>) -> Self
pub fn with_persistence_id(self, id: impl Into<String>) -> Self
Create with a persistence ID for state saving.
Sourcepub fn persistence_id(&self) -> Option<&str>
pub fn persistence_id(&self) -> Option<&str>
Get the persistence ID, if set.
Sourcepub fn scroll_offset(&self) -> usize
pub fn scroll_offset(&self) -> usize
Get raw scroll offset.
Warning: After scroll_to_bottom, this may return usize::MAX
(a lazy sentinel that gets clamped during rendering). Use
[scroll_offset_clamped] with a known total_items to get a
safe value for display or indexing.
Sourcepub fn scroll_offset_clamped(&self, total_items: usize) -> usize
pub fn scroll_offset_clamped(&self, total_items: usize) -> usize
Get scroll offset clamped against a known total item count.
Prefer this over [scroll_offset()] when the total is available,
because scroll_to_bottom may store usize::MAX internally.
Sourcepub fn visible_count(&self) -> usize
pub fn visible_count(&self) -> usize
Get visible item count (from last render).
Sourcepub fn scroll_to_top(&mut self)
pub fn scroll_to_top(&mut self)
Scroll to top.
Sourcepub fn scroll_to_bottom(&mut self, total_items: usize)
pub fn scroll_to_bottom(&mut self, total_items: usize)
Scroll to bottom.
Sourcepub fn select_previous(&mut self, total_items: usize)
pub fn select_previous(&mut self, total_items: usize)
Select previous item.
Sourcepub fn select_next(&mut self, total_items: usize)
pub fn select_next(&mut self, total_items: usize)
Select next item.
Sourcepub fn is_at_bottom(&self, total_items: usize) -> bool
pub fn is_at_bottom(&self, total_items: usize) -> bool
Check if at bottom.
Sourcepub fn set_follow(&mut self, follow: bool, total_items: usize)
pub fn set_follow(&mut self, follow: bool, total_items: usize)
Enable/disable follow mode.
Sourcepub fn follow_mode(&self) -> bool
pub fn follow_mode(&self) -> bool
Check if follow mode is enabled.
Sourcepub fn handle_mouse(
&mut self,
event: &MouseEvent,
hit: Option<(HitId, HitRegion, u64)>,
scrollbar_hit_id: HitId,
total_items: usize,
viewport_height: u16,
fixed_item_height: u16,
) -> MouseResult
pub fn handle_mouse( &mut self, event: &MouseEvent, hit: Option<(HitId, HitRegion, u64)>, scrollbar_hit_id: HitId, total_items: usize, viewport_height: u16, fixed_item_height: u16, ) -> MouseResult
Handle mouse events, including scrollbar interaction.
The caller must provide the hit test result and the expected hit ID for the scrollbar.
Trait Implementations§
Source§impl Clone for VirtualizedListState
impl Clone for VirtualizedListState
Source§fn clone(&self) -> VirtualizedListState
fn clone(&self) -> VirtualizedListState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more