ncmenu

Struct ncmenu 

Source
pub struct ncmenu { /* private fields */ }

Implementations§

Source§

impl ncmenu

§NcMenu constructors & destructors

Source

pub fn new<'a>( plane: &mut NcPlane, options: &NcMenuOptions, ) -> NcResult<&'a mut Self>

Creates an NcMenu with the specified options.

Menus are currently bound to an overall Nc object (as opposed to a particular plane), and are implemented as NcPlanes kept atop other NcPlanes.

C style function: ncmenu_create().

Source

pub fn destroy(&mut self)

Destroys an NcMenu created with new.

C style function: ncmenu_destroy().

Source§

impl ncmenu

§NcMenu methods

Source

pub fn item_set_status( &mut self, section: &str, item: &str, enabled: bool, ) -> NcResult<()>

Disables or enables an NcMenuItem.

C style function: ncmenu_item_set_status().

Source

pub fn mouse_selected( &self, click: NcInput, shortcut: Option<&mut NcInput>, ) -> NcResult<String>

Returns the NcMenuItem description corresponding to the mouse click.

The NcMenuItem must be on an actively unrolled section, and the click must be in the area of a valid item.

If ninput is provided, and the selected item has a shortcut, it will be filled in with that shortcut.

C style function: ncmenu_mouse_selected().

Source

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

Moves to the next item within the currently unrolled section.

If no section is unrolled, the first section will be unrolled.

C style function: ncmenu_nextitem().

Source

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

Unrolls the next section (relative to current unrolled).

If no section is unrolled, the first section will be unrolled.

C style function: ncmenu_nextsection().

Source

pub fn offer_input(&mut self, input: NcInput) -> bool

Offers the input to this NcMenu.

If it’s relevant, this function returns true, and the input ought not be processed further. If it’s irrelevant to the menu, false is returned.

Relevant inputs include:

  • mouse movement over a hidden menu
  • a mouse click on a menu section (the section is unrolled)
  • a mouse click outside of an unrolled menu (the menu is rolled up)
  • left or right on an unrolled menu (navigates among sections)
  • up or down on an unrolled menu (navigates among items)
  • escape on an unrolled menu (the menu is rolled up)

C style function: ncmenu_offer_input().

Source

pub fn plane(&mut self) -> NcResult<&NcPlane>

Returns the NcPlane backing this NcMenu.

C style function: ncmenu_plane().

Source

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

Moves to the previous item within the currently unrolled section.

If no section is unrolled, the first section will be unrolled.

C style function: ncmenu_previtem().

Source

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

Unrolls the previous section (relative to current unrolled).

If no section is unrolled, the first section will be unrolled.

C style function: ncmenu_prevsection().

Source

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

Rolls up any unrolled NcMenuSection and hides this NcMenu if using hiding.

C style function: ncmenu_rollup().

Source

pub fn selected(&mut self, shortcut: Option<&mut NcInput>) -> Option<String>

Returns the selected item description, if there’s an unrolled section.

If shortcut is provided, and the selected item has a shortcut, it will be filled in with that shortcut–this can allow faster matching.

C style function: ncmenu_selected().

Source

pub fn unroll(&mut self, sectionindex: u32) -> NcResult<()>

Unrolls the specified NcMenuSection, making the menu visible if it was invisible and rolling up any NcMenuSection that is already unrolled.

C style function: ncmenu_unroll().

Trait Implementations§

Source§

impl Debug for ncmenu

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for ncmenu

§

impl RefUnwindSafe for ncmenu

§

impl Send for ncmenu

§

impl Sync for ncmenu

§

impl Unpin for ncmenu

§

impl UnwindSafe for ncmenu

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.