NcSelector

Type Alias NcSelector 

Source
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

Source

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.

Source

pub fn builder() -> NcSelectorBuilder

Starts the builder.

Source

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).
Source

pub fn destroy(&mut self) -> NcResult<()>

Destroys the NcSelector.

Note that this also destroys the NcPlane.

Source

pub fn additem(&mut self, item: NcSelectorItem) -> NcResult<i32>

Adds an item.

Source

pub fn delitem(&mut self, item: &str) -> NcResult<i32>

Deletes an item.

C style function: ncselector_delitem().

Source

pub fn selected(&mut self) -> Option<String>

Returns the selected option if there is one.

C style function: ncselector_delitem().

Source

pub fn nextitem(&mut self) -> NcResult<String>

Move down in the list. A reference to the newly-selected item is returned, or NULL if there are no items in the list.

Source

pub fn previtem(&mut self) -> NcResult<String>

Move up in the list. A reference to the newly-selected item is returned, or NULL if there are no items in the list.