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