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