Struct ncselector

Source
#[repr(C)]
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.

Trait Implementations§

Source§

impl Debug for ncselector

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.