]> ncurses.scripts.mit.edu Git - ncurses.git/blob - doc/html/man/menu_driver.3x.html
ncurses 5.3
[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,2002 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.10 2002/02/16 22:40:59 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
44 </PRE>
45 <H2>NAME</H2><PRE>
46        <STRONG>menu_driver</STRONG> - command-processing loop of the menu system
47
48
49 </PRE>
50 <H2>SYNOPSIS</H2><PRE>
51        <STRONG>#include</STRONG> <STRONG>&lt;menu.h&gt;</STRONG>
52        int menu_driver(MENU *menu, int c);
53
54
55 </PRE>
56 <H2>DESCRIPTION</H2><PRE>
57        Once a menu has been posted (displayed), you should funnel
58        input events to it through <STRONG>menu_driver</STRONG>.  This routine  has
59        three  major input cases; either the input is a menu navi-
60        gation request, it's a printable ASCII character or it  is
61        the  KEY_MOUSE special key associated with an mouse event.
62        The menu driver requests are as follows:
63
64        REQ_LEFT_ITEM
65             Move left to an item.
66
67        REQ_RIGHT_ITEM
68             Move right to an item.
69
70        REQ_UP_ITEM
71             Move up to an item.
72
73        REQ_DOWN_ITEM
74             Move down to an item.
75
76        REQ_SCR_ULINE
77             Scroll up a line.
78
79        REQ_SCR_DLINE
80             Scroll down a line.
81
82        REQ_SCR_DPAGE
83             Scroll down a page.
84
85        REQ_SCR_UPAGE
86             Scroll up a page.
87
88        REQ_FIRST_ITEM
89             Move to the first item.
90
91        REQ_LAST_ITEM
92             Move to the last item.
93
94        REQ_NEXT_ITEM
95             Move to the next item.
96
97        REQ_PREV_ITEM
98             Move to the previous item.
99
100        REQ_TOGGLE_ITEM
101             Select/deselect an item.
102
103        REQ_CLEAR_PATTERN
104             Clear the menu pattern buffer.
105
106        REQ_BACK_PATTERN
107             Delete  the  previous  character  from  the   pattern
108             buffer.
109
110        REQ_NEXT_MATCH
111             Move to the next item matching the pattern match.
112
113        REQ_PREV_MATCH
114             Move to the previous item matching the pattern match.
115
116        If the second argument is a printable ASCII character, the
117        code appends it to the pattern buffer and attempts to move
118        to the next item matching the new pattern.  If there is no
119        such match, <STRONG>menu_driver</STRONG> returns <STRONG>E_NO_MATCH</STRONG> and deletes the
120        appended character from the buffer.
121
122        If the second argument is one  of  the  above  pre-defined
123        requests, the corresponding action is performed.
124
125        If  the  second argument is the KEY_MOUSE special key, the
126        associated mouse event is translated into one of the above
127        pre-defined  requests.   Currently only clicks in the user
128        window (e.g. inside the menu display area or  the  decora-
129        tion  window)  are handled. If you click above the display
130        region of the menu, a REQ_SCR_ULINE is generated,  if  you
131        doubleclick  a  REQ_SCR_UPAGE  is  generated  and  if  you
132        tripleclick a REQ_FIRST_ITEM is generated.  If  you  click
133        below  the  display region of the menu, a REQ_SCR_DLINE is
134        generated, if you doubleclick a REQ_SCR_DPAGE is generated
135        and  if  you  tripleclick a REQ_LAST_ITEM is generated. If
136        you click at an item inside the display area of the  menu,
137        the menu cursor is positioned to that item. If you double-
138        click at  an  item  a  REQ_TOGGLE_ITEM  is  generated  and
139        <STRONG>E_UNKNOWN_COMMAND</STRONG>  is  returned.  This  return value makes
140        sense, because a double click usually means that an  item-
141        specific  action should be returned. It's exactly the pur-
142        pose of this return value to signal  that  an  application
143        specific command should be executed. If a translation into
144        a request was done, <STRONG>menu_driver</STRONG> returns the result of this
145        request.   If  you  clicked outside the user window or the
146        mouse event couldn't be translated into a menu request  an
147        <STRONG>E_REQUEST_DENIED</STRONG> is returned.
148
149        If  the second argument is neither printable ASCII nor one
150        of the above pre-defined menu requests or  KEY_MOUSE,  the
151        drive  assumes  it  is an application-specific command and
152        returns <STRONG>E_UNKNOWN_COMMAND</STRONG>.   Application-defined  commands
153        should  be  defined  relative  to <STRONG>MAX_COMMAND</STRONG>, the maximum
154        value of these pre-defined requests.
155
156
157
158 </PRE>
159 <H2>RETURN VALUE</H2><PRE>
160        <STRONG>menu_driver</STRONG> return one of the following error codes:
161
162        <STRONG>E_OK</STRONG> The routine succeeded.
163
164        <STRONG>E_SYSTEM_ERROR</STRONG>
165             System error occurred (see <STRONG>errno</STRONG>).
166
167        <STRONG>E_BAD_ARGUMENT</STRONG>
168             Routine detected an incorrect or  out-of-range  argu-
169             ment.
170
171        <STRONG>E_BAD_STATE</STRONG>
172             Routine was called from an initialization or termina-
173             tion function.
174
175        <STRONG>E_NOT_POSTED</STRONG>
176             The menu has not been posted.
177
178        <STRONG>E_UNKNOWN_COMMAND</STRONG>
179             The menu driver code saw an unknown request code.
180
181        <STRONG>E_NO_MATCH</STRONG>
182             Character failed to match.
183
184        <STRONG>E_REQUEST_DENIED</STRONG>
185             The menu driver could not process the request.
186
187
188 </PRE>
189 <H2>SEE ALSO</H2><PRE>
190        <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="menu.3x.html">menu(3x)</A></STRONG>.
191
192
193 </PRE>
194 <H2>NOTES</H2><PRE>
195        The header file <STRONG>&lt;menu.h&gt;</STRONG> automatically includes the header
196        files <STRONG>&lt;curses.h&gt;</STRONG>.
197
198
199 </PRE>
200 <H2>PORTABILITY</H2><PRE>
201        These  routines  emulate  the System V menu library.  They
202        were not supported on Version 7 or BSD versions. The  sup-
203        port for mouse events is ncurses specific.
204
205
206 </PRE>
207 <H2>AUTHORS</H2><PRE>
208        Juergen  Pfeifer.   Manual  pages  and  adaptation for new
209        curses by Eric S. Raymond.
210
211
212
213
214
215
216
217
218
219
220
221 </PRE>
222 <HR>
223 <ADDRESS>
224 Man(1) output converted with
225 <a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
226 </ADDRESS>
227 </BODY>
228 </HTML>