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 const 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 const 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.
104
105 · The parameter menu is a pointer to a non-NULL menu widget.
106
107 · If the actions parameter is passed with a non-NULL value, the
108 characters in the array will be injected into the widget.
109
110 To activate the widget interactively pass in a NULL pointer
111 for actions.
112
113 If the character entered into this widget is RETURN then this then
114 this function returns an integer which is a value of the current
115 menu list * 100 + the sub-menu number. It will also set the wid‐
116 get data exitType to vNORMAL.
117
118 If the character entered into this widget was ESCAPE then the wid‐
119 get will return a value of -1 and the widget data exitType will be
120 set to vESCAPE_HIT.
121
122 destroyCDKMenu
123 removes the widget from the screen and frees memory the object
124 used.
125
126 drawCDKMenu
127 draws the menu widget on the screen.
128
129 If the box parameter is true, the widget is drawn with a box.
130
131 drawCDKMenuSubwin
132 draws the menu item subwindow.
133
134 eraseCDKMenu
135 removes the widget from the screen. This does NOT destroy the
136 widget.
137
138 eraseCDKMenuSubwin
139 erases the menu item subwindow.
140
141 getCDKMenuCurrentItem
142 returns the values menuItem and submenuItem to the current menu
143 selection.
144
145 getCDKMenuSubTitleHighlight
146 returns the highlight attribute of the sub-menu selection bar.
147
148 getCDKMenuTitleHighlight
149 returns the highlight attributes of the menu title.
150
151 injectCDKMenu
152 injects a single character into the widget.
153
154 · The parameter menu is a pointer to a non-NULL menu widget.
155
156 · The parameter character is the character to inject into the
157 widget.
158
159 The return value and side-effect (setting the widget data exit‐
160 Type) depend upon the injected character:
161
162 RETURN or TAB
163 the function returns the current menu list * 100 + the sub-
164 menu number. The widget data exitType is set to vNORMAL.
165
166 ESCAPE the function returns -1. to vESCAPE_HIT. The widget data
167 exitType is set to vESCAPE_HIT.
168
169 Otherwise
170 unless modified by preprocessing, postprocessing or key
171 bindings, the function returns -1. The widget data exit‐
172 Type is set to vEARLY_EXIT.
173
174 newCDKMenu
175 creates a menu widget and returns a pointer to it. Parameters:
176
177 screen
178 is the screen you wish this widget to be placed in.
179
180 menuList
181 is a list of the menu list titles.
182
183 menuListLength
184 is the number of pull down menus.
185
186 submenuListLength
187 is the number of menu items under each menu list.
188
189 menuLocation
190 tells where each menu is to be located. Valid values are
191 LEFT and RIGHT.
192
193 menuPos
194 tells whether the menu is to be on the top of the screen or
195 the bottom. Valid values are TOP and BOTTOM.
196
197 titleAttribute and
198
199 subtitleAttribute
200 are the character attributes of the title and sub-titles
201 respectively.
202
203 If the widget could not be created then a NULL pointer is
204 returned.
205
206 setCDKMenu
207 lets the programmer modify certain elements of an existing menu
208 widget.
209
210 · The parameters menuItem and submenuItem set which menu list
211 and sub-menu item are going to be highlighted when the widget
212 is activated.
213
214 · The other parameter names correspond to the same parameter
215 names listed in the newCDKMenu function.
216
217 setCDKMenuBackgroundAttrib
218 sets the background attribute of the widget.
219
220 The parameter attribute is a curses attribute, e.g., A_BOLD.
221
222 setCDKMenuBackgroundColor
223 sets the background color of the widget.
224
225 The parameter color is in the format of the Cdk format strings.
226
227 See cdk_display (3).
228
229 setCDKMenuCurrentItem
230 sets the current item in the menu widget.
231
232 setCDKMenuPostProcess
233 allows the user to have the widget call a function after the key
234 has been applied to the widget.
235
236 · The parameter function is the callback function.
237
238 · The parameter data points to data passed to the callback func‐
239 tion.
240
241 To learn more about post-processing see cdk_process [4m(3).
242
243 setCDKMenuPreProcess
244 allows the user to have the widget call a function after a key is
245 hit and before the key is applied to the widget.
246
247 · The parameter function is the callback function.
248
249 · The parameter data points to data passed to the callback func‐
250 tion.
251
252 To learn more about pre-processing see cdk_process [4m(3).
253
254 setCDKMenuSubTitleHighlight
255 sets the highlight attribute of the sub-menu selection bar.
256
257 setCDKMenuTitleHighlight
258 sets the highlight attributes of the menu title.
259
261 When the widget is activated there are several default key bindings
262 which will help the user enter or manipulate the information quickly.
263 The following table outlines the keys and their actions for this wid‐
264 get.
265
266 ┌────────────────┬─────────────────────────────────────┐
267 │Key │ Action │
268 ├────────────────┼─────────────────────────────────────┤
269 │Left Arrow │ Highlights the menu list to the │
270 │ │ left of the current menu. │
271 ├────────────────┼─────────────────────────────────────┤
272 │Right Arrow │ Highlights the menu list to the │
273 │ │ right of the current menu. │
274 ├────────────────┼─────────────────────────────────────┤
275 │Up Arrow │ Moves the current menu selection up │
276 │ │ one. │
277 ├────────────────┼─────────────────────────────────────┤
278 │Down Arrow │ Moves the current menu selection │
279 │ │ down one. │
280 ├────────────────┼─────────────────────────────────────┤
281 │Space │ Moves the current menu selection │
282 │ │ down one. │
283 ├────────────────┼─────────────────────────────────────┤
284 │Tab │ Highlights the menu list to the │
285 │ │ right of the current menu. │
286 ├────────────────┼─────────────────────────────────────┤
287 │Return │ Exits the widget and returns the │
288 │ │ index of the selected item. This │
289 │ │ also sets the widget data exitType │
290 │ │ to vNORMAL. │
291 ├────────────────┼─────────────────────────────────────┤
292 │Escape │ Exits the widget and returns -1. │
293 │ │ This also sets the widget data │
294 │ │ exitType to vESCAPE_HIT. │
295 ├────────────────┼─────────────────────────────────────┤
296 │Ctrl-L │ Refreshes the screen. │
297 └────────────────┴─────────────────────────────────────┘
299 cdk(3), cdk_binding(3), cdk_display(3), cdk_screen(3)
300
301
302
303 cdk_menu(3)