]> ncurses.scripts.mit.edu Git - ncurses.git/blob - doc/html/man/menu_driver.3x.html
ncurses 6.0 - patch 20170318
[ncurses.git] / doc / html / man / menu_driver.3x.html
1 <!-- 
2   ****************************************************************************
3   * Copyright (c) 1998-2010,2017 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.21 2017/01/07 19:25:15 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 class="no-header">menu_driver 3x</H1>
42 <PRE>
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><H2><a name="h2-NAME">NAME</a></H2><PRE>
49        <STRONG>menu_driver</STRONG> - command-processing loop of the menu system
50
51
52 </PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
53        <STRONG>#include</STRONG> <STRONG>&lt;menu.h&gt;</STRONG>
54        int menu_driver(MENU *menu, int c);
55
56
57 </PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
58        Once a menu has been posted (displayed), you should funnel
59        input events to it through <STRONG>menu_driver</STRONG>.  This routine  has
60        three major input cases:
61
62        <STRONG>o</STRONG>   The  input  is  a form navigation request.  Navigation
63            request codes are constants defined in <STRONG>&lt;form.h&gt;</STRONG>, which
64            are   distinct  from  the  key-  and  character  codes
65            returned by <STRONG><A HREF="curs_getch.3x.html">wgetch(3x)</A></STRONG>.
66
67        <STRONG>o</STRONG>   The input is a printable character.  Printable charac-
68            ters  (which  must  be  positive,  less  than 256) are
69            checked according to the program's locale settings.
70
71        <STRONG>o</STRONG>   The input is the KEY_MOUSE special key associated with
72            an mouse event.
73
74        The menu driver requests are as follows:
75
76        REQ_LEFT_ITEM
77             Move left to an item.
78
79        REQ_RIGHT_ITEM
80             Move right to an item.
81
82        REQ_UP_ITEM
83             Move up to an item.
84
85        REQ_DOWN_ITEM
86             Move down to an item.
87
88        REQ_SCR_ULINE
89             Scroll up a line.
90
91        REQ_SCR_DLINE
92             Scroll down a line.
93
94        REQ_SCR_DPAGE
95             Scroll down a page.
96
97        REQ_SCR_UPAGE
98             Scroll up a page.
99
100        REQ_FIRST_ITEM
101             Move to the first item.
102
103        REQ_LAST_ITEM
104             Move to the last item.
105
106        REQ_NEXT_ITEM
107             Move to the next item.
108
109        REQ_PREV_ITEM
110             Move to the previous item.
111
112        REQ_TOGGLE_ITEM
113             Select/deselect an item.
114
115        REQ_CLEAR_PATTERN
116             Clear the menu pattern buffer.
117
118        REQ_BACK_PATTERN
119             Delete  the  previous character from the pattern buf-
120             fer.
121
122        REQ_NEXT_MATCH
123             Move to the next item matching the pattern match.
124
125        REQ_PREV_MATCH
126             Move to the previous item matching the pattern match.
127
128        If the second argument is a printable character, the  code
129        appends  it  to the pattern buffer and attempts to move to
130        the next item matching the new pattern.  If  there  is  no
131        such match, <STRONG>menu_driver</STRONG> returns <STRONG>E_NO_MATCH</STRONG> and deletes the
132        appended character from the buffer.
133
134        If the second argument is one  of  the  above  pre-defined
135        requests, the corresponding action is performed.
136
137
138 </PRE><H3><a name="h3-MOUSE-HANDLING">MOUSE HANDLING</a></H3><PRE>
139        If  the  second argument is the KEY_MOUSE special key, the
140        associated mouse event is translated into one of the above
141        pre-defined  requests.   Currently only clicks in the user
142        window (e.g., inside the menu display area or the  decora-
143        tion window) are handled.
144
145        If you click above the display region of the menu:
146
147        <STRONG>o</STRONG>   a REQ_SCR_ULINE is generated for a single click,
148
149        <STRONG>o</STRONG>   a REQ_SCR_UPAGE is generated for a double-click and
150
151        <STRONG>o</STRONG>   a REQ_FIRST_ITEM is generated for a triple-click.
152
153        If you click below the display region of the menu:
154
155        <STRONG>o</STRONG>   a REQ_SCR_DLINE is generated for a single click,
156
157        <STRONG>o</STRONG>   a REQ_SCR_DPAGE is generated for a double-click and
158
159        <STRONG>o</STRONG>   a REQ_LAST_ITEM is generated for a triple-click.
160
161        If  you  click  at  an item inside the display area of the
162        menu:
163
164        <STRONG>o</STRONG>   the menu cursor is positioned to that item.
165
166        <STRONG>o</STRONG>   If you double-click an item a REQ_TOGGLE_ITEM is  gen-
167            erated and <STRONG>E_UNKNOWN_COMMAND</STRONG> is returned.  This return
168            value makes sense,  because  a  double  click  usually
169            means that an item-specific action should be returned.
170            It is exactly the purpose of this return value to sig-
171            nal  that  an  application  specific command should be
172            executed.
173
174        <STRONG>o</STRONG>   If a translation into a request was done,  <STRONG>menu_driver</STRONG>
175            returns the result of this request.
176
177        If  you clicked outside the user window or the mouse event
178        could  not  be  translated  into   a   menu   request   an
179        <STRONG>E_REQUEST_DENIED</STRONG> is returned.
180
181
182 </PRE><H3><a name="h3-APPLICATION-DEFINED-COMMANDS">APPLICATION-DEFINED COMMANDS</a></H3><PRE>
183        If the second argument is neither printable nor one of the
184        above pre-defined menu requests or  KEY_MOUSE,  the  drive
185        assumes  it is an application-specific command and returns
186        <STRONG>E_UNKNOWN_COMMAND</STRONG>.  Application-defined commands should be
187        defined  relative  to  <STRONG>MAX_COMMAND</STRONG>,  the  maximum value of
188        these pre-defined requests.
189
190
191 </PRE><H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
192        <STRONG>menu_driver</STRONG> return one of the following error codes:
193
194        <STRONG>E_OK</STRONG> The routine succeeded.
195
196        <STRONG>E_SYSTEM_ERROR</STRONG>
197             System error occurred (see <STRONG>errno</STRONG>).
198
199        <STRONG>E_BAD_ARGUMENT</STRONG>
200             Routine detected an incorrect or  out-of-range  argu-
201             ment.
202
203        <STRONG>E_BAD_STATE</STRONG>
204             Routine was called from an initialization or termina-
205             tion function.
206
207        <STRONG>E_NOT_POSTED</STRONG>
208             The menu has not been posted.
209
210        <STRONG>E_UNKNOWN_COMMAND</STRONG>
211             The menu driver code saw an unknown request code.
212
213        <STRONG>E_NO_MATCH</STRONG>
214             Character failed to match.
215
216        <STRONG>E_REQUEST_DENIED</STRONG>
217             The menu driver could not process the request.
218
219
220 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
221        <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">getch(3x)</A></STRONG>.
222
223
224 </PRE><H2><a name="h2-NOTES">NOTES</a></H2><PRE>
225        The header file <STRONG>&lt;menu.h&gt;</STRONG> automatically includes the header
226        files <STRONG>&lt;curses.h&gt;</STRONG>.
227
228
229 </PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
230        These  routines  emulate  the System V menu library.  They
231        were not supported on Version 7 or BSD versions. The  sup-
232        port for mouse events is ncurses specific.
233
234
235 </PRE><H2><a name="h2-AUTHORS">AUTHORS</a></H2><PRE>
236        Juergen  Pfeifer.   Manual  pages  and  adaptation for new
237        curses by Eric S. Raymond.
238
239
240
241                                                         <STRONG><A HREF="menu_driver.3x.html">menu_driver(3x)</A></STRONG>
242 </PRE>
243 <div class="nav">
244 <ul>
245 <li><a href="#h2-NAME">NAME</a></li>
246 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
247 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a>
248 <ul>
249 <li><a href="#h3-MOUSE-HANDLING">MOUSE HANDLING</a></li>
250 <li><a href="#h3-APPLICATION-DEFINED-COMMANDS">APPLICATION-DEFINED COMMANDS</a></li>
251 </ul>
252 </li>
253 <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>
254 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
255 <li><a href="#h2-NOTES">NOTES</a></li>
256 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
257 <li><a href="#h2-AUTHORS">AUTHORS</a></li>
258 </ul>
259 </div>
260 </BODY>
261 </HTML>