1 .\" $NetBSD: menu_driver.3,v 1.8 2003/04/16 13:35:10 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
37 .Nd main menu handling function
43 .Fn menu_driver "MENU *menu" "int c"
47 function is the guts of the menu system.
48 It takes the commands passed
49 by c parameter and performs the requested action on the menu given.
50 The following commands may be given to the menu driver:
52 .Bl -tag -width REQ_CLEAR_PATTERN -compact
56 Sets the new current item to be the item to the left of the current
59 Sets the new current item to be the item to the rights of the current
62 Sets the new current item to be the item above the current item.
64 Sets the new current item to be the item below the current item.
66 Scroll the menu one line towards the bottom of the menu window.
67 The new current item becomes the item immediately above the current item.
69 Scroll the menu one line towards the top of the menu window.
70 The new current item becomes the item immediately below the current item.
72 Scroll the menu one page towards the bottom of the menu window.
74 Scroll the menu one page towards the top of the menu window.
76 Set the current item to be the first item in the menu.
78 Set the current item to be the last item in the menu.
80 Set the new current item to be the next item in the item array after
83 Set the new current item to be the item before the current item in the
86 If the item is selectable then toggle the item's value.
88 Clear all the characters currently in the menu's pattern buffer.
90 Remove the last character from the pattern buffer.
92 Attempt to find the next item that matches the pattern buffer.
94 Attempt to find the previous item that matches the pattern buffer.
98 is passed a command that is greater than MAX_COMMAND then the command
99 passed is assumed to be a user defined command and
101 returns E_UNKNOWN_COMMAND.
102 Otherwise if the command is a printable
103 character then the character represented by the command is placed at
104 the end of the pattern buffer and an attempt is made to match the
105 pattern buffer against the items in the menu.
107 The functions return one of the following error values:
109 .Bl -tag -width E_UNKNOWN_COMMAND -compact
111 The function was successful.
112 .It Er E_SYSTEM_ERROR
113 There was a system error during the call.
114 .It Er E_BAD_ARGUMENT
115 One or more of the arguments passed to the function was incorrect.
117 The menu is not posted.
118 .It Er E_UNKNOWN_COMMAND
119 The menu driver does not recognize the request passed to it.
121 The character search failed to find a match.
122 .It Er E_NOT_CONNECTED
123 The item is not connected to a menu.
124 .It Er E_REQUEST_DENIED
125 The menu driver could not process the request.
132 .Pa \*[Lt]menu.h\*[Gt]
133 automatically includes both
134 .Pa \*[Lt]curses.h\*[Gt]
136 .Pa \*[Lt]eti.h\*[Gt] .