Struct native_windows_gui::ComboBox
[−]
[src]
pub struct ComboBox<D: Clone + Display> { /* fields omitted */ }
A combobox control
Methods
impl<D: Clone + Display> ComboBox<D>
[src]
fn len(&self) -> usize
Return the number of items in the inner collection
fn collection(&self) -> &Vec<D>
Return the inner collection of the combobox
fn collection_mut(&mut self) -> &mut Vec<D>
Return the inner collection of the combobox, mutable.
If the inner collection is changed, combobox.sync
must be called to show the changes in the combobox
fn sync(&self)
Reload the content of the combobox
fn push(&mut self, item: D)
Add an item at the end of the combobox. Updates both the inner collection and the ui.
fn remove(&mut self, index: usize) -> D
Remove an item from the inner collection and the combobox. Return the removed item.
Panics
if index is out of bounds.
fn insert(&mut self, index: usize, item: D)
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.
fn find_string<'a>(&self, text: &'a str, full_match: bool) -> Option<usize>
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.
fn get_selected_index(&self) -> Option<usize>
Return the index of currently selected item.
Return None if there is no selected item
fn get_selected_text(&self) -> String
Return the currently selected element text. Returns ""
if no item is selected.
fn set_selected_index(&self, index: usize)
Set the selected index in a combobox.
If index
is usize::max_value
, remove the selected index from the combobox
fn get_string(&self, index: usize) -> Option<String>
Return the item text at the provided index. Returns None if the index is not valid.
fn set_placeholder<'a>(&self, placeholder: &'a str)
Set a new placeholder for the combobox. To remove the current placeholder, send ""
The maximum length of the placeholder is 255 characters
fn get_dropped_state(&self) -> bool
Return true if the combobox dropdown is visible
fn set_dropped_state(&self, dropped: bool)
Show or hide the control dropdown
fn clear(&mut self)
Remove every item in the inner collection and in the combobox
fn get_visibility(&self) -> bool
fn set_visibility(&self, visible: bool)
fn get_position(&self) -> (i32, i32)
fn set_position(&self, x: i32, y: i32)
fn get_size(&self) -> (u32, u32)
fn set_size(&self, w: u32, h: u32)
fn get_enabled(&self) -> bool
fn set_enabled(&self, e: bool)
Trait Implementations
impl<D: Clone + Display> Control for ComboBox<D>
[src]
fn handle(&self) -> AnyHandle
Should return the underlying handle to the object
fn control_type(&self) -> ControlType
Should return the type of the control. For custom controls, the return value should be Undefined
(the default).
fn free(&mut self)
If specified, should free any ressource allocated in the template build
function. This includes functions like DestroyWindow
.