[][src]Struct native_windows_gui::ListBox

pub struct ListBox<D: Clone + Display> { /* fields omitted */ }

A listbox control

Methods

impl<D: Clone + Display> ListBox<D>[src]

pub fn len(&self) -> usize[src]

Return the number of items in the inner collection

pub fn collection(&self) -> &Vec<D>[src]

Return the inner collection of the listbox

pub fn collection_mut(&mut self) -> &mut Vec<D>[src]

Return the inner collection of the listbox, mutable. If the inner listbox is changed, listbox.sync must be called to show the changes in the listbox

pub fn sync(&self)[src]

Reload the content of the listbox

pub fn push(&mut self, item: D)[src]

Add an item at the end of the listbox. Updates both the inner collection and the ui.

pub fn remove(&mut self, index: usize) -> D[src]

Remove an item from the inner collection and the listbox. Return the removed item.
Panics if index is out of bounds.

pub fn insert(&mut self, index: usize, item: D)[src]

Insert an item at the selected position in the lisbox and the inner collection.
If index is -1, the item is added at the end of the list.

pub fn get_selected_index(&self) -> Option<usize>[src]

Return the index of currently selected item.
Return None if there is no selected item If the listbox can have more than one selected item, use get_selected_indexes

pub fn get_selected_indexes(&self) -> Vec<usize>[src]

Return a vector filled with the selected indexes of the listbox. If nothing is selected or the listbox do not support multiple selection, the returned vector will be empty.

pub fn index_selected(&self, index: usize) -> bool[src]

Return true if index is currently selected in the listbox

pub fn set_selected_index(&self, index: usize)[src]

Set the selected index in a single choice listbox.
For multi-select listbox use set_index_selected or set_range_selected
If index is usize::max_value, remove the selected index from the listbox

pub fn set_index_selected(&self, index: usize, selected: bool)[src]

Set the selected state of the item located at index. Only work for multi-select listbox For single listbox, use set_selected_index If index is usize::max_value, the change is applied to every item.

pub fn set_range_selected(
    &self,
    index_min: usize,
    index_max: usize,
    selected: bool
)
[src]

Select or unselect a range of index in the list box. The range is inclusive. Only work if the listbox can have multiple items selected.
For single listbox, use set_selected_index

pub fn len_selected(&self) -> usize[src]

Return the number of selected items.

pub fn clear(&mut self)[src]

Remove every item in the inner collection and in the listbox

pub fn find_string<'a>(&self, text: &'a str, full_match: bool) -> Option<usize>[src]

Try to find an item with the text text in the collection. If one is found, return its index else, returns None.
If full_match is true, the text must match exactly otherwise it only needs to match the beginning. The search is NOT case sensitive.

pub fn get_string(&self, index: usize) -> Option<String>[src]

Return the item text at the provided index. Returns None if the index is not valid.

pub fn get_readonly(&self) -> bool[src]

Return true if the listbox is currently in a readonly mode, false otherwise.

pub fn set_readonly(&self, readonly: bool)[src]

Set or unset the listbox readonly flag

pub fn get_multi_select(&self) -> bool[src]

Return true if the listbox accepts multiple selected items, false otherwise.

pub fn set_multi_select(&self, multi: bool)[src]

Set or unset the listbox multiple selected flag

pub fn get_visibility(&self) -> bool[src]

pub fn set_visibility(&self, visible: bool)[src]

pub fn get_position(&self) -> (i32, i32)[src]

pub fn set_position(&self, x: i32, y: i32)[src]

pub fn get_size(&self) -> (u32, u32)[src]

pub fn set_size(&self, w: u32, h: u32)[src]

pub fn get_enabled(&self) -> bool[src]

pub fn set_enabled(&self, e: bool)[src]

Trait Implementations

impl<D: Clone + Display> Control for ListBox<D>[src]

Auto Trait Implementations

impl<D> !Send for ListBox<D>

impl<D> !Sync for ListBox<D>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]