Update ncurses to version 5.4.
[dragonfly.git] / lib / libncurses / man / menu_driver.3
1 .\"***************************************************************************
2 .\" Copyright (c) 1998-2002,2003 Free Software Foundation, Inc.              *
3 .\"                                                                          *
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:                 *
11 .\"                                                                          *
12 .\" The above copyright notice and this permission notice shall be included  *
13 .\" in all copies or substantial portions of the Software.                   *
14 .\"                                                                          *
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.                               *
22 .\"                                                                          *
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       *
26 .\" authorization.                                                           *
27 .\"***************************************************************************
28 .\"
29 .\" $Id: menu_driver.3x,v 1.11 2003/05/10 20:22:01 tom Exp $
30 .\" $DragonFly: src/lib/libncurses/man/menu_driver.3,v 1.1 2005/03/12 19:13:54 eirikn Exp $
31 .TH menu_driver 3X ""
32 .SH NAME
33 \fBmenu_driver\fR - command-processing loop of the menu system
34 .SH SYNOPSIS
35 \fB#include <menu.h>\fR
36 .br
37 int menu_driver(MENU *menu, int c);
38 .br
39 .SH DESCRIPTION
40 Once a menu has been posted (displayed), you should funnel input events to it
41 through \fBmenu_driver\fR.  This routine has three major input cases; either
42 the input is a menu navigation request, it's a printable ASCII character or it
43 is the KEY_MOUSE special key associated with an mouse event.
44 The menu driver requests are as follows:
45 .TP 5
46 REQ_LEFT_ITEM
47 Move left to an item.
48 .TP 5
49 REQ_RIGHT_ITEM
50 Move right to an item.
51 .TP 5
52 REQ_UP_ITEM
53 Move up to an item.
54 .TP 5
55 REQ_DOWN_ITEM
56 Move down to an item.
57 .TP 5
58 REQ_SCR_ULINE
59 Scroll up a line.
60 .TP 5
61 REQ_SCR_DLINE
62 Scroll down a line.
63 .TP 5
64 REQ_SCR_DPAGE
65 Scroll down a page.
66 .TP 5
67 REQ_SCR_UPAGE
68 Scroll up a page.
69 .TP 5
70 REQ_FIRST_ITEM
71 Move to the first item.
72 .TP 5
73 REQ_LAST_ITEM
74 Move to the last item.
75 .TP 5
76 REQ_NEXT_ITEM
77 Move to the next item.
78 .TP 5
79 REQ_PREV_ITEM
80 Move to the previous item.
81 .TP 5
82 REQ_TOGGLE_ITEM
83 Select/deselect an item.
84 .TP 5
85 REQ_CLEAR_PATTERN
86 Clear the menu pattern buffer.
87 .TP 5
88 REQ_BACK_PATTERN
89 Delete the previous character from the pattern buffer.
90 .TP 5
91 REQ_NEXT_MATCH
92 Move to the next item matching the pattern match.
93 .TP 5
94 REQ_PREV_MATCH
95 Move to the previous item matching the pattern match.
96 .PP
97 If the second argument is a printable ASCII character, the code appends
98 it to the pattern buffer and attempts to move to the next item matching
99 the new pattern.  If there is no such match, \fBmenu_driver\fR returns
100 \fBE_NO_MATCH\fR and deletes the appended character from the buffer.
101 .PP
102 If the second argument is one of the above pre-defined requests, the
103 corresponding action is performed.
104 .PP
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. If you click above the
109 display region of the menu, a REQ_SCR_ULINE is generated, if you
110 doubleclick a REQ_SCR_UPAGE is generated and if you tripleclick a
111 REQ_FIRST_ITEM is generated. If you click below the display region of
112 the menu, a REQ_SCR_DLINE is generated, if you doubleclick a REQ_SCR_DPAGE
113 is generated and if you tripleclick a REQ_LAST_ITEM is generated. If you
114 click at an item inside the display area of the menu, the menu cursor
115 is positioned to that item. If you double-click at an item a REQ_TOGGLE_ITEM
116 is generated and \fBE_UNKNOWN_COMMAND\fR is returned. This return value makes
117 sense, because a double click usually means that an item-specific action should
118 be returned. It's exactly the purpose of this return value to signal that an
119 application specific command should be executed. If a translation
120 into a request was done, \fBmenu_driver\fR returns the result of this request.
121 If you clicked outside the user window or the mouse event couldn't be translated
122 into a menu request an \fBE_REQUEST_DENIED\fR is returned.
123 .PP
124 If the second argument is neither printable ASCII nor one of the above
125 pre-defined menu requests or KEY_MOUSE, the drive assumes it is an application-specific
126 command and returns \fBE_UNKNOWN_COMMAND\fR.  Application-defined commands
127 should be defined relative to \fBMAX_COMMAND\fR, the maximum value of these
128 pre-defined requests.
129 .SH RETURN VALUE
130 \fBmenu_driver\fR return one of the following error codes:
131 .TP 5
132 \fBE_OK\fR
133 The routine succeeded.
134 .TP 5
135 \fBE_SYSTEM_ERROR\fR
136 System error occurred (see \fBerrno\fR).
137 .TP 5
138 \fBE_BAD_ARGUMENT\fR
139 Routine detected an incorrect or out-of-range argument.
140 .TP 5
141 \fBE_BAD_STATE\fR
142 Routine was called from an initialization or termination function.
143 .TP 5
144 \fBE_NOT_POSTED\fR
145 The menu has not been posted.
146 .TP 5
147 \fBE_UNKNOWN_COMMAND\fR
148 The menu driver code saw an unknown request code.
149 .TP 5
150 \fBE_NO_MATCH\fR
151 Character failed to match.
152 .TP 5
153 \fBE_REQUEST_DENIED\fR
154 The menu driver could not process the request.
155 .SH SEE ALSO
156 \fBcurses\fR(3X), \fBmenu\fR(3X).
157 .SH NOTES
158 The header file \fB<menu.h>\fR automatically includes the header files
159 \fB<curses.h>\fR.
160 .SH PORTABILITY
161 These routines emulate the System V menu library.  They were not supported on
162 Version 7 or BSD versions. The support for mouse events is ncurses specific.
163 .SH AUTHORS
164 Juergen Pfeifer.  Manual pages and adaptation for new curses by Eric
165 S. Raymond.
166 .\"#
167 .\"# The following sets edit modes for GNU EMACS
168 .\"# Local Variables:
169 .\"# mode:nroff
170 .\"# fill-column:79
171 .\"# End: