pub struct ComboBox { /* private fields */ }Expand description
A field showing one choice, with a drop-down list of the alternatives.
Implementations§
Source§impl ComboBox
impl ComboBox
Sourcepub fn new(bounds: Rect, id: u16) -> Self
pub fn new(bounds: Rect, id: u16) -> Self
Create an empty combo box registered under id.
The id identifies this control to the drop-down popup and must be unique among the combo boxes alive at the same time. Reusing a live id replaces the earlier registration, which leaves the earlier control unable to open its list.
Sourcepub fn with_items(bounds: Rect, id: u16, items: Vec<String>) -> Self
pub fn with_items(bounds: Rect, id: u16, items: Vec<String>) -> Self
Create a combo box already holding items, with the first selected.
Sourcepub fn id(&self) -> u16
pub fn id(&self) -> u16
Registration id, as passed to ComboBox::new.
Sourcepub fn state(&self) -> Rc<RefCell<ComboState>>
pub fn state(&self) -> Rc<RefCell<ComboState>>
Shared state, for callers that want to read the choice later without holding on to the control.
Sourcepub fn set_items(&mut self, items: Vec<String>)
pub fn set_items(&mut self, items: Vec<String>)
Replace the item list. Selects the first item when there was no previous choice, and clamps an existing choice to the new list.
Sourcepub fn item_count(&self) -> usize
pub fn item_count(&self) -> usize
Number of items in the list.
Sourcepub fn set_selected(&mut self, index: Option<usize>)
pub fn set_selected(&mut self, index: Option<usize>)
Set the current choice. Out-of-range indices are ignored, so a stale index never silently selects the wrong item.
Sourcepub fn selected_text(&self) -> Option<String>
pub fn selected_text(&self) -> Option<String>
Text of the current choice.
Sourcepub fn set_on_change(&mut self, command: CommandId)
pub fn set_on_change(&mut self, command: CommandId)
Command broadcast when the choice changes. Zero, the default, sends none.
Trait Implementations§
Source§impl View for ComboBox
impl View for ComboBox
Source§fn core(&self) -> &ViewCore
fn core(&self) -> &ViewCore
TView data members).fn core_mut(&mut self) -> &mut ViewCore
fn set_bounds(&mut self, bounds: Rect)
fn can_focus(&self) -> bool
Source§fn state(&self) -> StateFlags
fn state(&self) -> StateFlags
Source§fn set_state(&mut self, state: StateFlags)
fn set_state(&mut self, state: StateFlags)
fn draw(&mut self, terminal: &mut Terminal)
fn handle_event(&mut self, event: &mut Event)
Source§fn get_palette(&self) -> Option<Palette>
fn get_palette(&self) -> Option<Palette>
Source§fn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Source§fn bounds(&self) -> Rect
fn bounds(&self) -> Rect
origin and size). A child at (2, 3) stays at (2, 3)
however its owner moves.Source§fn extent(&self) -> Rect
fn extent(&self) -> Rect
(0, 0) to its size (Borland:
TView::getExtent). This is the rectangle draw writes into and the
space mouse positions arrive in.Source§fn set_focus(&mut self, focused: bool)
fn set_focus(&mut self, focused: bool)
Source§fn window_number(&self) -> Option<u8>
fn window_number(&self) -> Option<u8>
Source§fn is_focused(&self) -> bool
fn is_focused(&self) -> bool
Source§fn options(&self) -> Options
fn options(&self) -> Options
Source§fn set_options(&mut self, options: Options)
fn set_options(&mut self, options: Options)
Source§fn grow_mode(&self) -> GrowFlags
fn grow_mode(&self) -> GrowFlags
Source§fn set_grow_mode(&mut self, grow_mode: GrowFlags)
fn set_grow_mode(&mut self, grow_mode: GrowFlags)
Source§fn set_state_flag(&mut self, flag: StateFlags, enable: bool)
fn set_state_flag(&mut self, flag: StateFlags, enable: bool)
Source§fn get_state_flag(&self, flag: StateFlags) -> bool
fn get_state_flag(&self, flag: StateFlags) -> bool
Source§fn has_shadow(&self) -> bool
fn has_shadow(&self) -> bool
Source§fn shadow_bounds(&self) -> Rect
fn shadow_bounds(&self) -> Rect
Source§fn update_cursor(&self, _terminal: &mut Terminal)
fn update_cursor(&self, _terminal: &mut Terminal)
Source§fn zoom(&mut self, _max_bounds: Rect)
fn zoom(&mut self, _max_bounds: Rect)
Source§fn valid(&mut self, _command: CommandId) -> bool
fn valid(&mut self, _command: CommandId) -> bool
Source§fn idle(&mut self)
fn idle(&mut self)
TProgram::idle, which keeps running
during execView). Overlay widgets added with
Application::add_overlay_widget get this on every idle tick; the
default does nothing.Source§fn as_group(&self) -> Option<&dyn GroupLike>
fn as_group(&self) -> Option<&dyn GroupLike>
dynamic_cast<TGroup*>). Containers built on Group return Some;
leaf views keep the default None. Application::exec_view uses it
to read a modal view’s end state without knowing its concrete type.fn as_group_mut(&mut self) -> Option<&mut dyn GroupLike>
Source§fn dump_to_file(&self, terminal: &Terminal, path: &str) -> Result<()>
fn dump_to_file(&self, terminal: &Terminal, path: &str) -> Result<()>
Source§fn get_redraw_union(&self) -> Option<Rect>
fn get_redraw_union(&self) -> Option<Rect>
Source§fn clear_move_tracking(&mut self)
fn clear_move_tracking(&mut self)
Source§fn make_global(&self, local_x: i16, local_y: i16) -> (i16, i16)
fn make_global(&self, local_x: i16, local_y: i16) -> (i16, i16)
TView::makeGlobal, but one hop: there is no owner chain to
walk, and a group translates as it dispatches, so one hop is all a
view ever needs).Source§fn make_local(&self, owner_x: i16, owner_y: i16) -> (i16, i16)
fn make_local(&self, owner_x: i16, owner_y: i16) -> (i16, i16)
TView::makeLocal, one hop; see make_global).Source§fn draw_shadow(&self, terminal: &mut Terminal)
fn draw_shadow(&self, terminal: &mut Terminal)
Source§fn label_link(&self) -> Option<ViewId>
fn label_link(&self) -> Option<ViewId>
Source§fn init_after_add(&mut self)
fn init_after_add(&mut self)
Source§fn constrain_to_parent_bounds(&mut self)
fn constrain_to_parent_bounds(&mut self)
Source§fn set_palette_chain(&mut self, node: Option<PaletteChainNode>)
fn set_palette_chain(&mut self, node: Option<PaletteChainNode>)
Source§fn get_palette_chain(&self) -> Option<&PaletteChainNode>
fn get_palette_chain(&self) -> Option<&PaletteChainNode>
map_color() to safely walk the owner chain.Source§fn set_owner_extent(&mut self, _extent: Rect)
fn set_owner_extent(&mut self, _extent: Rect)
TFrame::dragWindow reads owner->owner->getExtent()).
Called by Desktop when adding windows.