jcs's openbsd hax
openbsd
1'\" t
2.\" $OpenBSD: menu.3,v 1.5 2023/10/17 09:52:10 nicm Exp $
3.\"
4.\"***************************************************************************
5.\" Copyright 2018-2021,2023 Thomas E. Dickey *
6.\" Copyright 1998-2014,2017 Free Software Foundation, Inc. *
7.\" *
8.\" Permission is hereby granted, free of charge, to any person obtaining a *
9.\" copy of this software and associated documentation files (the *
10.\" "Software"), to deal in the Software without restriction, including *
11.\" without limitation the rights to use, copy, modify, merge, publish, *
12.\" distribute, distribute with modifications, sublicense, and/or sell *
13.\" copies of the Software, and to permit persons to whom the Software is *
14.\" furnished to do so, subject to the following conditions: *
15.\" *
16.\" The above copyright notice and this permission notice shall be included *
17.\" in all copies or substantial portions of the Software. *
18.\" *
19.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
20.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
21.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
22.\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
23.\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
24.\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
25.\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
26.\" *
27.\" Except as contained in this notice, the name(s) of the above copyright *
28.\" holders shall not be used in advertising or otherwise to promote the *
29.\" sale, use or other dealings in this Software without prior written *
30.\" authorization. *
31.\"***************************************************************************
32.\"
33.\" $Id: menu.3,v 1.5 2023/10/17 09:52:10 nicm Exp $
34.TH menu 3 2023-08-19 "ncurses 6.4" "Library calls"
35.ie \n(.g .ds `` \(lq
36.el .ds `` ``
37.ie \n(.g .ds '' \(rq
38.el .ds '' ''
39.de bP
40.ie n .IP \(bu 4
41.el .IP \(bu 2
42..
43.SH NAME
44\fBmenu\fP \- curses extension for programming menus
45.SH SYNOPSIS
46\fB#include <menu.h>\fP
47.SH DESCRIPTION
48The \fBmenu\fP library provides terminal-independent facilities for composing
49menu systems on character-cell terminals.
50The library includes: item routines,
51which create and modify menu items; and menu routines, which group items into
52menus, display menus on the screen, and handle interaction with the user.
53.PP
54The \fBmenu\fP library uses the \fBcurses\fP libraries, and a curses
55initialization routine such as \fBinitscr\fP must be called before using any of
56these functions.
57To use the \fBmenu\fP library, link with the options
58\fB\-lmenu \-lcurses\fP.
59.
60.SS Current Default Values for Item Attributes
61.
62The \fBmenu\fP library maintains a default value for item attributes.
63You can
64get or set this default by calling the appropriate \fBget_\fP or \fBset_\fP
65routine with a \fBNULL\fP item pointer.
66Changing this default with a
67\fBset_\fP function affects future item creations, but does not change the
68rendering of items already created.
69.
70.SS Routine Name Index
71.
72The following table lists each \fBmenu\fP routine and the name of
73the manual page on which it is described.
74.PP
75.TS
76l l .
77\fBcurses\fP Routine Name Manual Page Name
78=
79current_item \fBmitem_current\fP(3)
80free_item \fBmitem_new\fP(3)
81free_menu \fBmenu_new\fP(3)
82item_count \fBmenu_items\fP(3)
83item_description \fBmitem_name\fP(3)
84item_index \fBmitem_current\fP(3)
85item_init \fBmenu_hook\fP(3)
86item_name \fBmitem_name\fP(3)
87item_opts \fBmitem_opts\fP(3)
88item_opts_off \fBmitem_opts\fP(3)
89item_opts_on \fBmitem_opts\fP(3)
90item_term \fBmenu_hook\fP(3)
91item_userptr \fBmitem_userptr\fP(3)
92item_value \fBmitem_value\fP(3)
93item_visible \fBmitem_visible\fP(3)
94menu_back \fBmenu_attributes\fP(3)
95menu_driver \fBmenu_driver\fP(3)
96menu_fore \fBmenu_attributes\fP(3)
97menu_format \fBmenu_format\fP(3)
98menu_grey \fBmenu_attributes\fP(3)
99menu_init \fBmenu_hook\fP(3)
100menu_items \fBmenu_items\fP(3)
101menu_mark \fBmenu_mark\fP(3)
102menu_opts \fBmenu_opts\fP(3)
103menu_opts_off \fBmenu_opts\fP(3)
104menu_opts_on \fBmenu_opts\fP(3)
105menu_pad \fBmenu_attributes\fP(3)
106menu_pattern \fBmenu_pattern\fP(3)
107menu_request_by_name \fBmenu_requestname\fP(3)
108menu_request_name \fBmenu_requestname\fP(3)
109menu_spacing \fBmenu_spacing\fP(3)
110menu_sub \fBmenu_win\fP(3)
111menu_term \fBmenu_hook\fP(3)
112menu_userptr \fBmenu_userptr\fP(3)
113menu_win \fBmenu_win\fP(3)
114new_item \fBmitem_new\fP(3)
115new_menu \fBmenu_new\fP(3)
116pos_menu_cursor \fBmenu_cursor\fP(3)
117post_menu \fBmenu_post\fP(3)
118scale_menu \fBmenu_win\fP(3)
119set_current_item \fBmitem_current\fP(3)
120set_item_init \fBmenu_hook\fP(3)
121set_item_opts \fBmitem_opts\fP(3)
122set_item_term \fBmenu_hook\fP(3)
123set_item_userptr \fBmitem_userptr\fP(3)
124set_item_value \fBmitem_value\fP(3)
125set_menu_back \fBmenu_attributes\fP(3)
126set_menu_fore \fBmenu_attributes\fP(3)
127set_menu_format \fBmenu_format\fP(3)
128set_menu_grey \fBmenu_attributes\fP(3)
129set_menu_init \fBmenu_hook\fP(3)
130set_menu_items \fBmenu_items\fP(3)
131set_menu_mark \fBmenu_mark\fP(3)
132set_menu_opts \fBmitem_opts\fP(3)
133set_menu_pad \fBmenu_attributes\fP(3)
134set_menu_pattern \fBmenu_pattern\fP(3)
135set_menu_spacing \fBmenu_spacing\fP(3)
136set_menu_sub \fBmenu_win\fP(3)
137set_menu_term \fBmenu_hook\fP(3)
138set_menu_userptr \fBmenu_userptr\fP(3)
139set_menu_win \fBmenu_win\fP(3)
140set_top_row \fBmitem_current\fP(3)
141top_row \fBmitem_current\fP(3)
142unpost_menu \fBmenu_post\fP(3)
143.TE
144.SH RETURN VALUE
145Routines that return pointers return \fBNULL\fP on error.
146Routines that return
147an integer return one of the following error codes:
148.TP 5
149.B E_OK
150The routine succeeded.
151.TP 5
152.B E_BAD_ARGUMENT
153Routine detected an incorrect or out-of-range argument.
154.TP 5
155.B E_BAD_STATE
156Routine was called from an initialization or termination function.
157.TP 5
158.B E_NO_MATCH
159Character failed to match.
160.TP 5
161.B E_NO_ROOM
162Menu is too large for its window.
163.TP 5
164.B E_NOT_CONNECTED
165No items are connected to the menu.
166.TP 5
167.B E_NOT_POSTED
168The menu has not been posted.
169.TP 5
170.B E_NOT_SELECTABLE
171The designated item cannot be selected.
172.TP 5
173.B E_POSTED
174The menu is already posted.
175.TP 5
176.B E_REQUEST_DENIED
177The menu driver could not process the request.
178.TP 5
179.B E_SYSTEM_ERROR
180System error occurred (see \fBerrno\fP(3)).
181.TP 5
182.B E_UNKNOWN_COMMAND
183The menu driver code saw an unknown request code.
184.SH NOTES
185The header file \fB<menu.h>\fP automatically includes the header files
186\fB<curses.h>\fP and \fB<eti.h>\fP.
187.PP
188In your library list, libmenu.a should be before libncurses.a; that is,
189you should say \*(``\-lmenu \-lncurses\*('', not the other way around
190(which would give a link-error when using static libraries).
191.SH PORTABILITY
192These routines emulate the System V menu library.
193They were not supported on
194Version 7 or BSD versions.
195.PP
196The menu facility was documented in SVr4.2 in
197\fICharacter User Interface Programming (UNIX SVR4.2)\fP.
198.PP
199It is not part of X/Open Curses.
200.PP
201Aside from ncurses, there are few implementations:
202.bP
203systems based on SVr4 source code, e.g., Solaris.
204.bP
205NetBSD curses.
206.SH AUTHORS
207Juergen Pfeifer.
208Manual pages and adaptation for ncurses by Eric S. Raymond.
209.SH SEE ALSO
210\fBcurses\fP(3) and related pages whose names begin \*(``menu_\*(''
211for detailed descriptions of the entry points.
212.PP
213This describes \fBncurses\fP
214version 6.4 (patch 20230826).