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