pub struct Checkbox { /* private fields */ }checkbox only.Expand description
A Checkbox struct that encapsulates a listbox
for item selection and a set of picked (selected) indices.
It allows for multiple selections,
toggling the selection state of items,
and navigating through the items.
Implementations§
Source§impl Checkbox
impl Checkbox
Sourcepub fn from_displayable<E: Display, I: IntoIterator<Item = E>>(items: I) -> Self
pub fn from_displayable<E: Display, I: IntoIterator<Item = E>>(items: I) -> Self
Creates a new Checkbox from a vector of fmt::Display.
Sourcepub fn from_styled_graphemes(items: Vec<StyledGraphemes>) -> Self
pub fn from_styled_graphemes(items: Vec<StyledGraphemes>) -> Self
Creates a new Checkbox from a vector of StyledGraphemes.
Sourcepub fn new_with_checked<T: Display, I: IntoIterator<Item = (T, bool)>>(
iter: I,
) -> Self
pub fn new_with_checked<T: Display, I: IntoIterator<Item = (T, bool)>>( iter: I, ) -> Self
Creates a Checkbox from an iterator of tuples where the first element
implements the Display trait and the second element is a bool indicating
if the item is picked (selected).
Each item is added to the listbox, and the set of picked indices is
initialized based on the bool values.
Sourcepub fn items(&self) -> &Vec<StyledGraphemes>
pub fn items(&self) -> &Vec<StyledGraphemes>
Returns a reference to the vector of items in the listbox.
Sourcepub fn picked_indexes(&self) -> &HashSet<usize>
pub fn picked_indexes(&self) -> &HashSet<usize>
Returns a reference to the set of picked (selected) indices.
Sourcepub fn get(&self) -> Vec<StyledGraphemes>
pub fn get(&self) -> Vec<StyledGraphemes>
Retrieves the items at the picked (selected) indices as a vector of strings.
Sourcepub fn toggle(&mut self)
pub fn toggle(&mut self)
Toggles the selection state of the item at the current cursor position within the listbox.
Sourcepub fn backward(&mut self) -> bool
pub fn backward(&mut self) -> bool
Moves the cursor backward in the listbox, if possible.
Returns true if the cursor was successfully moved backward, false otherwise.
Sourcepub fn forward(&mut self) -> bool
pub fn forward(&mut self) -> bool
Moves the cursor forward in the listbox, if possible.
Returns true if the cursor was successfully moved forward, false otherwise.
Sourcepub fn move_to_head(&mut self)
pub fn move_to_head(&mut self)
Moves the cursor to the head (beginning) of the listbox.
Sourcepub fn move_to_tail(&mut self)
pub fn move_to_tail(&mut self)
Moves the cursor to the tail of the listbox.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Checkbox
impl RefUnwindSafe for Checkbox
impl Send for Checkbox
impl Sync for Checkbox
impl Unpin for Checkbox
impl UnsafeUnpin for Checkbox
impl UnwindSafe for Checkbox
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<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