]> ncurses.scripts.mit.edu Git - ncurses.git/blob - doc/html/man/menu_driver.3x.html
86eacc4ded0e1c11069d8da85de49c738a16a431
[ncurses.git] / doc / html / man / menu_driver.3x.html
1 <!-- 
2   ****************************************************************************
3   * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc.              *
4   *                                                                          *
5   * Permission is hereby granted, free of charge, to any person obtaining a  *
6   * copy of this software and associated documentation files (the            *
7   * "Software"), to deal in the Software without restriction, including      *
8   * without limitation the rights to use, copy, modify, merge, publish,      *
9   * distribute, distribute with modifications, sublicense, and/or sell       *
10   * copies of the Software, and to permit persons to whom the Software is    *
11   * furnished to do so, subject to the following conditions:                 *
12   *                                                                          *
13   * The above copyright notice and this permission notice shall be included  *
14   * in all copies or substantial portions of the Software.                   *
15   *                                                                          *
16   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
17   * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
18   * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
19   * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
20   * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
21   * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
22   * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
23   *                                                                          *
24   * Except as contained in this notice, the name(s) of the above copyright   *
25   * holders shall not be used in advertising or otherwise to promote the     *
26   * sale, use or other dealings in this Software without prior written       *
27   * authorization.                                                           *
28   ****************************************************************************
29   * @Id: menu_driver.3x,v 1.20 2010/12/04 18:38:55 tom Exp @
30 -->
31 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
32 <HTML>
33 <HEAD>
34 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
35 <meta name="generator" content="Manpage converted by man2html - see http://invisible-island.net/scripts/readme.html#others_scripts">
36 <TITLE>menu_driver 3x</TITLE>
37 <link rev=made href="mailto:bug-ncurses@gnu.org">
38 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
39 </HEAD>
40 <BODY>
41 <H1>menu_driver 3x</H1>
42 <HR>
43 <PRE>
44 <STRONG><A HREF="menu_driver.3x.html">menu_driver(3x)</A></STRONG>                                         <STRONG><A HREF="menu_driver.3x.html">menu_driver(3x)</A></STRONG>
45
46
47
48
49 </PRE>
50 <H2><a name="h2-NAME">NAME</a></H2><PRE>
51        <STRONG>menu_driver</STRONG> - command-processing loop of the menu system
52
53
54 </PRE>
55 <H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
56        <STRONG>#include</STRONG> <STRONG>&lt;menu.h&gt;</STRONG>
57        int menu_driver(MENU *menu, int c);
58
59
60 </PRE>
61 <H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
62        Once a menu has been posted (displayed), you should funnel
63        input events to it through <STRONG>menu_driver</STRONG>.  This routine  has
64        three major input cases:
65
66        <STRONG>o</STRONG>   The  input  is  a form navigation request.  Navigation
67            request codes are constants defined in <STRONG>&lt;form.h&gt;</STRONG>, which
68            are   distinct  from  the  key-  and  character  codes
69            returned by <STRONG>wgetch</STRONG>.
70
71        <STRONG>o</STRONG>   The input is a printable character.  Printable charac-
72            ters  (which  must  be  positive,  less  than 256) are
73            checked according to the program's locale settings.
74
75        <STRONG>o</STRONG>   The input is the KEY_MOUSE special key associated with
76            an mouse event.
77
78        The menu driver requests are as follows:
79
80        REQ_LEFT_ITEM
81             Move left to an item.
82
83        REQ_RIGHT_ITEM
84             Move right to an item.
85
86        REQ_UP_ITEM
87             Move up to an item.
88
89        REQ_DOWN_ITEM
90             Move down to an item.
91
92        REQ_SCR_ULINE
93             Scroll up a line.
94
95        REQ_SCR_DLINE
96             Scroll down a line.
97
98        REQ_SCR_DPAGE
99             Scroll down a page.
100
101        REQ_SCR_UPAGE
102             Scroll up a page.
103
104        REQ_FIRST_ITEM
105             Move to the first item.
106
107        REQ_LAST_ITEM
108             Move to the last item.
109
110        REQ_NEXT_ITEM
111             Move to the next item.
112
113        REQ_PREV_ITEM
114             Move to the previous item.
115
116        REQ_TOGGLE_ITEM
117             Select/deselect an item.
118
119        REQ_CLEAR_PATTERN
120             Clear the menu pattern buffer.
121
122        REQ_BACK_PATTERN
123             Delete  the  previous character from the pattern buf-
124             fer.
125
126        REQ_NEXT_MATCH
127             Move to the next item matching the pattern match.
128
129        REQ_PREV_MATCH
130             Move to the previous item matching the pattern match.
131
132        If the second argument is a printable character, the  code
133        appends  it  to the pattern buffer and attempts to move to
134        the next item matching the new pattern.  If  there  is  no
135        such match, <STRONG>menu_driver</STRONG> returns <STRONG>E_NO_MATCH</STRONG> and deletes the
136        appended character from the buffer.
137
138        If the second argument is one  of  the  above  pre-defined
139        requests, the corresponding action is performed.
140
141
142 </PRE>
143 <H3><a name="h3-MOUSE-HANDLING">MOUSE HANDLING</a></H3><PRE>
144        If  the  second argument is the KEY_MOUSE special key, the
145        associated mouse event is translated into one of the above
146        pre-defined  requests.   Currently only clicks in the user
147        window (e.g., inside the menu display area or the  decora-
148        tion window) are handled.
149
150        If you click above the display region of the menu:
151
152        <STRONG>o</STRONG>   a REQ_SCR_ULINE is generated for a single click,
153
154        <STRONG>o</STRONG>   a REQ_SCR_UPAGE is generated for a double-click and
155
156        <STRONG>o</STRONG>   a REQ_FIRST_ITEM is generated for a triple-click.
157
158        If you click below the display region of the menu:
159
160        <STRONG>o</STRONG>   a REQ_SCR_DLINE is generated for a single click,
161
162        <STRONG>o</STRONG>   a REQ_SCR_DPAGE is generated for a double-click and
163
164        <STRONG>o</STRONG>   a REQ_LAST_ITEM is generated for a triple-click.
165
166        If  you  click  at  an item inside the display area of the
167        menu:
168
169        <STRONG>o</STRONG>   the menu cursor is positioned to that item.
170
171        <STRONG>o</STRONG>   If you double-click an item a REQ_TOGGLE_ITEM is  gen-
172            erated and <STRONG>E_UNKNOWN_COMMAND</STRONG> is returned.  This return
173            value makes sense,  because  a  double  click  usually
174            means that an item-specific action should be returned.
175            It is exactly the purpose of this return value to sig-
176            nal  that  an  application  specific command should be
177            executed.
178
179        <STRONG>o</STRONG>   If a translation into a request was done,  <STRONG>menu_driver</STRONG>
180            returns the result of this request.
181
182        If  you clicked outside the user window or the mouse event
183        could  not  be  translated  into   a   menu   request   an
184        <STRONG>E_REQUEST_DENIED</STRONG> is returned.
185
186
187 </PRE>
188 <H3><a name="h3-APPLICATION-DEFINED-COMMANDS">APPLICATION-DEFINED COMMANDS</a></H3><PRE>
189        If the second argument is neither printable nor one of the
190        above pre-defined menu requests or  KEY_MOUSE,  the  drive
191        assumes  it is an application-specific command and returns
192        <STRONG>E_UNKNOWN_COMMAND</STRONG>.  Application-defined commands should be
193        defined  relative  to  <STRONG>MAX_COMMAND</STRONG>,  the  maximum value of
194        these pre-defined requests.
195
196
197 </PRE>
198 <H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
199        <STRONG>menu_driver</STRONG> return one of the following error codes:
200
201        <STRONG>E_OK</STRONG> The routine succeeded.
202
203        <STRONG>E_SYSTEM_ERROR</STRONG>
204             System error occurred (see <STRONG>errno</STRONG>).
205
206        <STRONG>E_BAD_ARGUMENT</STRONG>
207             Routine detected an incorrect or  out-of-range  argu-
208             ment.
209
210        <STRONG>E_BAD_STATE</STRONG>
211             Routine was called from an initialization or termina-
212             tion function.
213
214        <STRONG>E_NOT_POSTED</STRONG>
215             The menu has not been posted.
216
217        <STRONG>E_UNKNOWN_COMMAND</STRONG>
218             The menu driver code saw an unknown request code.
219
220        <STRONG>E_NO_MATCH</STRONG>
221             Character failed to match.
222
223        <STRONG>E_REQUEST_DENIED</STRONG>
224             The menu driver could not process the request.
225
226
227 </PRE>
228 <H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
229        <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="menu.3x.html">menu(3x)</A></STRONG>, <STRONG><A HREF="curs_getch.3x.html">curs_getch(3x)</A></STRONG>.
230
231
232 </PRE>
233 <H2><a name="h2-NOTES">NOTES</a></H2><PRE>
234        The header file <STRONG>&lt;menu.h&gt;</STRONG> automatically includes the header
235        files <STRONG>&lt;curses.h&gt;</STRONG>.
236
237
238 </PRE>
239 <H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
240        These  routines  emulate  the System V menu library.  They
241        were not supported on Version 7 or BSD versions. The  sup-
242        port for mouse events is ncurses specific.
243
244
245 </PRE>
246 <H2><a name="h2-AUTHORS">AUTHORS</a></H2><PRE>
247        Juergen  Pfeifer.   Manual  pages  and  adaptation for new
248        curses by Eric S. Raymond.
249
250
251
252                                                         <STRONG><A HREF="menu_driver.3x.html">menu_driver(3x)</A></STRONG>
253 </PRE>
254 <div class="nav">
255 <ul>
256 <li><a href="#h2-NAME">NAME</a></li>
257 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
258 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a>
259 <ul>
260 <li><a href="#h3-MOUSE-HANDLING">MOUSE HANDLING</a></li>
261 <li><a href="#h3-APPLICATION-DEFINED-COMMANDS">APPLICATION-DEFINED COMMANDS</a></li>
262 </ul>
263 </li>
264 <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>
265 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
266 <li><a href="#h2-NOTES">NOTES</a></li>
267 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
268 <li><a href="#h2-AUTHORS">AUTHORS</a></li>
269 </ul>
270 </div>
271 </BODY>
272 </HTML>