pub type NcSelector = ncselector;Expand description
High-level widget for selecting one item from a set.
Aliased Type§
pub struct NcSelector { /* private fields */ }Implementations§
Source§impl NcSelector
impl NcSelector
Sourcepub fn new<'a>(
plane: &mut NcPlane,
options: &NcSelectorOptions,
) -> NcResult<&'a mut Self>
pub fn new<'a>( plane: &mut NcPlane, options: &NcSelectorOptions, ) -> NcResult<&'a mut Self>
Creates a selector over a plane.
The selector will take care of destroying the plane.
Sourcepub fn builder() -> NcSelectorBuilder
pub fn builder() -> NcSelectorBuilder
Starts the builder.
Sourcepub fn offer_input(&mut self, input: impl Into<NcInput>) -> bool
pub fn offer_input(&mut self, input: impl Into<NcInput>) -> bool
Offers an input to the selector.
If it’s relevant, this function returns true, and the input ought not be processed further. If it’s irrelevant to the selector, false is returned.
Relevant inputs include:
- a mouse click on an item.
- a mouse scrollwheel event.
- a mouse click on the scrolling arrows.
- up, down, pgup, or pgdown on an unrolled menu (navigates among items).
Sourcepub fn destroy(&mut self) -> NcResult<()>
pub fn destroy(&mut self) -> NcResult<()>
Destroys the NcSelector.
Note that this also destroys the NcPlane.
Sourcepub fn additem(&mut self, item: NcSelectorItem) -> NcResult<i32>
pub fn additem(&mut self, item: NcSelectorItem) -> NcResult<i32>
Adds an item.
Sourcepub fn delitem(&mut self, item: &str) -> NcResult<i32>
pub fn delitem(&mut self, item: &str) -> NcResult<i32>
Deletes an item.
C style function: ncselector_delitem().
Sourcepub fn selected(&mut self) -> Option<String>
pub fn selected(&mut self) -> Option<String>
Returns the selected option if there is one.
C style function: ncselector_delitem().