[][src]Module ncursesw::menu

NCurses Menu module

The menu library provides terminal-independent facilities for composing menu systems on character-cell terminals. The library includes: item routines, which create and modify menu items; and menu routines, which group items into menus, display menus on the screen, and handle interaction with the user.

Structs

ItemOptions

Menu item options.

MenuOptions

Menu options.

MenuSize

Menu size (rows and columns).

MenuSpacing

Menu spacing (layout spacing).

Enums

ItemOption

Menu item options.

MenuOption

Menu option.

MenuRequest

Menu request.

NCurseswMenuError

NCursesw menu errors.

Functions

current_item

Returns a pointer to the current item in the given menu.

free_item

De-allocates a menu item.

free_menu

Disconnects menu from its item array and frees the storage allocated for the menu.

item_count

Returns the count of items in menu.

item_description

Returns the description part of the given menu item.

item_index

Returns the (zero-origin) index of item in the menu's item pointer list.

item_init

Returns the current menu item init hook.

item_name

Returns the name part of the given menu item.

item_opts

Returns the item's current options.

item_opts_off

Turns off the given options, and leaves others alone.

item_opts_on

Turns on the given options, and leaves others alone.

item_term

Returns the current menu item term hook.

item_userptr

Returns the menu item user pointer.

item_value

Returns the menu items value.

item_visible

Returns if the menu item is visible.

menu_back

Returns the background attribute. The default is normal::Attributes::Normal.

menu_driver

command-processing loop of the menu system.

menu_fore

Returns the foreground attribute. The default is normal::Attributes::Reverse.

menu_format

Returns the maximum-size constraints for the given menu into the storage addressed by rows and cols.

menu_grey

Returns the grey attribute. The default is normal::Attributes::Underline.

menu_init

Returns the current menu init hook.

menu_items

Returns the menu items as a vector of the given menu.

menu_mark

Returns the menu's mark string.

menu_opts

Returns the menu's current options.

menu_opts_off

Turns off the given options, and leaves others alone.

menu_opts_on

Turns on the given options, and leaves others alone.

menu_pad

Returns the given menu's pad character. The default is a blank.

menu_pattern

Returns the pattern buffer of the given menu.

menu_request_by_name

Searches in the name-table for a request with the given name and returns its MenuRequest. Otherwise None is returned.

menu_request_name

Returns the printable name of a menu request code.

menu_spacing

Returns the spacing info for the menu.

menu_sub

Returns the menus sub-window.

menu_term

Returns the current menu term hook.

menu_userptr

Returns the menu user pointer.

menu_win

Returns the menus main-window.

ncursesw_menu_error_from_rc
new_item

Allocates a new item and initializes it from the name and description

new_menu

Creates a new menu connected to a specified vector of menu item.

new_menu_sp

Screen function of new_menu().

pos_menu_cursor

Restores the cursor to the current position associated with the menu's selected item. This is useful after NCurses routines have been called to do screen-painting in response to a menu select.

post_menu

Displays a menu to its associated subwindow. To trigger physical display of the sub-window, use refresh() or some equivalent curses routine (the implicit doupdate() triggered by an NCurses input request will do). post_menu() resets the selection status of all items.

scale_menu

Returns the minimum size required for the sub-window of menu.

set_current_item

Sets the current item (the item on which the menu cursor is positioned).

set_item_init

Sets a hook to be called at menu-post time and each time the selected item changes (after the change).

set_item_opts

Sets all the given item's options.

set_item_term

Sets a hook to be called at menu-unpost time and each time the selected item changes (before the change).

set_item_userptr

Sets the menu item user pointer.

set_item_value

Sets the menu items value.

set_menu_back

Sets the background attribute of menu. This is the highlight used for selectable (but not currently selected) menu items.

set_menu_fore

Sets the foreground attribute of menu. This is the highlight used for selected menu items.

set_menu_format

Sets the maximum display size of the given menu. If this size is too small to display all menu items, the menu will be made scrollable. If this size is larger than the menus sub-window and the sub-window is too small to display all menu items, post_menu() will fail.

set_menu_grey

Sets the grey attribute of menu. This is the highlight used for un-selectable menu items in menus that permit more than one selection.

set_menu_init

Sets a hook to be called at menu-post time and just after the top row on the menu changes once it is posted.

set_menu_items

Changes the menu items using a vector of menu items for the given menu.

set_menu_mark

Sets the mark string for the given menu. Note that changing the length of the mark string for a menu while the menu is posted is likely to produce undefined behavior. The default string is "-" (a dash).

set_menu_opts

Sets all the given item's options.

set_menu_pad

Sets the character used to fill the space between the name and description parts of a menu item.

set_menu_pattern

Sets the pattern buffer for the given menu and tries to find the first matching item. If it succeeds, that item becomes current; if not, the current item does not change.

set_menu_spacing

Sets the spacing information for the menu. Its parameter MenuSpacing::spc_description controls the number of spaces between an item name and an item description. It must not be larger than TABSIZE. The menu system puts in the middle of this spacing area the pad character. The remaining parts are filled with spaces. The MenuSpacing::spc_rows parameter controls the number of rows that are used for an item. It must not be larger than 3. The menu system inserts the blank lines between item rows, these lines will contain the pad character in the appropriate positions. The MenuSpacing::spc_columns parameter controls the number of blanks between columns of items. It must not be larger than TABSIZE. A value of 0 for all the spacing values resets them to the default, which is 1 for all of them.

set_menu_sub

Sets the menus sub-window. if form is None then window is default for all forms, if window is None the stdscr() is used.

set_menu_term

Sets a hook to be called at menu-unpost time and just before the top row on the menu changes once it is posted.

set_menu_userptr

Sets the menu user pointer.

set_menu_win

Sets the menus main-window. if form is None then window is default for all forms, if window is None the stdscr() is used.

set_top_row

Sets the top row of the menu to show the given row (the top row is initially 0, and is reset to this value whenever the MenuOption::RowMajor option is toggled). The item leftmost on the given row becomes current.

top_row

Returns the number of the top menu row being displayed.

unpost_menu

Erases menu from its associated subwindow.

Type Definitions

ITEM

Menu item.

MENU

Menu.

MenuUserPtr

User pointer.

Menu_Hook

Menu callback function.