1cdk_dscale(3) Library Functions Manual cdk_dscale(3)
2
3
4
6 cdk_dscale - curses scale widget (type double).
7
9 cc [ flag ... ] file ... -lcdk [ library ... ]
10
11 #include <cdk.h>
12
13 double activateCDKDScale (
14 CDKDSCALE *scale,
15 chtype *actions);
16
17 void destroyCDKDScale (
18 CDKDSCALE *scale);
19
20 void drawCDKDScale (
21 CDKDSCALE *scale,
22 boolean box);
23
24 void eraseCDKDScale (
25 CDKDSCALE *scale);
26
27 boolean getCDKDScaleBox (
28 CDKDSCALE *scale);
29
30 int getCDKDScaleDigits (
31 CDKDSCALE *scale);
32
33 double getCDKDScaleHighValue (
34 CDKDSCALE *scale);
35
36 double getCDKDScaleLowValue (
37 CDKDSCALE *scale);
38
39 double getCDKDScaleValue (
40 CDKDSCALE *scale);
41
42 int injectCDKDScale (
43 CDKDSCALE *scale,
44 chtype input);
45
46 void moveCDKDScale (
47 CDKDSCALE *scale,
48 int xpos,
49 int ypos,
50 boolean relative,
51 boolean refresh);
52
53 CDKDSCALE *newCDKDScale (
54 CDKSCREEN *cdkscreen,
55 int xpos,
56 int ypos,
57 const char *title,
58 const char *label,
59 chtype fieldAttribute,
60 int fieldWidth,
61 double currentValue,
62 double lowValue,
63 double highValue,
64 double increment,
65 double fastIncrement,
66 int digits,
67 boolean box,
68 boolean shadow);
69
70 void positionCDKDScale (
71 CDKDSCALE *scale);
72
73 void setCDKDScale (
74 CDKDSCALE *scale,
75 double lowValue,
76 double highValue,
77 double currentValue,
78 boolean box);
79
80 void setCDKDScaleBackgroundAttrib (
81 CDKDSCALE *scale,
82 chtype attribute);
83
84 void setCDKDScaleBackgroundColor (
85 CDKDSCALE *scale,
86 const char * color);
87
88 void setCDKDScaleBox (
89 CDKDSCALE *scale,
90 boolean box);
91
92 void setCDKDScaleBoxAttribute (
93 CDKDSCALE *scale,
94 chtype character);
95
96 void setCDKDScaleDigits (
97 CDKDSCALE *scale,
98 int digits);
99
100 void setCDKDScaleHorizontalChar (
101 CDKDSCALE *scale,
102 chtype character);
103
104 void setCDKDScaleLLChar (
105 CDKDSCALE *scale,
106 chtype character);
107
108 void setCDKDScaleLRChar (
109 CDKDSCALE *scale,
110 chtype character);
111
112 void setCDKDScaleLowHigh (
113 CDKDSCALE *scale,
114 double low,
115 double high);
116
117 void setCDKDScalePostProcess (
118 CDKDSCALE *scale,
119 PROCESSFN callback,
120 void * data);
121
122 void setCDKDScalePreProcess (
123 CDKDSCALE *scale,
124 PROCESSFN callback,
125 void * data);
126
127 void setCDKDScaleULChar (
128 CDKDSCALE *scale,
129 chtype character);
130
131 void setCDKDScaleURChar (
132 CDKDSCALE *scale,
133 chtype character);
134
135 void setCDKDScaleValue (
136 CDKDSCALE *scale,
137 double value);
138
139 void setCDKDScaleVerticalChar (
140 CDKDSCALE *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 activateCDKDScale
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 unknownDouble value (see the cdk_objs.h
168 header file).
169
170 The widget data exitType will be set to vESCAPE_HIT.
171
172 destroyCDKDScale
173 removes the widget from the screen and frees memory the object
174 used.
175
176 drawCDKDScale
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 eraseCDKDScale
182 removes the widget from the screen. This does NOT destroy the
183 widget.
184
185 getCDKDScaleBox
186 returns whether the widget will be drawn with a box around it.
187
188 getCDKDScaleDigits
189 returns the number of digits shown after the decimal point for the
190 box value.
191
192 getCDKDScaleHighValue
193 returns the high value of the scale widget.
194
195 getCDKDScaleLowValue
196 returns the low value of the scale widget.
197
198 getCDKDScaleValue
199 returns the current value of the widget.
200
201 injectCDKDScale
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 unknownDouble 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 unknownDouble value (see
224 the cdk_objs.h header file). The widget data exitType is
225 set to vEARLY_EXIT.
226
227 moveCDKDScale
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 newCDKDScale
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 positionCDKDScale
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 setCDKDScale
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 newCDKDScale function.
315
316 setCDKDScaleBackgroundAttrib
317 sets the background attribute of the widget.
318
319 The parameter attribute is a curses attribute, e.g., A_BOLD.
320
321 setCDKDScaleBackgroundColor
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 setCDKDScaleBox
329 sets whether the widget will be drawn with a box around it.
330
331 setCDKDScaleBoxAttribute
332 sets the attribute of the box.
333
334 setCDKDScaleDigits
335 sets the number of digits shown after the decimal point for the
336 box value.
337
338 setCDKDScaleHorizontalChar
339 sets the horizontal drawing character for the box to the given
340 character.
341
342 setCDKDScaleLLChar
343 sets the lower left hand corner of the widget's box to the given
344 character.
345
346 setCDKDScaleLRChar
347 sets the lower right hand corner of the widget's box to the given
348 character.
349
350 setCDKDScaleLowHigh
351 sets the low and high values of the widget.
352
353 setCDKDScalePostProcess
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 setCDKDScalePreProcess
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 setCDKDScaleULChar
376 sets the upper left hand corner of the widget's box to the given
377 character.
378
379 setCDKDScaleURChar
380 sets the upper right hand corner of the widget's box to the given
381 character.
382
383 setCDKDScaleValue
384 sets the current value of the widget.
385
386 setCDKDScaleVerticalChar
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 unknownDouble │
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_dscale(3)