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 char *title,
58 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 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. The parameter scale is a pointer to a non-NULL scale wid‐
152 get. If the actions parameter is passed with a non-NULL value,
153 the characters in the array will be injected into the widget. To
154 activate the widget interactively pass in a NULL pointer for
155 actions. If the character entered into this widget is RETURN or
156 TAB then this function will return a value from the low value to
157 the high value. It will also set the widget data exitType to
158 vNORMAL. If the character entered into this widget was ESCAPE
159 then the widget will return the unknownFloat value (see the
160 cdk_objs.h header file). The widget data exitType will be set to
161 vESCAPE_HIT.
162
163 destroyCDKFScale
164 removes the widget from the screen and frees memory the object
165 used.
166
167 drawCDKFScale
168 draws the scale widget on the screen. If the box parameter is
169 true, the widget is drawn with a box.
170
171 eraseCDKFScale
172 removes the widget from the screen. This does NOT destroy the
173 widget.
174
175 getCDKFScaleBox
176 returns whether the widget will be drawn with a box around it.
177
178 getCDKFScaleDigits
179 returns the number of digits shown after the decimal point for the
180 box value.
181
182 getCDKFScaleHighValue
183 returns the high value of the scale widget.
184
185 getCDKFScaleLowValue
186 returns the low value of the scale widget.
187
188 getCDKFScaleValue
189 returns the current value of the widget.
190
191 injectCDKFScale
192 injects a single character into the widget. The parameter scale
193 is a pointer to a non-NULL scale widget. The parameter character
194 is the character to inject into the widget. The return value and
195 side-effect (setting the widget data exitType) depend upon the
196 injected character:
197
198 RETURN or TAB
199 the function returns a value ranging from the scale's low
200 value to the scale's high value. The widget data exitType
201 is set to vNORMAL.
202
203 ESCAPE the function returns the unknownFloat value (see the
204 cdk_objs.h header file). The widget data exitType is set
205 to vESCAPE_HIT.
206
207 Otherwise
208 unless modified by preprocessing, postprocessing or key
209 bindings, the function returns the unknownFloat value (see
210 the cdk_objs.h header file). The widget data exitType is
211 set to vEARLY_EXIT.
212
213 moveCDKFScale
214 moves the given widget to the given position. The parameters xpos
215 and ypos are the new position of the widget. The parameter xpos
216 may be an integer or one of the pre-defined values TOP, BOTTOM,
217 and CENTER. The parameter ypos may be an integer or one of the
218 pre-defined values LEFT, RIGHT, and CENTER. The parameter rela‐
219 tive states whether the xpos/ypos pair is a relative move or an
220 absolute move. For example, if xpos = 1 and ypos = 2 and relative
221 = TRUE, then the widget would move one row down and two columns
222 right. If the value of relative was FALSE then the widget would
223 move to the position (1,2). Do not use the values TOP, BOTTOM,
224 LEFT, RIGHT, or CENTER when relative = TRUE. (weird things may
225 happen). The final parameter refresh is a boolean value which
226 states whether the widget will get refreshed after the move.
227
228 newCDKFScale
229 creates a pointer to a scale widget. Parameters:
230
231 screen
232 is the screen you wish this widget to be placed in.
233
234 xpos controls the placement of the object along the horizontal
235 axis. It may be an integer or one of the pre-defined values
236 LEFT, RIGHT, and CENTER.
237
238 ypos controls the placement of the object along the vertical axis.
239 It may be an integer or one of the pre-defined values TOP,
240 BOTTOM, and CENTER.
241
242 title
243 is the string to display at the top of the widget. The title
244 can be more than one line; just provide a carriage return
245 character at the line break.
246
247 label
248 is the string to display in the label of the scale field.
249
250 fieldAttribute
251 is the attribute of the characters displayed in the field.
252
253 fieldWidth
254 controls the width of the widget. If you provide a value of
255 zero the widget will be created with the full width of the
256 screen. If you provide a negative value, the widget will be
257 created the full width minus the value provided.
258
259 currentValue
260 is the value of the scale field when the widget is activated.
261
262 lowValue and
263
264 highValue
265 are the low and high values of the widget respectively.
266
267 increment
268 is the regular increment value
269
270 fastIncrement
271 is the accelerated increment value.
272
273 box is true if the widget should be drawn with a box around it.
274
275 shadow
276 turns the shadow on or off around this widget.
277
278 If the widget could not be created then a NULL pointer is
279 returned.
280
281 positionCDKFScale
282 allows the user to move the widget around the screen via the cur‐
283 sor/keypad keys. See cdk_position (3) for key bindings.
284
285 setCDKFScale
286 lets the programmer modify certain elements of an existing scale
287 widget. The parameter names correspond to the same parameter
288 names listed in the newCDKFScale function.
289
290 setCDKFScaleBackgroundAttrib
291 sets the background attribute of the widget. The parameter
292 attribute is a curses attribute, e.g., A_BOLD.
293
294 setCDKFScaleBackgroundColor
295 sets the background color of the widget. The parameter color is
296 in the format of the Cdk format strings. See cdk_display (3).
297
298 setCDKFScaleBox
299 sets whether the widget will be drawn with a box around it.
300
301 setCDKFScaleBoxAttribute
302 sets the attribute of the box.
303
304 setCDKFScaleDigits
305 sets the number of digits shown after the decimal point for the
306 box value.
307
308 setCDKFScaleHorizontalChar
309 sets the horizontal drawing character for the box to the given
310 character.
311
312 setCDKFScaleLLChar
313 sets the lower left hand corner of the widget's box to the given
314 character.
315
316 setCDKFScaleLRChar
317 sets the lower right hand corner of the widget's box to the given
318 character.
319
320 setCDKFScaleLowHigh
321 sets the low and high values of the widget.
322
323 setCDKFScalePostProcess
324 allows the user to have the widget call a function after the key
325 has been applied to the widget. The parameter function is the
326 callback function. The parameter data points to data passed to
327 the callback function. To learn more about post-processing see
328 cdk_process [4m(3).
329
330 setCDKFScalePreProcess
331 allows the user to have the widget call a function after a key is
332 hit and before the key is applied to the widget. The parameter
333 function is the callback function. The parameter data points to
334 data passed to the callback function. To learn more about pre-
335 processing see cdk_process [4m(3).
336
337 setCDKFScaleULChar
338 sets the upper left hand corner of the widget's box to the given
339 character.
340
341 setCDKFScaleURChar
342 sets the upper right hand corner of the widget's box to the given
343 character.
344
345 setCDKFScaleValue
346 sets the current value of the widget.
347
348 setCDKFScaleVerticalChar
349 sets the vertical drawing character for the box to the given char‐
350 acter.
351
353 When the widget is activated there are several default key bindings
354 which will help the user enter or manipulate the information quickly.
355 The following table outlines the keys and their actions for this wid‐
356 get.
357
358 ┌─────────────────────────────────────────────────────────────────────┐
359 │Key Action │
360 ├─────────────────────────────────────────────────────────────────────┤
361 │Down Arrow Decrements the scale by the normal value. │
362 │Up Arrow Increments the scale by the normal value. │
363 │u Increments the scale by the normal value. │
364 │Prev Page Decrements the scale by the accelerated value. │
365 │U Decrements the scale by the accelerated value. │
366 │Ctrl-B Decrements the scale by the accelerated value. │
367 │Next Page Increments the scale by the accelerated value. │
368 │Ctrl-F Increments the scale by the accelerated value. │
369 │Home Sets the scale to the low value. │
370 │g Sets the scale to the low value. │
371 │^ Sets the scale to the low value. │
372 │End Sets the scale to the high value. │
373 │G Sets the scale to the high value. │
374 │$ Sets the scale to the high value. │
375 │Return Exits the widget and returns the index of the │
376 │ selected value. This also sets the widget data │
377 │ exitType to vNORMAL. │
378 │Tab Exits the widget and returns the index of the │
379 │ selected value. This also sets the widget data │
380 │ exitType to vNORMAL. │
381 │Escape Exits the widget and returns the unknownFloat │
382 │ value (see the cdk_objs.h header file). This also │
383 │ sets the widget data exitType to vESCAPE_HIT. │
384 │Ctrl-R Refreshes the screen. │
385 └─────────────────────────────────────────────────────────────────────┘
386 If the cursor is not pointing to the field's value, the following key
387 bindings apply. You may use the left/right arrows to move the cursor
388 onto the field's value and modify it by typing characters to replace
389 the digits and sign.
390
391 ┌─────────────────────────────────────────────────────────────────────┐
392 │Key Action │
393 ├─────────────────────────────────────────────────────────────────────┤
394 │Left Arrow Decrements the scale by the normal value. │
395 │Right Arrow Increments the scale by the normal value. │
396 ├─────────────────────────────────────────────────────────────────────┤
397 │d Decrements the scale by the normal value. │
398 │D Increments the scale by the accelerated value. │
399 │- Decrements the scale by the normal value. │
400 │+ Increments the scale by the normal value. │
401 │0 Sets the scale to the low value. │
402 └─────────────────────────────────────────────────────────────────────┘
404 cdk(3), cdk_binding(3), cdk_display(3), cdk_position(3), cdk_screen(3)
405
406
407
408 cdk_fscale(3)