p The .Nm library provides facilities for defining menu items, placing a menu on the terminal screen, assign pre- and post-change operations and setting the attributes of both the menu and its items. .Ss Defining default attributes for menus and items The .Nm library allows any settable attribute or option of both the menu and item objects to be defined such that any new menu or item automatically inherits the value as default. Setting the default value will not affect any item or menu that has already been created but will be applied to subsequent objects. To set the default attribute or option the set routine is passed a NULL pointer in the item or menu parameter when calling the set routine. The current default value can be retrieved by calling the get routine with a NULL pointer for the item or menu parameter.
p l -tag -width item_description -compact t function name manual page name t current_item .Xr menu_item_current 3 t free_item .Xr menu_item_new 3 t free_menu .Xr menu_new 3 t item_count .Xr menu_items 3 t item_description .Xr menu_item_name 3 t item_index .Xr menu_item_current 3 t item_init .Xr menu_hook 3 t item_name .Xr menu_item_name 3 t item_opts .Xr menu_item_opts 3 t item_opts_off .Xr menu_item_opts 3 t item_opts_on .Xr menu_item_opts 3 t item_selected .Xr menu_item_value 3 t item_term .Xr menu_hook 3 t item_userptr .Xr menu_item_userptr 3 t item_value .Xr menu_item_value 3 t item_visible .Xr menu_item_visible 3 t menu_back .Xr menu_attributes 3 t menu_driver .Xr menu_driver 3 t menu_fore .Xr menu_attributes 3 t menu_format .Xr menu_format 3 t menu_grey .Xr menu_attributes 3 t menu_init .Xr menu_hook 3 t menu_items .Xr menu_items 3 t menu_mark .Xr menu_mark 3 t menu_opts .Xr menu_opts 3 t menu_opts_off .Xr menu_opts 3 t menu_opts_on .Xr menu_opts 3 t menu_pad .Xr menu_attributes 3 t menu_pattern .Xr menu_pattern 3 t menu_sub .Xr menu_win 3 t menu_term .Xr menu_hook 3 t menu_unmark .Xr menu_mark 3 t menu_userptr .Xr menu_userptr 3 t men_win .Xr menu_win 3 t new_item .Xr menu_item_new 3 t new_menu .Xr menu_new 3 t pos_menu_cursor .Xr menu_cursor 3 t post_menu .Xr menu_post 3 t scale_menu .Xr menu_win 3 t set_current_item .Xr menu_item_current 3 t set_item_init .Xr menu_hook 3 t set_item_opts .Xr menu_item_opts 3 t set_item_term .Xr menu_hook 3 t set_item_userptr .Xr menu_item_userptr 3 t set_item_value .Xr menu_item_value 3 t set_menu_back .Xr menu_attributes 3 t set_menu_fore .Xr menu_attributes 3 t set_menu_format .Xr menu_format 3 t set_menu_grey .Xr menu_attributes 3 t set_menu_init .Xr menu_hook 3 t set_menu_items .Xr menu_items 3 t set_menu_mark .Xr menu_mark 3 t set_menu_opts .Xr menu_opts 3 t set_menu_pad .Xr menu_attributes 3 t set_menu_pattern .Xr menu_pattern 3 t set_menu_sub .Xr menu_win 3 t set_menu_term .Xr menu_hook 3 t set_menu_unmark .Xr menu_mark 3 t set_menu_userptr .Xr menu_userptr 3 t set_menu_win .Xr menu_win 3 t set_top_row .Xr menu_item_current 3 t top_row .Xr menu_item_current 3 t unpost_menu .Xr menu_post 3 .El .Sh RETURN VALUES Any function returning a string pointer will return NULL if an error occurs. Functions returning an integer will return one of the following:
p l -tag -width E_UNKNOWN_COMMAND -compact t Er E_OK The function was successful. t Er E_SYSTEM_ERROR There was a system error during the call. t Er E_BAD_ARGUMENT One or more of the arguments passed to the function was incorrect. t Er E_POSTED The menu is already posted. t Er E_CONNECTED An item was already connected to a menu. t Er E_BAD_STATE The function was called from within an initialization or termination routine. t Er E_NO_ROOM The menu does not fit within the subwindow. t Er E_NOT_POSTED The menu is not posted. t Er E_UNKNOWN_COMMAND The menu driver does not recognize the request passed to it. t Er E_NO_MATCH The character search failed to find a match. t Er E_NOT_SELECTABLE The item could not be selected. t Er E_NOT_CONNECTED The item is not connected to a menu. t Er E_REQUEST_DENIED The menu driver could not process the request. .El .Sh SEE ALSO .Xr curses 3 , .Xr menu_attributes 3 , .Xr menu_cursor 3 , .Xr menu_driver 3 , .Xr menu_format 3 , .Xr menu_hook 3 , .Xr menu_item_current 3 , .Xr menu_item_name 3 , .Xr menu_item_new 3 , .Xr menu_item_opts 3 , .Xr menu_item_userptr 3 , .Xr menu_item_value 3 , .Xr menu_item_visible 3 , .Xr menu_items 3 , .Xr menu_mark 3 , .Xr menu_new 3 , .Xr menu_opts 3 , .Xr menu_pattern 3 , .Xr menu_post 3 , .Xr menu_userptr 3 , .Xr menu_win 3 .Sh NOTES This implementation of the menus library does depart in behaviour subtly from the original AT & T implementation. Some of the more notable departures are:
p l -tag -width "item marking" -compact t unmark The original implementation did not have a marker for an unmarked field the mark was only displayed next to a field when it had been marked using the REQ_TOGGLE_ITEM. In this implementation a separate marker can be used to indicate an unmarked item. This can be set using set_menu_unmark function. There is no requirement for the mark and unmark strings to be the same length. Room will be left for the longest of the two. The unmark string is optional, if it is not set then menus defaults to the old behaviour. t item marking In the original implementation the current item was considered selected and hence had the mark string displayed next to it. This implementation does not do this because the Author considers the effect too confusing. Especially in the case of a multiple selection menu because there was no way to tell if the current item is selected or not without shifting off of it. Since the current item is displayed using the foreground attribute it was deemed unnecessary to also display the mark string against the current item. .El
p The option O_RADIO and the function .Fn item_selected are .Nx extensions and must not be used in portable code.