1cdk_scale(3) Library Functions Manual cdk_scale(3)
2
3
4
6 cdk_scale - curses scale widget (type int).
7
9 cc [ flag ... ] file ... -lcdk [ library ... ]
10
11 #include <cdk.h>
12
13 int activateCDKScale (
14 CDKSCALE *scale,
15 chtype *actions);
16
17 void destroyCDKScale (
18 CDKSCALE *scale);
19
20 void drawCDKScale (
21 CDKSCALE *scale,
22 boolean box);
23
24 void eraseCDKScale (
25 CDKSCALE *scale);
26
27 boolean getCDKScaleBox (
28 CDKSCALE *scale);
29
30 int getCDKScaleHighValue (
31 CDKSCALE *scale);
32
33 int getCDKScaleLowValue (
34 CDKSCALE *scale);
35
36 int getCDKScaleValue (
37 CDKSCALE *scale);
38
39 int injectCDKScale (
40 CDKSCALE *scale,
41 chtype input);
42
43 void moveCDKScale (
44 CDKSCALE *scale,
45 int xpos,
46 int ypos,
47 boolean relative,
48 boolean refresh);
49
50 CDKSCALE *newCDKScale (
51 CDKSCREEN *cdkscreen,
52 int xpos,
53 int ypos,
54 const char *title,
55 const char *label,
56 chtype fieldAttribute,
57 int fieldWidth,
58 int currentValue,
59 int lowValue,
60 int highValue,
61 int increment,
62 int fastIncrement,
63 boolean box,
64 boolean shadow);
65
66 void positionCDKScale (
67 CDKSCALE *scale);
68
69 void setCDKScale (
70 CDKSCALE *scale,
71 int lowValue,
72 int highValue,
73 int currentValue,
74 boolean box);
75
76 void setCDKScaleBackgroundAttrib (
77 CDKSCALE *scale,
78 chtype attribute);
79
80 void setCDKScaleBackgroundColor (
81 CDKSCALE *scale,
82 const char * color);
83
84 void setCDKScaleBox (
85 CDKSCALE *scale,
86 boolean box);
87
88 void setCDKScaleBoxAttribute (
89 CDKSCALE *scale,
90 chtype character);
91
92 void setCDKScaleHorizontalChar (
93 CDKSCALE *scale,
94 chtype character);
95
96 void setCDKScaleLLChar (
97 CDKSCALE *scale,
98 chtype character);
99
100 void setCDKScaleLRChar (
101 CDKSCALE *scale,
102 chtype character);
103
104 void setCDKScaleLowHigh (
105 CDKSCALE *scale,
106 int low,
107 int high);
108
109 void setCDKScalePostProcess (
110 CDKSCALE *scale,
111 PROCESSFN callback,
112 void * data);
113
114 void setCDKScalePreProcess (
115 CDKSCALE *scale,
116 PROCESSFN callback,
117 void * data);
118
119 void setCDKScaleULChar (
120 CDKSCALE *scale,
121 chtype character);
122
123 void setCDKScaleURChar (
124 CDKSCALE *scale,
125 chtype character);
126
127 void setCDKScaleValue (
128 CDKSCALE *scale,
129 int value);
130
131 void setCDKScaleVerticalChar (
132 CDKSCALE *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 activateCDKScale
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 unknownInt value (see the cdk_objs.h
160 header file).
161
162 The widget data exitType will be set to vESCAPE_HIT.
163
164 destroyCDKScale
165 removes the widget from the screen and frees memory the object
166 used.
167
168 drawCDKScale
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 eraseCDKScale
174 removes the widget from the screen. This does NOT destroy the
175 widget.
176
177 getCDKScaleBox
178 returns whether the widget will be drawn with a box around it.
179
180 getCDKScaleHighValue
181 returns the high value of the scale widget.
182
183 getCDKScaleLowValue
184 returns the low value of the scale widget.
185
186 getCDKScaleValue
187 returns the current value of the widget.
188
189 injectCDKScale
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 unknownInt 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 unknownInt value (see
212 the cdk_objs.h header file). The widget data exitType is
213 set to vEARLY_EXIT.
214
215 moveCDKScale
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 newCDKScale
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 positionCDKScale
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 setCDKScale
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 newCDKScale function.
303
304 setCDKScaleBackgroundAttrib
305 sets the background attribute of the widget.
306
307 The parameter attribute is a curses attribute, e.g., A_BOLD.
308
309 setCDKScaleBackgroundColor
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 setCDKScaleBox
317 sets whether the widget will be drawn with a box around it.
318
319 setCDKScaleBoxAttribute
320 sets the attribute of the box.
321
322 setCDKScaleHorizontalChar
323 sets the horizontal drawing character for the box to the given
324 character.
325
326 setCDKScaleLLChar
327 sets the lower left hand corner of the widget's box to the given
328 character.
329
330 setCDKScaleLRChar
331 sets the lower right hand corner of the widget's box to the given
332 character.
333
334 setCDKScaleLowHigh
335 sets the low and high values of the widget.
336
337 setCDKScalePostProcess
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 setCDKScalePreProcess
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 setCDKScaleULChar
360 sets the upper left hand corner of the widget's box to the given
361 character.
362
363 setCDKScaleURChar
364 sets the upper right hand corner of the widget's box to the given
365 character.
366
367 setCDKScaleValue
368 sets the current value of the widget.
369
370 setCDKScaleVerticalChar
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 unknownInt value │
404 │ (see the cdk_objs.h header file). This also sets │
405 │ 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_scale(3)