1cdk_uscale(3) Library Functions Manual cdk_uscale(3)
2
3
4
6 cdk_uscale - curses scale widget (type unsigned).
7
9 cc [ flag ... ] file ... -lcdk [ library ... ]
10
11 #include <cdk.h>
12
13 unsigned activateCDKUScale (
14 CDKUSCALE *scale,
15 chtype *actions);
16
17 void destroyCDKUScale (
18 CDKUSCALE *scale);
19
20 void drawCDKUScale (
21 CDKUSCALE *scale,
22 boolean box);
23
24 void eraseCDKUScale (
25 CDKUSCALE *scale);
26
27 boolean getCDKUScaleBox (
28 CDKUSCALE *scale);
29
30 unsigned getCDKUScaleHighValue (
31 CDKUSCALE *scale);
32
33 unsigned getCDKUScaleLowValue (
34 CDKUSCALE *scale);
35
36 unsigned getCDKUScaleValue (
37 CDKUSCALE *scale);
38
39 int injectCDKUScale (
40 CDKUSCALE *scale,
41 chtype input);
42
43 void moveCDKUScale (
44 CDKUSCALE *scale,
45 int xpos,
46 int ypos,
47 boolean relative,
48 boolean refresh);
49
50 CDKUSCALE *newCDKUScale (
51 CDKSCREEN *cdkscreen,
52 int xpos,
53 int ypos,
54 const char *title,
55 const char *label,
56 chtype fieldAttribute,
57 int fieldWidth,
58 unsigned currentValue,
59 unsigned lowValue,
60 unsigned highValue,
61 unsigned increment,
62 unsigned fastIncrement,
63 boolean box,
64 boolean shadow);
65
66 void positionCDKUScale (
67 CDKUSCALE *scale);
68
69 void setCDKUScale (
70 CDKUSCALE *scale,
71 unsigned lowValue,
72 unsigned highValue,
73 unsigned currentValue,
74 boolean box);
75
76 void setCDKUScaleBackgroundAttrib (
77 CDKUSCALE *scale,
78 chtype attribute);
79
80 void setCDKUScaleBackgroundColor (
81 CDKUSCALE *scale,
82 const char * color);
83
84 void setCDKUScaleBox (
85 CDKUSCALE *scale,
86 boolean box);
87
88 void setCDKUScaleBoxAttribute (
89 CDKUSCALE *scale,
90 chtype character);
91
92 void setCDKUScaleHorizontalChar (
93 CDKUSCALE *scale,
94 chtype character);
95
96 void setCDKUScaleLLChar (
97 CDKUSCALE *scale,
98 chtype character);
99
100 void setCDKUScaleLRChar (
101 CDKUSCALE *scale,
102 chtype character);
103
104 void setCDKUScaleLowHigh (
105 CDKUSCALE *scale,
106 unsigned low,
107 unsigned high);
108
109 void setCDKUScalePostProcess (
110 CDKUSCALE *scale,
111 PROCESSFN callback,
112 void * data);
113
114 void setCDKUScalePreProcess (
115 CDKUSCALE *scale,
116 PROCESSFN callback,
117 void * data);
118
119 void setCDKUScaleULChar (
120 CDKUSCALE *scale,
121 chtype character);
122
123 void setCDKUScaleURChar (
124 CDKUSCALE *scale,
125 chtype character);
126
127 void setCDKUScaleValue (
128 CDKUSCALE *scale,
129 unsigned value);
130
131 void setCDKUScaleVerticalChar (
132 CDKUSCALE *scale,
133 chtype character);
134
136 The Cdk scale widget creates a scale box with a label and a scale
137 field. The following functions create or manipulate the Cdk scale box
138 widget.
139
141 activateCDKUScale
142 activates the scale widget and lets the user interact with the
143 widget.
144
145 · The parameter scale is a pointer to a non-NULL scale 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
154 then this function will return a value from the low value to
155 the high value. It will also set the widget data exitType to
156 vNORMAL.
157
158 If the character entered into this widget was ESCAPE then the
159 widget will return the unknownUnsigned value (see the
160 cdk_objs.h header file).
161
162 The widget data exitType will be set to vESCAPE_HIT.
163
164 destroyCDKUScale
165 removes the widget from the screen and frees memory the object
166 used.
167
168 drawCDKUScale
169 draws the scale widget on the screen.
170
171 If the box parameter is true, the widget is drawn with a box.
172
173 eraseCDKUScale
174 removes the widget from the screen. This does NOT destroy the
175 widget.
176
177 getCDKUScaleBox
178 returns whether the widget will be drawn with a box around it.
179
180 getCDKUScaleHighValue
181 returns the high value of the scale widget.
182
183 getCDKUScaleLowValue
184 returns the low value of the scale widget.
185
186 getCDKUScaleValue
187 returns the current value of the widget.
188
189 injectCDKUScale
190 injects a single character into the widget.
191
192 · The parameter scale is a pointer to a non-NULL scale widget.
193
194 · The parameter character is the character to inject into the
195 widget.
196
197 The return value and side-effect (setting the widget data exit‐
198 Type) depend upon the injected character:
199
200 RETURN or TAB
201 the function returns a value ranging from the scale's low
202 value to the scale's high value. The widget data exitType
203 is set to vNORMAL.
204
205 ESCAPE the function returns the unknownUnsigned value (see the
206 cdk_objs.h header file). The widget data exitType is set
207 to vESCAPE_HIT.
208
209 Otherwise
210 unless modified by preprocessing, postprocessing or key
211 bindings, the function returns the unknownUnsigned value
212 (see the cdk_objs.h header file). The widget data exitType
213 is set to vEARLY_EXIT.
214
215 moveCDKUScale
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). The final param‐
237 eter refresh is a boolean value which states whether the wid‐
238 get will get refreshed after the move.
239
240 newCDKUScale
241 creates a pointer to a scale widget. Parameters:
242
243 screen
244 is the screen you wish this widget to be placed in.
245
246 xpos controls the placement of the object along the horizontal
247 axis. It may be an integer or one of the pre-defined values
248 LEFT, RIGHT, and CENTER.
249
250 ypos controls the placement of the object along the vertical axis.
251 It may be an integer or one of the pre-defined values TOP,
252 BOTTOM, and CENTER.
253
254 title
255 is the string to display at the top of the widget. The title
256 can be more than one line; just provide a carriage return
257 character at the line break.
258
259 label
260 is the string to display in the label of the scale field.
261
262 fieldAttribute
263 is the attribute of the characters displayed in the field.
264
265 fieldWidth
266 controls the width of the widget. If you provide a value of
267 zero the widget will be created with the full width of the
268 screen. If you provide a negative value, the widget will be
269 created the full width minus the value provided.
270
271 currentValue
272 is the value of the scale field when the widget is activated.
273
274 lowValue and
275
276 highValue
277 are the low and high values of the widget respectively.
278
279 increment
280 is the regular increment value
281
282 fastIncrement
283 is the accelerated increment value.
284
285 box is true if the widget should be drawn with a box around it.
286
287 shadow
288 turns the shadow on or off around this widget.
289
290 If the widget could not be created then a NULL pointer is
291 returned.
292
293 positionCDKUScale
294 allows the user to move the widget around the screen via the cur‐
295 sor/keypad keys. See cdk_position (3) for key bindings.
296
297 setCDKUScale
298 lets the programmer modify certain elements of an existing scale
299 widget.
300
301 The parameter names correspond to the same parameter names listed
302 in the newCDKUScale function.
303
304 setCDKUScaleBackgroundAttrib
305 sets the background attribute of the widget.
306
307 The parameter attribute is a curses attribute, e.g., A_BOLD.
308
309 setCDKUScaleBackgroundColor
310 sets the background color of the widget.
311
312 The parameter color is in the format of the Cdk format strings.
313
314 See cdk_display (3).
315
316 setCDKUScaleBox
317 sets whether the widget will be drawn with a box around it.
318
319 setCDKUScaleBoxAttribute
320 sets the attribute of the box.
321
322 setCDKUScaleHorizontalChar
323 sets the horizontal drawing character for the box to the given
324 character.
325
326 setCDKUScaleLLChar
327 sets the lower left hand corner of the widget's box to the given
328 character.
329
330 setCDKUScaleLRChar
331 sets the lower right hand corner of the widget's box to the given
332 character.
333
334 setCDKUScaleLowHigh
335 sets the low and high values of the widget.
336
337 setCDKUScalePostProcess
338 allows the user to have the widget call a function after the key
339 has been applied to the widget.
340
341 · The parameter function is the callback function.
342
343 · The parameter data points to data passed to the callback func‐
344 tion.
345
346 To learn more about post-processing see cdk_process [4m(3).
347
348 setCDKUScalePreProcess
349 allows the user to have the widget call a function after a key is
350 hit and before the key is applied to the widget.
351
352 · The parameter function is the callback function.
353
354 · The parameter data points to data passed to the callback func‐
355 tion.
356
357 To learn more about pre-processing see cdk_process [4m(3).
358
359 setCDKUScaleULChar
360 sets the upper left hand corner of the widget's box to the given
361 character.
362
363 setCDKUScaleURChar
364 sets the upper right hand corner of the widget's box to the given
365 character.
366
367 setCDKUScaleValue
368 sets the current value of the widget.
369
370 setCDKUScaleVerticalChar
371 sets the vertical drawing character for the box to the given char‐
372 acter.
373
375 When the widget is activated there are several default key bindings
376 which will help the user enter or manipulate the information quickly.
377 The following table outlines the keys and their actions for this wid‐
378 get.
379
380 ┌─────────────────────────────────────────────────────────────────────┐
381 │Key Action │
382 ├─────────────────────────────────────────────────────────────────────┤
383 │Down Arrow Decrements the scale by the normal value. │
384 │Up Arrow Increments the scale by the normal value. │
385 │u Increments the scale by the normal value. │
386 │Prev Page Decrements the scale by the accelerated value. │
387 │U Decrements the scale by the accelerated value. │
388 │Ctrl-B Decrements the scale by the accelerated value. │
389 │Next Page Increments the scale by the accelerated value. │
390 │Ctrl-F Increments the scale by the accelerated value. │
391 │Home Sets the scale to the low value. │
392 │g Sets the scale to the low value. │
393 │^ Sets the scale to the low value. │
394 │End Sets the scale to the high value. │
395 │G Sets the scale to the high value. │
396 │$ Sets the scale to the high value. │
397 │Return Exits the widget and returns the index of the │
398 │ selected value. This also sets the widget data │
399 │ exitType to vNORMAL. │
400 │Tab Exits the widget and returns the index of the │
401 │ selected value. This also sets the widget data │
402 │ exitType to vNORMAL. │
403 │Escape Exits the widget and returns the unknownUnsigned │
404 │ value (see the cdk_objs.h header file). This also │
405 │ sets the widget data exitType to vESCAPE_HIT. │
406 │Ctrl-R Refreshes the screen. │
407 └─────────────────────────────────────────────────────────────────────┘
408 If the cursor is not pointing to the field's value, the following key
409 bindings apply. You may use the left/right arrows to move the cursor
410 onto the field's value and modify it by typing characters to replace
411 the digits and sign.
412
413 ┌─────────────────────────────────────────────────────────────────────┐
414 │Key Action │
415 ├─────────────────────────────────────────────────────────────────────┤
416 │Left Arrow Decrements the scale by the normal value. │
417 │Right Arrow Increments the scale by the normal value. │
418 ├─────────────────────────────────────────────────────────────────────┤
419 │d Decrements the scale by the normal value. │
420 │D Increments the scale by the accelerated value. │
421 │- Decrements the scale by the normal value. │
422 │+ Increments the scale by the normal value. │
423 │0 Sets the scale to the low value. │
424 └─────────────────────────────────────────────────────────────────────┘
426 cdk(3), cdk_binding(3), cdk_display(3), cdk_position(3), cdk_screen(3)
427
428
429
430 cdk_uscale(3)