pub struct List {
pub direction: ListDirection,
pub selection_mode: SelectionMode,
pub item_height: Option<f32>,
pub gap: f32,
pub scroll_offset: f32,
/* private fields */
}Expand description
Virtualized list widget.
Fields§
§direction: ListDirectionScroll direction
selection_mode: SelectionModeSelection mode
item_height: Option<f32>Fixed item height (if None, items have variable height)
gap: f32Gap between items
scroll_offset: f32Current scroll offset
Implementations§
Source§impl List
impl List
Sourcepub const fn direction(self, direction: ListDirection) -> Self
pub const fn direction(self, direction: ListDirection) -> Self
Set the scroll direction.
Sourcepub const fn selection_mode(self, mode: SelectionMode) -> Self
pub const fn selection_mode(self, mode: SelectionMode) -> Self
Set the selection mode.
Sourcepub const fn item_height(self, height: f32) -> Self
pub const fn item_height(self, height: f32) -> Self
Set fixed item height.
Sourcepub fn items(self, items: impl IntoIterator<Item = ListItem>) -> Self
pub fn items(self, items: impl IntoIterator<Item = ListItem>) -> Self
Add items to the list.
Sourcepub fn render_with<F>(self, f: F) -> Self
pub fn render_with<F>(self, f: F) -> Self
Set the render callback for items.
Sourcepub fn with_test_id(self, id: impl Into<String>) -> Self
pub fn with_test_id(self, id: impl Into<String>) -> Self
Set the test ID.
Sourcepub fn item_count(&self) -> usize
pub fn item_count(&self) -> usize
Get total item count.
Sourcepub fn selected_indices(&self) -> &[usize]
pub fn selected_indices(&self) -> &[usize]
Get selected indices.
Sourcepub fn visible_range(&self) -> Range<usize>
pub fn visible_range(&self) -> Range<usize>
Get visible range.
Sourcepub const fn content_size(&self) -> f32
pub const fn content_size(&self) -> f32
Get total content size.
Sourcepub fn scroll_into_view(&mut self, index: usize)
pub fn scroll_into_view(&mut self, index: usize)
Scroll to ensure an item is visible.
Sourcepub fn toggle_selection(&mut self, index: usize)
pub fn toggle_selection(&mut self, index: usize)
Toggle item selection.
Sourcepub fn clear_selection(&mut self)
pub fn clear_selection(&mut self)
Clear all selections.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for List
impl<'de> Deserialize<'de> for List
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Widget for List
impl Widget for List
Source§fn measure(&self, constraints: Constraints) -> Size
fn measure(&self, constraints: Constraints) -> Size
Compute intrinsic size constraints. Read more
Source§fn layout(&mut self, bounds: Rect) -> LayoutResult
fn layout(&mut self, bounds: Rect) -> LayoutResult
Position children within allocated bounds. Read more
Source§fn event(&mut self, event: &Event) -> Option<Box<dyn Any + Send>>
fn event(&mut self, event: &Event) -> Option<Box<dyn Any + Send>>
Handle input events. Read more
Source§fn children_mut(&mut self) -> &mut [Box<dyn Widget>]
fn children_mut(&mut self) -> &mut [Box<dyn Widget>]
Get mutable child widgets.
Source§fn is_focusable(&self) -> bool
fn is_focusable(&self) -> bool
Check if this widget can receive keyboard focus.
Source§fn is_interactive(&self) -> bool
fn is_interactive(&self) -> bool
Check if this widget is interactive (can receive focus/events).
Source§fn accessible_name(&self) -> Option<&str>
fn accessible_name(&self) -> Option<&str>
Get the accessible name for screen readers.
Source§fn accessible_role(&self) -> AccessibleRole
fn accessible_role(&self) -> AccessibleRole
Get the accessible role.
Auto Trait Implementations§
impl Freeze for List
impl !RefUnwindSafe for List
impl Send for List
impl Sync for List
impl Unpin for List
impl !UnwindSafe for List
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