'\" t
.\"***************************************************************************
.\" Copyright 2018-2023,2024 Thomas E. Dickey *
.\" Copyright 1998-2014,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
.\" copy of this software and associated documentation files (the *
.\" "Software"), to deal in the Software without restriction, including *
.\" without limitation the rights to use, copy, modify, merge, publish, *
.\" distribute, distribute with modifications, sublicense, and/or sell *
.\" copies of the Software, and to permit persons to whom the Software is *
.\" furnished to do so, subject to the following conditions: *
.\" *
.\" The above copyright notice and this permission notice shall be included *
.\" in all copies or substantial portions of the Software. *
.\" *
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
.\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
.\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
.\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
.\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
.\" *
.\" Except as contained in this notice, the name(s) of the above copyright *
.\" holders shall not be used in advertising or otherwise to promote the *
.\" sale, use or other dealings in this Software without prior written *
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: menu.3x,v 1.45 2024/03/16 15:35:01 tom Exp $
.TH menu 3MENU 2024-03-16 "ncurses 6.5" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
.\}
.el \{\
.ie t .ds `` ``
.el .ds `` ""
.ie t .ds '' ''
.el .ds '' ""
.\}
.
.de bP
.ie n .IP \(bu 4
.el .IP \(bu 2
..
.SH NAME
\fBmenu\fP \-
curses extension for programming menus
.SH SYNOPSIS
.nf
\fB#include
.fi
.SH DESCRIPTION
The \fBmenu\fP 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.
.PP
The \fBmenu\fP library uses the \fBcurses\fP libraries, and a curses
initialization routine such as \fBinitscr\fP must be called before using any of
these functions.
To use the \fBmenu\fP library, link with the options
\fB\-lmenu \-lcurses\fP.
.
.SS "Current Default Values for Item Attributes"
.
The \fBmenu\fP library maintains a default value for item attributes.
You can
get or set this default by calling the appropriate \fBget_\fP or \fBset_\fP
routine with a \fBNULL\fP item pointer.
Changing this default with a
\fBset_\fP function affects future item creations, but does not change the
rendering of items already created.
.
.SS "Routine Name Index"
.
The following table lists each \fBmenu\fP routine and the name of
the manual page on which it is described.
.PP
.TS
l l .
\fBcurses\fP Routine Name Manual Page Name
=
current_item \fB\%menu_current\fP(3MENU)
free_item \fB\%menu_new\fP(3MENU)
free_menu \fB\%new\fP(3MENU)
item_count \fB\%items\fP(3MENU)
item_description \fB\%menu_name\fP(3MENU)
item_index \fB\%menu_current\fP(3MENU)
item_init \fB\%hook\fP(3MENU)
item_name \fB\%menu_name\fP(3MENU)
item_opts \fB\%menu_opts\fP(3MENU)
item_opts_off \fB\%menu_opts\fP(3MENU)
item_opts_on \fB\%menu_opts\fP(3MENU)
item_term \fB\%hook\fP(3MENU)
item_userptr \fB\%menu_userptr\fP(3MENU)
item_value \fB\%menu_value\fP(3MENU)
item_visible \fB\%menu_visible\fP(3MENU)
menu_back \fB\%attributes\fP(3MENU)
menu_driver \fB\%driver\fP(3MENU)
menu_fore \fB\%attributes\fP(3MENU)
menu_format \fB\%format\fP(3MENU)
menu_grey \fB\%attributes\fP(3MENU)
menu_init \fB\%hook\fP(3MENU)
menu_items \fB\%items\fP(3MENU)
menu_mark \fB\%mark\fP(3MENU)
menu_opts \fB\%opts\fP(3MENU)
menu_opts_off \fB\%opts\fP(3MENU)
menu_opts_on \fB\%opts\fP(3MENU)
menu_pad \fB\%attributes\fP(3MENU)
menu_pattern \fB\%pattern\fP(3MENU)
menu_request_by_name \fB\%requestname\fP(3MENU)
menu_request_name \fB\%requestname\fP(3MENU)
menu_spacing \fB\%spacing\fP(3MENU)
menu_sub \fB\%win\fP(3MENU)
menu_term \fB\%hook\fP(3MENU)
menu_userptr \fB\%userptr\fP(3MENU)
menu_win \fB\%win\fP(3MENU)
new_item \fB\%menu_new\fP(3MENU)
new_menu \fB\%new\fP(3MENU)
pos_menu_cursor \fB\%cursor\fP(3MENU)
post_menu \fB\%post\fP(3MENU)
scale_menu \fB\%win\fP(3MENU)
set_current_item \fB\%menu_current\fP(3MENU)
set_item_init \fB\%hook\fP(3MENU)
set_item_opts \fB\%menu_opts\fP(3MENU)
set_item_term \fB\%hook\fP(3MENU)
set_item_userptr \fB\%menu_userptr\fP(3MENU)
set_item_value \fB\%menu_value\fP(3MENU)
set_menu_back \fB\%attributes\fP(3MENU)
set_menu_fore \fB\%attributes\fP(3MENU)
set_menu_format \fB\%format\fP(3MENU)
set_menu_grey \fB\%attributes\fP(3MENU)
set_menu_init \fB\%hook\fP(3MENU)
set_menu_items \fB\%items\fP(3MENU)
set_menu_mark \fB\%mark\fP(3MENU)
set_menu_opts \fB\%menu_opts\fP(3MENU)
set_menu_pad \fB\%attributes\fP(3MENU)
set_menu_pattern \fB\%pattern\fP(3MENU)
set_menu_spacing \fB\%spacing\fP(3MENU)
set_menu_sub \fB\%win\fP(3MENU)
set_menu_term \fB\%hook\fP(3MENU)
set_menu_userptr \fB\%userptr\fP(3MENU)
set_menu_win \fB\%win\fP(3MENU)
set_top_row \fB\%menu_current\fP(3MENU)
top_row \fB\%menu_current\fP(3MENU)
unpost_menu \fB\%post\fP(3MENU)
.TE
.SH RETURN VALUE
Routines that return pointers return \fBNULL\fP on error.
Routines that return
an integer return one of the following error codes:
.TP 5
.B E_OK
The routine succeeded.
.TP 5
.B E_BAD_ARGUMENT
Routine detected an incorrect or out-of-range argument.
.TP 5
.B E_BAD_STATE
Routine was called from an initialization or termination function.
.TP 5
.B E_NO_MATCH
Character failed to match.
.TP 5
.B E_NO_ROOM
Menu is too large for its window.
.TP 5
.B E_NOT_CONNECTED
No items are connected to the menu.
.TP 5
.B E_NOT_POSTED
The menu has not been posted.
.TP 5
.B E_NOT_SELECTABLE
The designated item cannot be selected.
.TP 5
.B E_POSTED
The menu is already posted.
.TP 5
.B E_REQUEST_DENIED
The menu driver could not process the request.
.TP 5
.B E_SYSTEM_ERROR
System error occurred (see \fBerrno\fP(3)).
.TP 5
.B E_UNKNOWN_COMMAND
The menu driver code saw an unknown request code.
.SH NOTES
The header file \fI\%menu.h\fP itself includes the header file
\fI\%curses.h\fP.
.SH PORTABILITY
These routines emulate the System V menu library.
They were not supported on
Version 7 or BSD versions.
.PP
A menu facility was documented in SVr4.2's
\fICharacter User Interface Programming\fP document.
.PP
It is not part of X/Open Curses.
.PP
Aside from \fI\%ncurses\fP, there are few implementations:
.bP
systems based on SVr4 source code, e.g., Solaris.
.bP
NetBSD curses.
.SH AUTHORS
Juergen Pfeifer.
Manual pages and adaptation for \fI\%ncurses\fP by Eric S. Raymond.
.SH SEE ALSO
\fB\%ncurses\fP(3NCURSES) and related pages whose names begin \*(``menu_\*(''
for detailed descriptions of the entry points.