]> ncurses.scripts.mit.edu Git - ncurses.git/blob - Ada95/html/man/menu_driver.3x.html
ncurses 5.0
[ncurses.git] / Ada95 / html / man / menu_driver.3x.html
1 <HTML>
2 <BODY>
3 <PRE>
4        <STRONG>menu_driver</STRONG> - command-processing loop of the menu system
5
6
7 </PRE>
8 <H2>SYNOPSIS</H2><PRE>
9        <STRONG>#include</STRONG> <STRONG><menu.h></STRONG>
10        int menu_driver(MENU *menu, int c);
11
12
13 </PRE>
14 <H2>DESCRIPTION</H2><PRE>
15        Once a menu has been posted (displayed), you should funnel
16        input events to it through <STRONG>menu_driver</STRONG>.  This routine  has
17        three  major input cases; either the input is a menu navi-
18        gation request, it's a printable ASCII character or it  is
19        the  KEY_MOUSE special key associated with an mouse event.
20        The menu driver requests are as follows:
21
22        REQ_LEFT_ITEM
23             Move left to an item.
24
25        REQ_RIGHT_ITEM
26             Move right to an item.
27
28        REQ_UP_ITEM
29             Move up to an item.
30
31        REQ_DOWN_ITEM
32             Move down to an item.
33
34        REQ_SCR_ULINE
35             Scroll up a line.
36
37        REQ_SCR_DLINE
38             Scroll down a line.
39
40        REQ_SCR_DPAGE
41             Scroll down a page.
42
43        REQ_SCR_UPAGE
44             Scroll up a page.
45
46        REQ_FIRST_ITEM
47             Move to the first item.
48
49        REQ_LAST_ITEM
50             Move to the last item.
51
52        REQ_NEXT_ITEM
53             Move to the next item.
54
55        REQ_PREV_ITEM
56             Move to the previous item.
57
58        REQ_TOGGLE_ITEM
59             Select/deselect an item.
60             Clear the menu pattern buffer.
61
62        REQ_BACK_PATTERN
63             Delete  the  previous  character  from  the   pattern
64             buffer.
65
66        REQ_NEXT_MATCH
67             Move to the next item matching the pattern match.
68
69        REQ_PREV_MATCH
70             Move to the previous item matching the pattern match.
71
72        If the second argument is a printable ASCII character, the
73        code appends it to the pattern buffer and attempts to move
74        to the next item matching the new pattern.  If there is no
75        such match, <STRONG>menu_driver</STRONG> returns <STRONG>E_NO_MATCH</STRONG> and deletes the
76        appended character from the buffer.
77
78        If the second argument is one  of  the  above  pre-defined
79        requests, the corresponding action is performed.
80
81        If  the  second argument is the KEY_MOUSE special key, the
82        associated mouse event is translated into one of the above
83        pre-defined  requests.   Currently only clicks in the user
84        window (e.g. inside the menu display area or  the  decora-
85        tion  window)  are handled. If you click above the display
86        region of the menu, a REQ_SCR_ULINE is generated,  if  you
87        doubleclick  a  REQ_SCR_UPAGE  is  generated  and  if  you
88        tripleclick a REQ_FIRST_ITEM is generated.  If  you  click
89        below  the  display region of the menu, a REQ_SCR_DLINE is
90        generated, if you doubleclick a REQ_SCR_DPAGE is generated
91        and  if  you  tripleclick a REQ_LAST_ITEM is generated. If
92        you click at an item inside the display area of the  menu,
93        the menu cursor is positioned to that item. If you double-
94        click at  an  item  a  REQ_TOGGLE_ITEM  is  generated  and
95        <STRONG>E_UNKNOWN_COMMAND</STRONG>  is  returned.  This  return value makes
96        sense, because a double click usually means that an  item-
97        specific  action should be returned. It's exactly the pur-
98        pose of this return value to signal  that  an  application
99        specific command should be executed. If a translation into
100        a request was done, <STRONG>menu_driver</STRONG> returns the result of this
101        request.   If  you  clicked outside the user window or the
102        mouse event couldn't be translated into a menu request  an
103        <STRONG>E_REQUEST_DENIED</STRONG> is returned.
104
105        If  the second argument is neither printable ASCII nor one
106        of the above pre-defined menu requests or  KEY_MOUSE,  the
107        drive  assumes  it  is an application-specific command and
108        returns <STRONG>E_UNKNOWN_COMMAND</STRONG>.   Application-defined  commands
109        should  be  defined  relative  to <STRONG>MAX_COMMAND</STRONG>, the maximum
110        value of these pre-defined requests.
111
112        <STRONG>menu_driver</STRONG> return one of the following error codes:
113
114        <STRONG>E_OK</STRONG> The routine succeeded.
115
116        <STRONG>E_SYSTEM_ERROR</STRONG>
117             System error occurred (see <STRONG>errno</STRONG>).
118
119        <STRONG>E_BAD_ARGUMENT</STRONG>
120             Routine detected an incorrect or  out-of-range  argu-
121             ment.
122
123        <STRONG>E_BAD_STATE</STRONG>
124             Routine was called from an initialization or termina-
125             tion function.
126
127        <STRONG>E_NOT_POSTED</STRONG>
128             The menu has not been posted.
129
130        <STRONG>E_UNKNOWN_COMMAND</STRONG>
131             The menu driver code saw an unknown request code.
132
133        <STRONG>E_NO_MATCH</STRONG>
134             Character failed to match.
135
136        <STRONG>E_REQUEST_DENIED</STRONG>
137             The menu driver could not process the request.
138
139
140 </PRE>
141 <H2>SEE ALSO</H2><PRE>
142        <STRONG><A HREF="ncurses.3x.html">curses(3X)</A></STRONG>, <STRONG><A HREF="menu.3x.html">menu(3X)</A></STRONG>.
143
144
145 </PRE>
146 <H2>NOTES</H2><PRE>
147        The header file <STRONG><menu.h></STRONG> automatically includes the header
148        files <STRONG><curses.h></STRONG>.
149
150
151 </PRE>
152 <H2>PORTABILITY</H2><PRE>
153        These  routines  emulate  the System V menu library.  They
154        were not supported on Version 7 or BSD versions. The  sup-
155        port for mouse events is ncurses specific.
156
157
158 </PRE>
159 <H2>AUTHORS</H2><PRE>
160        Juergen  Pfeifer.   Manual  pages  and  adaptation for new
161        curses by Eric S. Raymond.
162
163
164
165
166
167
168
169
170
171
172 </PRE>
173 </BODY>
174 </HTML>