1cdk_menu(3) Library Functions Manual cdk_menu(3)
2
3
4
6 cdk_menu - curses menu widget
7
9 cc [ flag ... ] file ... -lcdk [ library ... ]
10
11 #include <cdk.h>
12
13 int activateCDKMenu (
14 CDKMENU *menu,
15 chtype * actions);
16
17 void destroyCDKMenu (
18 CDKMENU *menu);
19
20 void drawCDKMenu (
21 CDKMENU *menu,
22 boolean box);
23
24 void drawCDKMenuSubwin (
25 CDKMENU *menu);
26
27 void eraseCDKMenu (
28 CDKMENU *menu);
29
30 void eraseCDKMenuSubwin (
31 CDKMENU *menu);
32
33 void getCDKMenuCurrentItem (
34 CDKMENU *menu,
35 int *menuItem,
36 int *submenuItem);
37
38 chtype getCDKMenuSubTitleHighlight (
39 CDKMENU *menu);
40
41 chtype getCDKMenuTitleHighlight (
42 CDKMENU *menu);
43
44 int injectCDKMenu (
45 CDKMENU *menu,
46 chtype input);
47
48 CDKMENU *newCDKMenu (
49 CDKSCREEN *cdkscreen,
50 char *menulist[MAX_MENU_ITEMS][MAX_SUB_ITEMS],
51 int menuListLength,
52 int *submenuListLength,
53 int *menuLocation,
54 int menuPos,
55 chtype titleAttribute,
56 chtype subtitleAttribute);
57
58 void setCDKMenu (
59 CDKMENU *menu,
60 int menuItem,
61 int submenuItem,
62 chtype titleAttribute,
63 chtype subtitleAttribute);
64
65 void setCDKMenuBackgroundAttrib (
66 CDKMENU *menu,
67 chtype attribute);
68
69 void setCDKMenuBackgroundColor (
70 CDKMENU *menu,
71 char * color);
72
73 void setCDKMenuCurrentItem (
74 CDKMENU *menu,
75 int menuItem,
76 int submenuItem);
77
78 void setCDKMenuPostProcess (
79 CDKMENU *menu,
80 PROCESSFN callback,
81 void * data);
82
83 void setCDKMenuPreProcess (
84 CDKMENU *menu,
85 PROCESSFN callback,
86 void * data);
87
88 void setCDKMenuSubTitleHighlight (
89 CDKMENU *menu,
90 chtype highlight);
91
92 void setCDKMenuTitleHighlight (
93 CDKMENU *menu,
94 chtype highlight);
95
97 The Cdk menu widget creates a pull-down menu list. The following are
98 functions which create or manipulate the Cdk menu widget.
99
101 activateCDKMenu
102 activates the menu widget and lets the user interact with the wid‐
103 get. The parameter menu is a pointer to a non-NULL menu widget.
104 If the actions parameter is passed with a non-NULL value, the
105 characters in the array will be injected into the widget. To
106 activate the widget interactively pass in a NULL pointer for
107 actions. If the character entered into this widget is RETURN then
108 this then this function returns an integer which is a value of the
109 current menu list * 100 + the sub-menu number. It will also set
110 the widget data exitType to vNORMAL. If the character entered
111 into this widget was ESCAPE then the widget will return a value of
112 -1 and the widget data exitType will be set to vESCAPE_HIT.
113
114 destroyCDKMenu
115 removes the widget from the screen and frees memory the object
116 used.
117
118 drawCDKMenu
119 draws the menu widget on the screen. If the box parameter is
120 true, the widget is drawn with a box.
121
122 drawCDKMenuSubwin
123 draws the menu item subwindow.
124
125 eraseCDKMenu
126 removes the widget from the screen. This does NOT destroy the
127 widget.
128
129 eraseCDKMenuSubwin
130 erases the menu item subwindow.
131
132 getCDKMenuCurrentItem
133 returns the values menuItem and submenuItem to the current menu
134 selection.
135
136 getCDKMenuSubTitleHighlight
137 returns the highlight attribute of the sub-menu selection bar.
138
139 getCDKMenuTitleHighlight
140 returns the highlight attributes of the menu title.
141
142 injectCDKMenu
143 injects a single character into the widget. The parameter menu is
144 a pointer to a non-NULL menu widget. The parameter character is
145 the character to inject into the widget. The return value and
146 side-effect (setting the widget data exitType) depend upon the
147 injected character:
148
149 RETURN or TAB
150 the function returns the current menu list * 100 + the sub-
151 menu number. The widget data exitType is set to vNORMAL.
152
153 ESCAPE the function returns -1. to vESCAPE_HIT. The widget data
154 exitType is set to vESCAPE_HIT.
155
156 Otherwise
157 unless modified by preprocessing, postprocessing or key
158 bindings, the function returns -1. The widget data exit‐
159 Type is set to vEARLY_EXIT.
160
161 newCDKMenu
162 creates a menu widget and returns a pointer to it. Parameters:
163
164 screen
165 is the screen you wish this widget to be placed in.
166
167 menuList
168 is a list of the menu list titles.
169
170 menuListLength
171 is the number of pull down menus.
172
173 submenuListLength
174 is the number of menu items under each menu list.
175
176 menuLocation
177 tells where each menu is to be located. Valid values are
178 LEFT and RIGHT.
179
180 menuPos
181 tells whether the menu is to be on the top of the screen or
182 the bottom. Valid values are TOP and BOTTOM.
183
184 titleAttribute and
185
186 subtitleAttribute
187 are the character attributes of the title and sub-titles
188 respectively.
189
190 If the widget could not be created then a NULL pointer is
191 returned.
192
193 setCDKMenu
194 lets the programmer modify certain elements of an existing menu
195 widget. The parameters menuItem and submenuItem set which menu
196 list and sub-menu item are going to be highlighted when the widget
197 is activated. The other parameter names correspond to the same
198 parameter names listed in the newCDKMenu function.
199
200 setCDKMenuBackgroundAttrib
201 sets the background attribute of the widget. The parameter
202 attribute is a curses attribute, e.g., A_BOLD.
203
204 setCDKMenuBackgroundColor
205 sets the background color of the widget. The parameter color is
206 in the format of the Cdk format strings. See cdk_display (3).
207
208 setCDKMenuCurrentItem
209 sets the current item in the menu widget.
210
211 setCDKMenuPostProcess
212 allows the user to have the widget call a function after the key
213 has been applied to the widget. The parameter function is the
214 callback function. The parameter data points to data passed to
215 the callback function. To learn more about post-processing see
216 cdk_process [4m(3).
217
218 setCDKMenuPreProcess
219 allows the user to have the widget call a function after a key is
220 hit and before the key is applied to the widget. The parameter
221 function is the callback function. The parameter data points to
222 data passed to the callback function. To learn more about pre-
223 processing see cdk_process [4m(3).
224
225 setCDKMenuSubTitleHighlight
226 sets the highlight attribute of the sub-menu selection bar.
227
228 setCDKMenuTitleHighlight
229 sets the highlight attributes of the menu title.
230
232 When the widget is activated there are several default key bindings
233 which will help the user enter or manipulate the information quickly.
234 The following table outlines the keys and their actions for this wid‐
235 get.
236
237 ┌────────────────┬─────────────────────────────────────┐
238 │Key │ Action │
239 ├────────────────┼─────────────────────────────────────┤
240 │Left Arrow │ Highlights the menu list to the │
241 │ │ left of the current menu. │
242 ├────────────────┼─────────────────────────────────────┤
243 │Right Arrow │ Highlights the menu list to the │
244 │ │ right of the current menu. │
245 ├────────────────┼─────────────────────────────────────┤
246 │Up Arrow │ Moves the current menu selection up │
247 │ │ one. │
248 ├────────────────┼─────────────────────────────────────┤
249 │Down Arrow │ Moves the current menu selection │
250 │ │ down one. │
251 ├────────────────┼─────────────────────────────────────┤
252 │Space │ Moves the current menu selection │
253 │ │ down one. │
254 ├────────────────┼─────────────────────────────────────┤
255 │Tab │ Highlights the menu list to the │
256 │ │ right of the current menu. │
257 ├────────────────┼─────────────────────────────────────┤
258 │Return │ Exits the widget and returns the │
259 │ │ index of the selected item. This │
260 │ │ also sets the widget data exitType │
261 │ │ to vNORMAL. │
262 ├────────────────┼─────────────────────────────────────┤
263 │Escape │ Exits the widget and returns -1. │
264 │ │ This also sets the widget data │
265 │ │ exitType to vESCAPE_HIT. │
266 ├────────────────┼─────────────────────────────────────┤
267 │Ctrl-L │ Refreshes the screen. │
268 └────────────────┴─────────────────────────────────────┘
270 cdk(3), cdk_binding(3), cdk_display(3), cdk_screen(3)
271
272
273
274 cdk_menu(3)