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