1cdk_buttonbox(3) Library Functions Manual cdk_buttonbox(3)
2
3
4
6 cdk_buttonbox - Creates a managed curses buttonbox widget.
7
9 cc [ flag ... ] file ... -lcdk [ library ... ]
10
11 #include <cdk.h>
12
13 int activateCDKButtonbox (
14 CDKBUTTONBOX *buttonbox,
15 chtype * actions);
16
17 void destroyCDKButtonbox (
18 CDKBUTTONBOX *buttonbox);
19
20 void drawCDKButtonbox (
21 CDKBUTTONBOX *buttonbox,
22 boolean box);
23
24 void drawCDKButtonboxButtons (
25 CDKBUTTONBOX *buttonbox);
26
27 void eraseCDKButtonbox (
28 CDKBUTTONBOX *buttonbox);
29
30 boolean getCDKButtonboxBox (
31 CDKBUTTONBOX *buttonbox);
32
33 int getCDKButtonboxButtonCount (
34 CDKBUTTONBOX *buttonbox);
35
36 int getCDKButtonboxCurrentButton (
37 CDKBUTTONBOX *buttonbox);
38
39 chtype getCDKButtonboxHighlight (
40 CDKBUTTONBOX *buttonbox);
41
42 int injectCDKButtonbox (
43 CDKBUTTONBOX *buttonbox,
44 chtype input);
45
46 void moveCDKButtonbox (
47 CDKBUTTONBOX *buttonbox,
48 int xpos,
49 int ypos,
50 boolean relative,
51 boolean refresh);
52
53 CDKBUTTONBOX *newCDKButtonbox (
54 CDKSCREEN *cdkscreen,
55 int xpos,
56 int ypos,
57 int height,
58 int width,
59 const char * title,
60 int rows,
61 int cols,
62 CDK_CONST char ** buttons,
63 int buttonCount,
64 chtype highlight,
65 boolean box,
66 boolean shadow);
67
68 void positionCDKButtonbox (
69 CDKBUTTONBOX *buttonbox);
70
71 void setCDKButtonbox (
72 CDKBUTTONBOX *buttonbox,
73 chtype highlight,
74 boolean box);
75
76 void setCDKButtonboxBackgroundAttrib (
77 CDKBUTTONBOX *buttonbox,
78 chtype attribute);
79
80 void setCDKButtonboxBackgroundColor (
81 CDKBUTTONBOX *buttonbox,
82 const char * color);
83
84 void setCDKButtonboxBox (
85 CDKBUTTONBOX *buttonbox,
86 boolean box);
87
88 void setCDKButtonboxBoxAttribute (
89 CDKBUTTONBOX *buttonbox,
90 chtype character);
91
92 void setCDKButtonboxCurrentButton (
93 CDKBUTTONBOX *buttonbox,
94 int button);
95
96 void setCDKButtonboxHighlight (
97 CDKBUTTONBOX *buttonbox,
98 chtype highlight);
99
100 void setCDKButtonboxHorizontalChar (
101 CDKBUTTONBOX *buttonbox,
102 chtype character);
103
104 void setCDKButtonboxLLChar (
105 CDKBUTTONBOX *buttonbox,
106 chtype character);
107
108 void setCDKButtonboxLRChar (
109 CDKBUTTONBOX *buttonbox,
110 chtype character);
111
112 void setCDKButtonboxPostProcess (
113 CDKBUTTONBOX *buttonbox,
114 PROCESSFN callback,
115 void * data);
116
117 void setCDKButtonboxPreProcess (
118 CDKBUTTONBOX *buttonbox,
119 PROCESSFN callback,
120 void * data);
121
122 void setCDKButtonboxULChar (
123 CDKBUTTONBOX *buttonbox,
124 chtype character);
125
126 void setCDKButtonboxURChar (
127 CDKBUTTONBOX *buttonbox,
128 chtype character);
129
130 void setCDKButtonboxVerticalChar (
131 CDKBUTTONBOX *buttonbox,
132 chtype character);
133
135 The Cdk buttonbox widget creates a buttonbox box with a message and a
136 varied number of buttons to choose from. The following functions cre‐
137 ate or manipulate the Cdk buttonbox box widget.
138
140 activateCDKButtonbox
141 activates the buttonbox widget and lets the user interact with the
142 widget.
143
144 · The parameter buttonbox is a pointer to a non-NULL buttonbox
145 widget.
146
147 · If the actions parameter is passed with a non-NULL value, the
148 characters in the array will be injected into the widget.
149
150 To activate the widget interactively pass in a NULL pointer
151 for actions.
152
153 If the character entered into this widget is RETURN or TAB then
154 this function will return a value from 0 to the number of buttons
155 -1, representing the button selected. It will also set the widget
156 data exitType to vNORMAL.
157
158 If the character entered into this widget was ESCAPE then the wid‐
159 get will return a value of -1 and the widget data exitType will be
160 set to vESCAPE_HIT.
161
162 destroyCDKButtonbox
163 removes the widget from the screen and releases any memory the
164 object used.
165
166 drawCDKButtonbox
167 draws the buttonbox widget on the screen.
168
169 If the box parameter is true, the widget is drawn with a box.
170
171 drawCDKButtonboxButtons
172 draws the buttons.
173
174 eraseCDKButtonbox
175 removes the widget from the screen. This does NOT destroy the
176 widget.
177
178 getCDKButtonboxBox
179 returns true if the widget will be drawn with a box around it.
180
181 getCDKButtonboxButtonCount
182 returns the number of buttons in the button box.
183
184 getCDKButtonboxCurrentButton
185 returns the current button-number.
186
187 getCDKButtonboxHighlight
188 returns the highlight attribute of the widget.
189
190 injectCDKButtonbox
191 injects a single character into the widget.
192
193 · The parameter buttonbox is a pointer to a non-NULL buttonbox
194 widget.
195
196 · The parameter character is the character to inject into the
197 widget.
198
199 The return value and side-effect (setting the widget data exit‐
200 Type) depend upon the injected character:
201
202 RETURN or TAB
203 the function returns a value ranging from zero to one less
204 than the number of buttons, representing the button
205 selected. The widget data exitType is set to vNORMAL.
206
207 ESCAPE the function returns -1. vESCAPE_HIT. The widget data
208 exitType is set to vESCAPE_HIT.
209
210 Otherwise
211 unless modified by preprocessing, postprocessing or key
212 bindings, the function returns -1. The widget data exit‐
213 Type is set to vEARLY_EXIT.
214
215 moveCDKButtonbox
216 moves the given widget to the given position.
217
218 · The parameters xpos and ypos are the new position of the wid‐
219 get.
220
221 The parameter xpos may be an integer or one of the pre-defined
222 values TOP, BOTTOM, and CENTER.
223
224 The parameter ypos may be an integer or one of the pre-defined
225 values LEFT, RIGHT, and CENTER.
226
227 · The parameter relative states whether the xpos/ypos pair is a
228 relative move or an absolute move.
229
230 For example, if xpos = 1 and ypos = 2 and relative = TRUE,
231 then the widget would move one row down and two columns right.
232 If the value of relative was FALSE, then the widget would move
233 to the position (1,2).
234
235 Do not use the values TOP, BOTTOM, LEFT, RIGHT, or CENTER when
236 relative = TRUE. (weird things may happen).
237
238 · The final parameter refresh is a boolean value which states
239 whether the widget will get refreshed after the move.
240
241 newCDKButtonbox
242 creates a pointer to a buttonbox widget. Parameters:
243
244 screen
245 is the screen you wish this widget to be placed in.
246
247 xpos controls the placement of the object along the horizontal
248 axis. It may be an integer or one of the pre-defined values
249 LEFT, RIGHT, and CENTER.
250
251 ypos controls the placement of the object along the vertical axis.
252 It be an integer value or one of the pre-defined values TOP,
253 BOTTOM, and CENTER.
254
255 height and
256
257 width
258 control the height and width of the widget.
259
260 title
261 is the title of the widget.
262
263 rows is the number of rows of buttons.
264
265 cols sets the number of columns.
266
267 buttons
268 is an array containing the button labels.
269
270 buttonCount
271 is the number of elements in the buttons array.
272
273 highlight
274 is the attribute of the currently highlighted button.
275
276 box is true if the widget should be drawn with a box around it.
277
278 shadow
279 turns the shadow on or off around this widget.
280
281 If the widget could not be created then a NULL pointer is
282 returned.
283
284 positionCDKButtonbox
285 allows the user to move the widget around the screen via the cur‐
286 sor/keypad keys. See cdk_position (3) for key bindings.
287
288 setCDKButtonbox
289 lets the programmer modify certain elements of an existing button‐
290 box widget.
291
292 The parameter names correspond to the same parameter names listed
293 in the newCDKButtonbox function.
294
295 setCDKButtonboxBackgroundAttrib
296 sets the background attribute of the widget.
297
298 The parameter attribute is a curses attribute, e.g., A_BOLD.
299
300 setCDKButtonboxBackgroundColor
301 sets the background color of the widget.
302
303 The parameter color is in the format of the Cdk format strings.
304 (See cdk_display).
305
306 setCDKButtonboxBox
307 sets true if the widget will be drawn with a box around it.
308
309 setCDKButtonboxBoxAttribute
310 sets the attribute of the box.
311
312 setCDKButtonboxCurrentButton
313 sets the current button-number for the box.
314
315 setCDKButtonboxHighlight
316 sets the highlight attribute of the selected button.
317
318 setCDKButtonboxHorizontalChar
319 sets the horizontal drawing character for the box to the given
320 character.
321
322 setCDKButtonboxLLChar
323 sets the lower left hand corner of the widget's box to the given
324 character.
325
326 setCDKButtonboxLRChar
327 sets the lower right hand corner of the widget's box to the given
328 character.
329
330 setCDKButtonboxPostProcess
331 allows the user to have the widget call a function after the key
332 has been applied to the widget.
333
334 The parameter function is the callback function. (See
335 cdk_process).
336
337 setCDKButtonboxPreProcess
338 allows the user to have the widget call a function after a key is
339 hit and before the key is applied to the widget.
340
341 The parameter function is the callback function. (See
342 cdk_process).
343
344 setCDKButtonboxULChar
345 sets the upper left hand corner of the widget's box to the given
346 character.
347
348 setCDKButtonboxURChar
349 sets the upper right hand corner of the widget's box to the given
350 character.
351
352 setCDKButtonboxVerticalChar
353 sets the vertical drawing character for the box to the given char‐
354 acter.
355
357 When the widget is activated there are several default key bindings
358 which will help the user enter or manipulate the information quickly.
359 The following table outlines the keys and their actions for this wid‐
360 get.
361
362 ┌────────────────────┬─────────────────────────────────────┐
363 │Key Action │ │
364 ├────────────────────┼─────────────────────────────────────┤
365 ├────────────────────┼─────────────────────────────────────┤
366 │Left Arrow │ Selects the button to the left of │
367 │ │ the current button. │
368 ├────────────────────┼─────────────────────────────────────┤
369 │Right Arrow │ Selects the button to the right of │
370 │ │ the current button. │
371 ├────────────────────┼─────────────────────────────────────┤
372 │Tab │ Selects the button to the right of │
373 │ │ the current button. │
374 ├────────────────────┼─────────────────────────────────────┤
375 │Space │ Selects the button to the right of │
376 │ │ the current button. │
377 ├────────────────────┼─────────────────────────────────────┤
378 │Return │ Exits the widget and returns the │
379 │ │ index of the selected button. This │
380 │ │ also sets the widget data exitType │
381 │ │ to vNORMAL. │
382 ├────────────────────┼─────────────────────────────────────┤
383 │Tab │ Exits the widget and returns the │
384 │ │ index of the selected button. This │
385 │ │ also sets the widget data exitType │
386 │ │ to vNORMAL. │
387 ├────────────────────┼─────────────────────────────────────┤
388 │Escape │ Exits the widget and returns -1. │
389 │ │ This also sets the widget data │
390 │ │ exitType to vESCAPE_HIT. │
391 ├────────────────────┼─────────────────────────────────────┤
392 │Ctrl-L │ Refreshes the screen. │
393 └────────────────────┴─────────────────────────────────────┘
395 cdk(3), cdk_binding(3), cdk_display(3), cdk_position(3),
396 cdk_process(3), cdk_screen(3)
397
398
399
400 cdk_buttonbox(3)