1 .\"***************************************************************************
2 .\" Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
4 .\" Permission is hereby granted, free of charge, to any person obtaining a *
5 .\" copy of this software and associated documentation files (the *
6 .\" "Software"), to deal in the Software without restriction, including *
7 .\" without limitation the rights to use, copy, modify, merge, publish, *
8 .\" distribute, distribute with modifications, sublicense, and/or sell *
9 .\" copies of the Software, and to permit persons to whom the Software is *
10 .\" furnished to do so, subject to the following conditions: *
12 .\" The above copyright notice and this permission notice shall be included *
13 .\" in all copies or substantial portions of the Software. *
15 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
23 .\" Except as contained in this notice, the name(s) of the above copyright *
24 .\" holders shall not be used in advertising or otherwise to promote the *
25 .\" sale, use or other dealings in this Software without prior written *
27 .\"***************************************************************************
29 .\" $Id: menu_driver.3x,v 1.14 2007/06/02 22:50:09 tom Exp $
32 \fBmenu_driver\fR - command-processing loop of the menu system
34 \fB#include <menu.h>\fR
36 int menu_driver(MENU *menu, int c);
39 Once a menu has been posted (displayed), you should funnel input events to it
40 through \fBmenu_driver\fR. This routine has three major input cases; either
41 the input is a menu navigation request, it is a printable ASCII character or it
42 is the KEY_MOUSE special key associated with an mouse event.
43 The menu driver requests are as follows:
49 Move right to an item.
70 Move to the first item.
73 Move to the last item.
76 Move to the next item.
79 Move to the previous item.
82 Select/deselect an item.
85 Clear the menu pattern buffer.
88 Delete the previous character from the pattern buffer.
91 Move to the next item matching the pattern match.
94 Move to the previous item matching the pattern match.
96 If the second argument is a printable ASCII character, the code appends
97 it to the pattern buffer and attempts to move to the next item matching
98 the new pattern. If there is no such match, \fBmenu_driver\fR returns
99 \fBE_NO_MATCH\fR and deletes the appended character from the buffer.
101 If the second argument is one of the above pre-defined requests, the
102 corresponding action is performed.
105 If the second argument is the KEY_MOUSE special key, the associated
106 mouse event is translated into one of the above pre-defined requests.
107 Currently only clicks in the user window (e.g. inside the menu display
108 area or the decoration window) are handled.
110 If you click above the display region of the menu:
113 a REQ_SCR_ULINE is generated for a single click,
115 a REQ_SCR_UPAGE is generated for a double-click and
117 a REQ_FIRST_ITEM is generated for a triple-click.
120 If you click below the display region of the menu:
123 a REQ_SCR_DLINE is generated for a single click,
125 a REQ_SCR_DPAGE is generated for a double-click and
127 a REQ_LAST_ITEM is generated for a triple-click.
130 If you click at an item inside the display area of the menu:
134 the menu cursor is positioned to that item.
137 If you double-click an item a REQ_TOGGLE_ITEM
138 is generated and \fBE_UNKNOWN_COMMAND\fR is returned.
139 This return value makes sense,
140 because a double click usually means that an item-specific action should
142 It is exactly the purpose of this return value to signal that an
143 application specific command should be executed.
147 into a request was done, \fBmenu_driver\fR returns the result of this request.
150 If you clicked outside the user window or the mouse event couldn't be translated
151 into a menu request an \fBE_REQUEST_DENIED\fR is returned.
152 .SS APPLICATION-DEFINED COMMANDS
154 If the second argument is neither printable ASCII nor one of the above
155 pre-defined menu requests or KEY_MOUSE, the drive assumes it is an application-specific
156 command and returns \fBE_UNKNOWN_COMMAND\fR. Application-defined commands
157 should be defined relative to \fBMAX_COMMAND\fR, the maximum value of these
158 pre-defined requests.
160 \fBmenu_driver\fR return one of the following error codes:
163 The routine succeeded.
166 System error occurred (see \fBerrno\fR).
169 Routine detected an incorrect or out-of-range argument.
172 Routine was called from an initialization or termination function.
175 The menu has not been posted.
178 The menu driver code saw an unknown request code.
181 Character failed to match.
184 The menu driver could not process the request.
186 \fBcurses\fR(3X), \fBmenu\fR(3X).
188 The header file \fB<menu.h>\fR automatically includes the header files
191 These routines emulate the System V menu library. They were not supported on
192 Version 7 or BSD versions. The support for mouse events is ncurses specific.
194 Juergen Pfeifer. Manual pages and adaptation for new curses by Eric
197 .\"# The following sets edit modes for GNU EMACS
198 .\"# Local Variables: