Type Definition libnotcurses_sys::widgets::NcMenu[][src]

type NcMenu = ncmenu;
Expand description

menus on the top or bottom rows

A [Notcurses][crate::Notcurses] instance supports menu bars on the top or bottom row of the true screen.

An NcMenu is composed of NcMenuSections, which are in turn composed of NcMenuItems.

Either no sections are visible, and the menu is rolled up, or exactly one section is unrolled.

  • rollup() places an NcMenu in the rolled up state.
  • unroll() rolls up any unrolled section and unrolls the specified one.
  • destroy() removes a menu bar, and frees all associated resources.

type in C: ncmenu (struct)

Implementations

Creates an NcMenu with the specified options.

Menus are currently bound to an overall [Notcurses][crate::Notcurses] object (as opposed to a particular plane), and are implemented as NcPlanes kept atop other NcPlanes.

C style function: ncmenu_create().

Destroys an NcMenu created with new.

C style function: ncmenu_destroy().

Disables or enables an NcMenuItem.

C style function: ncmenu_item_set_status().

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

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

Unrolls the next section (relative to current unrolled).

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

C style function: ncmenu_nextsection().

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

Returns the NcPlane backing this NcMenu.

C style function: ncmenu_plane().

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

Unrolls the previous section (relative to current unrolled).

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

C style function: ncmenu_prevsection().

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

C style function: ncmenu_rollup().

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

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