pub struct ListWidget {
pub items: Vec<String>,
pub selected: Option<usize>,
pub filter: String,
pub multi_select: bool,
pub selected_items: HashSet<usize>,
pub scroll: usize,
}Expand description
List widget
Fields§
§items: Vec<String>List items
selected: Option<usize>Selected item index
filter: StringFilter text
multi_select: boolMulti-select enabled
selected_items: HashSet<usize>Selected items (for multi-select)
scroll: usizeScroll offset
Implementations§
Source§impl ListWidget
impl ListWidget
Sourcepub fn with_multi_select(self) -> Self
pub fn with_multi_select(self) -> Self
Enable multi-select mode
Sourcepub fn set_filter(&mut self, filter: impl Into<String>)
pub fn set_filter(&mut self, filter: impl Into<String>)
Set filter
Sourcepub fn clear_filter(&mut self)
pub fn clear_filter(&mut self)
Clear filter
Sourcepub fn filtered_items(&self) -> Vec<(usize, &String)>
pub fn filtered_items(&self) -> Vec<(usize, &String)>
Get filtered items
Sourcepub fn visible_items(&self, height: usize) -> Vec<(usize, &String)>
pub fn visible_items(&self, height: usize) -> Vec<(usize, &String)>
Get visible items based on scroll
Sourcepub fn select_next(&mut self)
pub fn select_next(&mut self)
Select next item
Sourcepub fn select_prev(&mut self)
pub fn select_prev(&mut self)
Select previous item
Sourcepub fn toggle_selection(&mut self)
pub fn toggle_selection(&mut self)
Toggle selection for current item (multi-select)
Sourcepub fn select_all(&mut self)
pub fn select_all(&mut self)
Select all items
Sourcepub fn deselect_all(&mut self)
pub fn deselect_all(&mut self)
Deselect all items
Sourcepub fn selected_item(&self) -> Option<&String>
pub fn selected_item(&self) -> Option<&String>
Get selected item
Sourcepub fn get_selected_items(&self) -> Vec<&String>
pub fn get_selected_items(&self) -> Vec<&String>
Get all selected items (multi-select)
Sourcepub fn item_count(&self) -> usize
pub fn item_count(&self) -> usize
Get total item count
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ListWidget
impl RefUnwindSafe for ListWidget
impl Send for ListWidget
impl Sync for ListWidget
impl Unpin for ListWidget
impl UnwindSafe for ListWidget
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> 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 more