pub struct ncmenu { /* private fields */ }Implementations§
Sourcepub fn new<'a>(
plane: &mut NcPlane,
options: &NcMenuOptions,
) -> NcResult<&'a mut Self>
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().
Sourcepub fn destroy(&mut self)
pub fn destroy(&mut self)
Destroys an NcMenu created with new.
C style function: ncmenu_destroy().
Sourcepub fn item_set_status(
&mut self,
section: &str,
item: &str,
enabled: bool,
) -> NcResult<()>
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().
Sourcepub fn mouse_selected(
&self,
click: NcInput,
shortcut: Option<&mut NcInput>,
) -> NcResult<String>
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().
Sourcepub fn nextitem(&mut self) -> NcResult<()>
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().
Sourcepub fn nextsection(&mut self) -> NcResult<()>
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().
Sourcepub fn offer_input(&mut self, input: NcInput) -> bool
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().
Sourcepub fn plane(&mut self) -> NcResult<&NcPlane>
pub fn plane(&mut self) -> NcResult<&NcPlane>
Returns the NcPlane backing this NcMenu.
C style function: ncmenu_plane().
Sourcepub fn previtem(&mut self) -> NcResult<()>
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().
Sourcepub fn prevsection(&mut self) -> NcResult<()>
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().
Sourcepub fn rollup(&mut self) -> NcResult<()>
pub fn rollup(&mut self) -> NcResult<()>
Rolls up any unrolled NcMenuSection
and hides this NcMenu if using hiding.
C style function: ncmenu_rollup().
Sourcepub fn selected(&mut self, shortcut: Option<&mut NcInput>) -> Option<String>
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().
Sourcepub fn unroll(&mut self, sectionindex: u32) -> NcResult<()>
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().