Skip to main content

SelectionList

Struct SelectionList 

Source
pub struct SelectionList { /* private fields */ }
Expand description

Multi-selection list widget

Implementations§

Source§

impl SelectionList

Source

pub fn new<I, T>(items: I) -> Self
where I: IntoIterator<Item = T>, T: Into<SelectionItem>,

Create a new selection list

Source

pub fn selected(self, indices: Vec<usize>) -> Self

Set initial selection

Source

pub fn style(self, style: SelectionStyle) -> Self

Set selection style

Source

pub fn show_checkboxes(self, show: bool) -> Self

Show checkboxes (shorthand for style)

Source

pub fn max_selections(self, max: usize) -> Self

Set maximum selections

Source

pub fn min_selections(self, min: usize) -> Self

Set minimum selections

Source

pub fn show_descriptions(self, show: bool) -> Self

Show descriptions

Source

pub fn title(self, title: impl Into<String>) -> Self

Set title

Source

pub fn fg(self, color: Color) -> Self

Set foreground color

Source

pub fn selected_fg(self, color: Color) -> Self

Set selected item color

Source

pub fn highlighted_fg(self, color: Color) -> Self

Set highlighted item color

Source

pub fn bg(self, color: Color) -> Self

Set background color

Source

pub fn max_visible(self, max: usize) -> Self

Set maximum visible items

Source

pub fn show_count(self, show: bool) -> Self

Show selection count

Source

pub fn focused(self, focused: bool) -> Self

Set focused state

Source

pub fn get_selected(&self) -> &[usize]

Get selected indices

Source

pub fn get_selected_values(&self) -> Vec<&str>

Get selected values

Source

pub fn get_selected_items(&self) -> Vec<&SelectionItem>

Get selected items

Source

pub fn is_selected(&self, index: usize) -> bool

Check if index is selected

Source

pub fn toggle(&mut self, index: usize)

Toggle selection of an item

Source

pub fn toggle_highlighted(&mut self)

Toggle highlighted item

Source

pub fn select(&mut self, index: usize)

Select item

Source

pub fn deselect(&mut self, index: usize)

Deselect item

Source

pub fn select_all(&mut self)

Select all

Source

pub fn deselect_all(&mut self)

Deselect all

Source

pub fn highlight_previous(&mut self)

Move highlight up

Source

pub fn highlight_next(&mut self)

Move highlight down

Source

pub fn highlight_first(&mut self)

Move highlight to start

Source

pub fn highlight_last(&mut self)

Move highlight to end

Source§

impl SelectionList

Source

pub fn element_id(self, id: impl Into<String>) -> Self

Set element ID for CSS selector (#id)

Source

pub fn class(self, class: impl Into<String>) -> Self

Add a CSS class

Source

pub fn classes<I, S>(self, classes: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Add multiple CSS classes

Trait Implementations§

Source§

impl Clone for SelectionList

Source§

fn clone(&self) -> SelectionList

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SelectionList

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl StyledView for SelectionList

Source§

fn set_id(&mut self, id: impl Into<String>)

Set element ID
Source§

fn add_class(&mut self, class: impl Into<String>)

Add a CSS class
Source§

fn remove_class(&mut self, class: &str)

Remove a CSS class
Source§

fn toggle_class(&mut self, class: &str)

Toggle a CSS class
Source§

fn has_class(&self, class: &str) -> bool

Check if has class
Source§

impl View for SelectionList

Source§

fn render(&self, ctx: &mut RenderContext<'_>)

Render the view to the given context Read more
Source§

fn id(&self) -> Option<&str>

Get element ID (for CSS #id selectors) Read more
Source§

fn classes(&self) -> &[String]

Get CSS classes (for CSS .class selectors) Read more
Source§

fn meta(&self) -> WidgetMeta

Get widget metadata for DOM Read more
Source§

fn widget_type(&self) -> &'static str

Get widget type name (for CSS type selectors) Read more
Source§

fn children(&self) -> &[Box<dyn View>]

Get child views (for container widgets) Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.