4 <!-- Manpage converted by man2html 3.0.1 -->
8 <B>menu_driver</B> - command-processing loop of the menu system
12 <H2>SYNOPSIS</H2><PRE>
13 <B>#include</B> <B><menu.h></B>
14 int menu_driver(MENU *menu, int c);
18 <H2>DESCRIPTION</H2><PRE>
19 Once a menu has been posted (displayed), you should funnel
20 input events to it through <B>menu_driver</B>. This routine has
21 three major input cases; either the input is a menu navi-
22 gation request, it's a printable ASCII character or it is
23 the KEY_MOUSE special key associated with an mouse event.
24 The menu driver requests are as follows:
30 Move right to an item.
51 Move to the first item.
54 Move to the last item.
57 Move to the next item.
60 Move to the previous item.
63 Select/deselect an item.
66 Clear the menu pattern buffer.
69 Delete the previous character from the pattern
73 Move to the next item matching the pattern match.
76 Move to the previous item matching the pattern match.
78 If the second argument is a printable ASCII character, the
79 code appends it to the pattern buffer and attempts to move
80 to the next item matching the new pattern. If there is no
81 such match, <B>menu_driver</B> returns <B>E_NO_MATCH</B> and deletes the
82 appended character from the buffer.
84 If the second argument is one of the above pre-defined
85 requests, the corresponding action is performed.
87 If the second argument is the KEY_MOUSE special key, the
88 associated mouse event is translated into one of the above
89 pre-defined requests. Currently only clicks in the user
90 window (e.g. inside the menu display area or the decora-
91 tion window) are handled. If you click above the display
92 region of the menu, a REQ_SCR_ULINE is generated, if you
93 doubleclick a REQ_SCR_UPAGE is generated and if you
94 tripleclick a REQ_FIRST_ITEM is generated. If you click
95 below the display region of the menu, a REQ_SCR_DLINE is
96 generated, if you doubleclick a REQ_SCR_DPAGE is generated
97 and if you tripleclick a REQ_LAST_ITEM is generated. If
98 you click at an item inside the display area of the menu,
99 the menu cursor is positioned to that item. If you double-
100 click at an item a REQ_TOGGLE_ITEM is generated and
101 <B>E_UNKNOWN_COMMAND</B> is returned. This return value makes
102 sense, because a double click usually means that an item-
103 specific action should be returned. It's exactly the pur-
104 pose of this return value to signal that an application
105 specific command should be executed. If a translation into
106 a request was done, <B>menu_driver</B> returns the result of this
107 request. If you clicked outside the user window or the
108 mouse event couldn't be translated into a menu request an
109 <B>E_REQUEST_DENIED</B> is returned.
111 If the second argument is neither printable ASCII nor one
112 of the above pre-defined menu requests or KEY_MOUSE, the
113 drive assumes it is an application-specific command and
114 returns <B>E_UNKNOWN_COMMAND</B>. Application-defined commands
115 should be defined relative to <B>MAX_COMMAND</B>, the maximum
116 value of these pre-defined requests.
121 <H2>RETURN VALUE</H2><PRE>
122 <B>menu_driver</B> return one of the following error codes:
124 <B>E_OK</B> The routine succeeded.
126 <B>E_SYSTEM_ERROR</B>
127 System error occurred (see <B>errno</B>).
129 <B>E_BAD_ARGUMENT</B>
130 Routine detected an incorrect or out-of-range argu-
134 Routine was called from an initialization or termina-
138 The menu has not been posted.
140 <B>E_UNKNOWN_COMMAND</B>
141 The menu driver code saw an unknown request code.
144 Character failed to match.
146 <B>E_REQUEST_DENIED</B>
147 The menu driver could not process the request.
151 <H2>SEE ALSO</H2><PRE>
152 <B><A HREF="ncurses.3x.html">curses(3x)</A></B>, <B><A HREF="menu.3x.html">menu(3x)</A></B>.
157 The header file <B><menu.h></B> automatically includes the header
158 files <B><curses.h></B>.
162 <H2>PORTABILITY</H2><PRE>
163 These routines emulate the System V menu library. They
164 were not supported on Version 7 or BSD versions. The sup-
165 port for mouse events is ncurses specific.
169 <H2>AUTHORS</H2><PRE>
170 Juergen Pfeifer. Manual pages and adaptation for new
171 curses by Eric S. Raymond.
186 Man(1) output converted with
187 <a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>