1 .\" $NetBSD: menus.3,v 1.14 2002/10/01 19:27:00 wiz Exp $
4 .\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au
6 .\" This code is donated to The NetBSD Foundation by the author.
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\" notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\" notice, this list of conditions and the following disclaimer in the
15 .\" documentation and/or other materials provided with the distribution.
16 .\" 3. The name of the Author may not be used to endorse or promote
17 .\" products derived from this software without specific prior written
20 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .Dd September 10, 1999
45 library provides a terminal independent menu system using the
50 functions the terminal must be set up by
57 functions must be linked with the
63 library provides facilities for defining menu items, placing a menu on the
64 terminal screen, assign pre- and post-change operations and setting the
65 attributes of both the menu and its items.
66 .Ss Defining default attributes for menus and items
69 library allows any settable attribute or option of both the menu and item
70 objects to be defined such that any new menu or item automatically inherits
72 Setting the default value will not affect any item or
73 menu that has already been created but will be applied to subsequent objects.
74 To set the default attribute or option the set routine is passed a NULL
75 pointer in the item or menu parameter when calling the set routine.
76 The current default value can be retrieved by calling the get routine with a
77 NULL pointer for the item or menu parameter.
79 .Bl -tag -width item_description -compact
83 .Xr menu_item_current 3
93 .Xr menu_item_current 3
105 .Xr menu_item_value 3
109 .Xr menu_item_userptr 3
111 .Xr menu_item_value 3
113 .Xr menu_item_visible 3
115 .Xr menu_attributes 3
119 .Xr menu_attributes 3
123 .Xr menu_attributes 3
137 .Xr menu_attributes 3
161 .Xr menu_item_current 3
169 .Xr menu_item_userptr 3
171 .Xr menu_item_value 3
173 .Xr menu_attributes 3
175 .Xr menu_attributes 3
179 .Xr menu_attributes 3
189 .Xr menu_attributes 3
203 .Xr menu_item_current 3
205 .Xr menu_item_current 3
210 Any function returning a string pointer will return NULL if an error
212 Functions returning an integer will return one of the following:
214 .Bl -tag -width E_UNKNOWN_COMMAND -compact
216 The function was successful.
217 .It Er E_SYSTEM_ERROR
218 There was a system error during the call.
219 .It Er E_BAD_ARGUMENT
220 One or more of the arguments passed to the function was incorrect.
222 The menu is already posted.
224 An item was already connected to a menu.
226 The function was called from within an initialization or termination
229 The menu does not fit within the subwindow.
231 The menu is not posted.
232 .It Er E_UNKNOWN_COMMAND
233 The menu driver does not recognize the request passed to it.
235 The character search failed to find a match.
236 .It Er E_NOT_SELECTABLE
237 The item could not be selected.
238 .It Er E_NOT_CONNECTED
239 The item is not connected to a menu.
240 .It Er E_REQUEST_DENIED
241 The menu driver could not process the request.
245 .Xr menu_attributes 3 ,
250 .Xr menu_item_current 3 ,
251 .Xr menu_item_name 3 ,
252 .Xr menu_item_new 3 ,
253 .Xr menu_item_opts 3 ,
254 .Xr menu_item_userptr 3 ,
255 .Xr menu_item_value 3 ,
256 .Xr menu_item_visible 3 ,
266 This implementation of the menus library does depart in behaviour
267 subtly from the original AT \*[Am] T implementation.
268 Some of the more notable departures are:
270 .Bl -tag -width "item marking" -compact
272 The original implementation did not have a marker for an unmarked field
273 the mark was only displayed next to a field when it had been marked using
275 In this implementation a separate marker can be used
276 to indicate an unmarked item.
277 This can be set using set_menu_unmark function.
278 There is no requirement for the mark and unmark strings to be the same
280 Room will be left for the longest of the two.
282 is optional, if it is not set then menus defaults to the old behaviour.
284 In the original implementation the current item was considered selected
285 and hence had the mark string displayed next to it.
286 This implementation does not do this because the Author considers the
287 effect too confusing.
288 Especially in the case of a multiple selection menu because there was no
289 way to tell if the current item is selected or not without shifting off
291 Since the current item is displayed using the foreground attribute it was
292 deemed unnecessary to also display the mark string against the current item.
295 The option O_RADIO and the function
299 extensions and must not be used in portable code.