1cdk_uscale(3) Library Functions Manual cdk_uscale(3)
2
3
4
6 cdk_uscale - curses scale widget (type unsigned).
7
9 cc [ flag ... ] file ... -lcdk [ library ... ]
10
11 #include <cdk.h>
12
13 unsigned activateCDKUScale (
14 CDKUSCALE *scale,
15 chtype *actions);
16
17 void destroyCDKUScale (
18 CDKUSCALE *scale);
19
20 void drawCDKUScale (
21 CDKUSCALE *scale,
22 boolean box);
23
24 void eraseCDKUScale (
25 CDKUSCALE *scale);
26
27 boolean getCDKUScaleBox (
28 CDKUSCALE *scale);
29
30 unsigned getCDKUScaleHighValue (
31 CDKUSCALE *scale);
32
33 unsigned getCDKUScaleLowValue (
34 CDKUSCALE *scale);
35
36 unsigned getCDKUScaleValue (
37 CDKUSCALE *scale);
38
39 int injectCDKUScale (
40 CDKUSCALE *scale,
41 chtype input);
42
43 void moveCDKUScale (
44 CDKUSCALE *scale,
45 int xpos,
46 int ypos,
47 boolean relative,
48 boolean refresh);
49
50 CDKUSCALE *newCDKUScale (
51 CDKSCREEN *cdkscreen,
52 int xpos,
53 int ypos,
54 const char *title,
55 const char *label,
56 chtype fieldAttribute,
57 int fieldWidth,
58 unsigned currentValue,
59 unsigned lowValue,
60 unsigned highValue,
61 unsigned increment,
62 unsigned fastIncrement,
63 boolean box,
64 boolean shadow);
65
66 void positionCDKUScale (
67 CDKUSCALE *scale);
68
69 void setCDKUScale (
70 CDKUSCALE *scale,
71 unsigned lowValue,
72 unsigned highValue,
73 unsigned currentValue,
74 boolean box);
75
76 void setCDKUScaleBackgroundAttrib (
77 CDKUSCALE *scale,
78 chtype attribute);
79
80 void setCDKUScaleBackgroundColor (
81 CDKUSCALE *scale,
82 const char * color);
83
84 void setCDKUScaleBox (
85 CDKUSCALE *scale,
86 boolean box);
87
88 void setCDKUScaleBoxAttribute (
89 CDKUSCALE *scale,
90 chtype character);
91
92 void setCDKUScaleHorizontalChar (
93 CDKUSCALE *scale,
94 chtype character);
95
96 void setCDKUScaleLLChar (
97 CDKUSCALE *scale,
98 chtype character);
99
100 void setCDKUScaleLRChar (
101 CDKUSCALE *scale,
102 chtype character);
103
104 void setCDKUScaleLowHigh (
105 CDKUSCALE *scale,
106 unsigned low,
107 unsigned high);
108
109 void setCDKUScalePostProcess (
110 CDKUSCALE *scale,
111 PROCESSFN callback,
112 void * data);
113
114 void setCDKUScalePreProcess (
115 CDKUSCALE *scale,
116 PROCESSFN callback,
117 void * data);
118
119 void setCDKUScaleULChar (
120 CDKUSCALE *scale,
121 chtype character);
122
123 void setCDKUScaleURChar (
124 CDKUSCALE *scale,
125 chtype character);
126
127 void setCDKUScaleValue (
128 CDKUSCALE *scale,
129 unsigned value);
130
131 void setCDKUScaleVerticalChar (
132 CDKUSCALE *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 activateCDKUScale
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 unknownUnsigned value (see the
152 cdk_objs.h header file). The widget data exitType will be set to
153 vESCAPE_HIT.
154
155 destroyCDKUScale
156 removes the widget from the screen and frees memory the object
157 used.
158
159 drawCDKUScale
160 draws the scale widget on the screen. If the box parameter is
161 true, the widget is drawn with a box.
162
163 eraseCDKUScale
164 removes the widget from the screen. This does NOT destroy the
165 widget.
166
167 getCDKUScaleBox
168 returns whether the widget will be drawn with a box around it.
169
170 getCDKUScaleHighValue
171 returns the high value of the scale widget.
172
173 getCDKUScaleLowValue
174 returns the low value of the scale widget.
175
176 getCDKUScaleValue
177 returns the current value of the widget.
178
179 injectCDKUScale
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 unknownUnsigned 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 unknownUnsigned value
198 (see the cdk_objs.h header file). The widget data exitType
199 is set to vEARLY_EXIT.
200
201 moveCDKUScale
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 newCDKUScale
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 positionCDKUScale
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 setCDKUScale
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 newCDKUScale function.
277
278 setCDKUScaleBackgroundAttrib
279 sets the background attribute of the widget. The parameter
280 attribute is a curses attribute, e.g., A_BOLD.
281
282 setCDKUScaleBackgroundColor
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 setCDKUScaleBox
287 sets whether the widget will be drawn with a box around it.
288
289 setCDKUScaleBoxAttribute
290 sets the attribute of the box.
291
292 setCDKUScaleHorizontalChar
293 sets the horizontal drawing character for the box to the given
294 character.
295
296 setCDKUScaleLLChar
297 sets the lower left hand corner of the widget's box to the given
298 character.
299
300 setCDKUScaleLRChar
301 sets the lower right hand corner of the widget's box to the given
302 character.
303
304 setCDKUScaleLowHigh
305 sets the low and high values of the widget.
306
307 setCDKUScalePostProcess
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 setCDKUScalePreProcess
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 setCDKUScaleULChar
322 sets the upper left hand corner of the widget's box to the given
323 character.
324
325 setCDKUScaleURChar
326 sets the upper right hand corner of the widget's box to the given
327 character.
328
329 setCDKUScaleValue
330 sets the current value of the widget.
331
332 setCDKUScaleVerticalChar
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 unknownUnsigned │
366 │ value (see the cdk_objs.h header file). This also │
367 │ sets 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_uscale(3)