]> ncurses.scripts.mit.edu Git - ncurses.git/blob - doc/html/man/menu_driver.3x.html
ncurses 5.0
[ncurses.git] / doc / html / man / menu_driver.3x.html
1 <HTML>
2 <BODY>
3 <PRE>
4 <!-- Manpage converted by man2html 3.0.1 -->
5
6 </PRE>
7 <H2>NAME</H2><PRE>
8        <B>menu_driver</B> - command-processing loop of the menu system
9
10
11 </PRE>
12 <H2>SYNOPSIS</H2><PRE>
13        <B>#include</B> <B>&lt;menu.h&gt;</B>
14        int menu_driver(MENU *menu, int c);
15
16
17 </PRE>
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:
25
26        REQ_LEFT_ITEM
27             Move left to an item.
28
29        REQ_RIGHT_ITEM
30             Move right to an item.
31
32        REQ_UP_ITEM
33             Move up to an item.
34
35        REQ_DOWN_ITEM
36             Move down to an item.
37
38        REQ_SCR_ULINE
39             Scroll up a line.
40
41        REQ_SCR_DLINE
42             Scroll down a line.
43
44        REQ_SCR_DPAGE
45             Scroll down a page.
46
47        REQ_SCR_UPAGE
48             Scroll up a page.
49
50        REQ_FIRST_ITEM
51             Move to the first item.
52
53        REQ_LAST_ITEM
54             Move to the last item.
55
56        REQ_NEXT_ITEM
57             Move to the next item.
58
59        REQ_PREV_ITEM
60             Move to the previous item.
61
62        REQ_TOGGLE_ITEM
63             Select/deselect an item.
64
65        REQ_CLEAR_PATTERN
66             Clear the menu pattern buffer.
67
68        REQ_BACK_PATTERN
69             Delete  the  previous  character  from  the   pattern
70             buffer.
71
72        REQ_NEXT_MATCH
73             Move to the next item matching the pattern match.
74
75        REQ_PREV_MATCH
76             Move to the previous item matching the pattern match.
77
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.
83
84        If the second argument is one  of  the  above  pre-defined
85        requests, the corresponding action is performed.
86
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.
110
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.
117
118
119
120 </PRE>
121 <H2>RETURN VALUE</H2><PRE>
122        <B>menu_driver</B> return one of the following error codes:
123
124        <B>E_OK</B> The routine succeeded.
125
126        <B>E_SYSTEM_ERROR</B>
127             System error occurred (see <B>errno</B>).
128
129        <B>E_BAD_ARGUMENT</B>
130             Routine detected an incorrect or  out-of-range  argu-
131             ment.
132
133        <B>E_BAD_STATE</B>
134             Routine was called from an initialization or termina-
135             tion function.
136
137        <B>E_NOT_POSTED</B>
138             The menu has not been posted.
139
140        <B>E_UNKNOWN_COMMAND</B>
141             The menu driver code saw an unknown request code.
142
143        <B>E_NO_MATCH</B>
144             Character failed to match.
145
146        <B>E_REQUEST_DENIED</B>
147             The menu driver could not process the request.
148
149
150 </PRE>
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>.
153
154
155 </PRE>
156 <H2>NOTES</H2><PRE>
157        The header file <B>&lt;menu.h&gt;</B> automatically includes the header
158        files <B>&lt;curses.h&gt;</B>.
159
160
161 </PRE>
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.
166
167
168 </PRE>
169 <H2>AUTHORS</H2><PRE>
170        Juergen  Pfeifer.   Manual  pages  and  adaptation for new
171        curses by Eric S. Raymond.
172
173
174
175
176
177
178
179
180
181
182
183 </PRE>
184 <HR>
185 <ADDRESS>
186 Man(1) output converted with
187 <a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
188 </ADDRESS>
189 </BODY>
190 </HTML>