1cdk_uslider(3) Library Functions Manual cdk_uslider(3)
2
3
4
6 cdk_uslider - curses slider widget (type unsigned)
7
9 cc [ flag ... ] file ... -lcdk [ library ... ]
10
11 #include <cdk.h>
12
13 int activateCDKUSlider (
14 CDKUSLIDER *slider,
15 chtype *actions);
16
17 void destroyCDKUSlider (
18 CDKUSLIDER *slider);
19
20 void drawCDKUSlider (
21 CDKUSLIDER *slider,
22 boolean box);
23
24 void eraseCDKUSlider (
25 CDKUSLIDER *slider);
26
27 boolean getCDKUSliderBox (
28 CDKUSLIDER *slider);
29
30 unsigned getCDKUSliderHighValue (
31 CDKUSLIDER *slider);
32
33 unsigned getCDKUSliderLowValue (
34 CDKUSLIDER *slider);
35
36 unsigned getCDKUSliderValue (
37 CDKUSLIDER *slider);
38
39 unsigned injectCDKUSlider (
40 CDKUSLIDER *slider,
41 chtype input);
42
43 void moveCDKUSlider (
44 CDKUSLIDER *slider,
45 int xpos,
46 int ypos,
47 boolean relative,
48 boolean refresh);
49
50 CDKUSLIDER *newCDKUSlider (
51 CDKSCREEN *cdkscreen,
52 int xpos,
53 int ypos,
54 const char *title,
55 const char *label,
56 chtype fillerCharacter,
57 int fieldWidth,
58 int currentValue,
59 unsigned lowValue,
60 unsigned highValue,
61 unsigned increment,
62 unsigned fastIncrement,
63 boolean box,
64 boolean shadow);
65
66 void positionCDKUSlider (
67 CDKUSLIDER *slider);
68
69 void setCDKUSlider (
70 CDKUSLIDER *slider,
71 unsigned lowValue,
72 unsigned highValue,
73 unsigned currentValue,
74 boolean box);
75
76 void setCDKUSliderBackgroundAttrib (
77 CDKUSLIDER *slider,
78 chtype attribute);
79
80 void setCDKUSliderBackgroundColor (
81 CDKUSLIDER *slider,
82 const char * color);
83
84 void setCDKUSliderBox (
85 CDKUSLIDER *slider,
86 boolean boxWidget);
87
88 void setCDKUSliderBoxAttribute (
89 CDKUSLIDER *slider,
90 chtype character);
91
92 void setCDKUSliderHorizontalChar (
93 CDKUSLIDER *slider,
94 chtype character);
95
96 void setCDKUSliderLLChar (
97 CDKUSLIDER *slider,
98 chtype character);
99
100 void setCDKUSliderLRChar (
101 CDKUSLIDER *slider,
102 chtype character);
103
104 void setCDKUSliderLowHigh (
105 CDKUSLIDER *slider,
106 unsigned lowValue,
107 unsigned highValue);
108
109 void setCDKUSliderPostProcess (
110 CDKUSLIDER *slider,
111 PROCESSFN callback,
112 void * data);
113
114 void setCDKUSliderPreProcess (
115 CDKUSLIDER *slider,
116 PROCESSFN callback,
117 void * data);
118
119 void setCDKUSliderULChar (
120 CDKUSLIDER *slider,
121 chtype character);
122
123 void setCDKUSliderURChar (
124 CDKUSLIDER *slider,
125 chtype character);
126
127 void setCDKUSliderValue (
128 CDKUSLIDER *slider,
129 unsigned value);
130
131 void setCDKUSliderVerticalChar (
132 CDKUSLIDER *slider,
133 chtype character);
134
136 The Cdk slider widget creates a visual slider box with a label and a
137 slider field. The following are functions which create or manipulate
138 the Cdk slider box widget.
139
141 activateCDKUSlider
142 activates the slider widget and lets the user interact with the
143 widget.
144
145 · The parameter slider is a pointer to a non-NULL slider 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 then
154 this function will return a value from the low value to the high
155 value. It will also set the widget data exitType to vNORMAL.
156
157 If the character entered into this widget was ESCAPE then the wid‐
158 get returns the unknownUnsigned value (see the cdk_objs.h header
159 file). The widget data exitType is set to vESCAPE_HIT.
160
161 destroyCDKUSlider
162 removes the widget from the screen and frees memory the object
163 used.
164
165 drawCDKUSlider
166 draws the slider widget on the screen. If the box option is true,
167 the widget is drawn with a box.
168
169 eraseCDKUSlider
170 removes the widget from the screen. This does NOT destroy the
171 widget.
172
173 getCDKUSliderBox
174 returns true if the widget will be drawn with a box around it.
175
176 getCDKUSliderHighValue
177 returns the high value of the slider widget.
178
179 getCDKUSliderLowValue
180 returns the low value of the slider widget.
181
182 getCDKUSliderValue
183 returns the current value of the widget.
184
185 injectCDKUSlider
186 injects a single character into the widget.
187
188 · The parameter slider is a pointer to a non-NULL slider widget.
189
190 · The parameter character is the character to inject into the
191 widget.
192
193 The return value and side-effect (setting the widget data
194 exitType) depend upon the injected character:
195
196 RETURN or TAB
197 the function returns a value ranging from the slider's
198 low value to the slider's high value. The widget data
199 exitType is set to vNORMAL.
200
201 ESCAPE the function returns the unknownUnsigned value (see the
202 cdk_objs.h header file). The widget data exitType is
203 set to vESCAPE_HIT.
204
205 Otherwise unless modified by preprocessing, postprocessing or key
206 bindings, the function returns the unknownUnsigned value (see the
207 cdk_objs.h header file). The widget data exitType is set to
208 vEARLY_EXIT.
209
210 moveCDKUSlider
211 moves the given widget to the given position.
212
213 · The parameters xpos and ypos are the new position of the wid‐
214 get.
215
216 The parameter xpos may be an integer or one of the pre-defined
217 values TOP, BOTTOM, and CENTER.
218
219 The parameter ypos may be an integer or one of the pre-defined
220 values LEFT, RIGHT, and CENTER.
221
222 · The parameter relative states whether the xpos/ypos pair is a
223 relative move or an absolute move.
224
225 For example, if xpos = 1 and ypos = 2 and relative = TRUE,
226 then the widget would move one row down and two columns right.
227 If the value of relative was FALSE, then the widget would move
228 to the position (1,2).
229
230 Do not use the values TOP, BOTTOM, LEFT, RIGHT, or CENTER when
231 relative = TRUE. (weird things may happen).
232
233 · The final parameter refresh is a boolean value which states
234 whether the widget will get refreshed after the move.
235
236 newCDKUSlider
237 function creates a slider widget and returns a pointer to it..
238 Parameters:
239
240 screen
241 is the screen you wish this widget to be placed in.
242
243 xpos controls the placement of the object along the horizontal
244 axis. It may be an integer or one of the pre-defined values
245 LEFT, RIGHT, and CENTER.
246
247 ypos controls the placement of the object along the vertical axis.
248 It may be an integer or one of the pre-defined values TOP,
249 BOTTOM, and CENTER.
250
251 title
252 is the string to display at the top of the widget. The title
253 can be more than one line; just provide a carriage return
254 character at the line break.
255
256 label
257 is the string to display in the label of the slider field.
258
259 fillerCharacter
260 is the character to be used to draw the slider bar in the
261 field.
262
263 fieldWidth
264 controls the width of the widget. If you provide a value of
265 zero the widget will be created with the full width of the
266 screen. If you provide a negative value, the widget will be
267 created the full width minus the value provided.
268
269 currentValue
270 is the value of the slider field when the widget is acti‐
271 vated.
272
273 lowValue and
274
275 highValue
276 are the low and high values of the widget respectively.
277
278 increment
279 is the regular increment value
280
281 fastIncrement
282 is the accelerated increment value.
283
284 box is true if the widget should be drawn with a box around it.
285
286 shadow
287 turns the shadow on or off around this widget.
288
289 If the widget could not be created then a NULL pointer is
290 returned.
291
292 positionCDKUSlider
293 allows the user to move the widget around the screen via the cur‐
294 sor/keypad keys. See cdk_position (3) for key bindings.
295
296 setCDKUSlider
297 lets the programmer modify certain elements of an existing slider
298 widget. The parameter names correspond to the same parameter
299 names listed in the newCDKUSlider function.
300
301 setCDKUSliderBackgroundAttrib
302 sets the background attribute of the widget.
303
304 The parameter attribute is a curses attribute, e.g., A_BOLD.
305
306 setCDKUSliderBackgroundColor
307 sets the background color of the widget.
308
309 The parameter color is in the format of the Cdk format strings.
310
311 See cdk_display (3).
312
313 setCDKUSliderBox
314 sets whether the widget will be drawn with a box around it.
315
316 setCDKUSliderBoxAttribute
317 function sets the attribute of the box.
318
319 setCDKUSliderHorizontalChar
320 sets the horizontal drawing character for the box to the given
321 character.
322
323 setCDKUSliderLLChar
324 sets the lower left hand corner of the widget's box to the given
325 character.
326
327 setCDKUSliderLRChar
328 sets the lower right hand corner of the widget's box to the given
329 character.
330
331 setCDKUSliderLowHigh
332 sets the low and high values of the widget.
333
334 setCDKUSliderPostProcess
335 allows the user to have the widget call a function after the key
336 has been applied to the widget.
337
338 · The parameter function is the callback function.
339
340 · The parameter data points to data passed to the callback func‐
341 tion.
342
343 To learn more about post-processing see cdk_process [4m(3).
344
345 setCDKUSliderPreProcess
346 allows the user to have the widget call a function after a key is
347 hit and before the key is applied to the widget.
348
349 · The parameter function is the callback function.
350
351 · The parameter data points to data passed to the callback func‐
352 tion.
353
354 To learn more about pre-processing see cdk_process [4m(3).
355
356 setCDKUSliderULChar
357 sets the upper left hand corner of the widget's box to the given
358 character.
359
360 setCDKUSliderURChar
361 sets the upper right hand corner of the widget's box to the given
362 character.
363
364 setCDKUSliderValue
365 sets the current value of the widget.
366
367 setCDKUSliderVerticalChar
368 sets the vertical drawing character for the box to the given char‐
369 acter.
370
372 When the widget is activated there are several default key bindings
373 which will help the user enter or manipulate the information quickly.
374 The following table outlines the keys and their actions for this wid‐
375 get.
376
377 ┌─────────────────────────────────────────────────────────────────────┐
378 │Key Action │
379 ├─────────────────────────────────────────────────────────────────────┤
380 │Down Arrow Decrements the field by the normal decrement │
381 │ value. │
382 │Up Arrow Increments the field by the normal increment │
383 │ value. │
384 │u Increments the field by the normal increment │
385 │ value. │
386 │Prev Page Decrements the field by the accelerated decrement │
387 │ value. │
388 │U Decrements the field by the accelerated decrement │
389 │ value. │
390 │Ctrl-B Decrements the field by the accelerated decrement │
391 │ value. │
392 │Next Page Increments the field by the accelerated increment │
393 │ value. │
394 │D Increments the field by the accelerated increment │
395 │ value. │
396 │Ctrl-F Increments the field by the accelerated increment │
397 │ value. │
398 │Home Sets the value to the low value. │
399 │g Sets the value to the low value. │
400 │End Sets the value to the high value. │
401 │G Sets the value to the high value. │
402 │$ Sets the value to the high value. │
403 │Return Exits the widget and returns the current value. │
404 │ This also sets the widget data exitType to vNOR‐ │
405 │ MAL. │
406 │Tab Exits the widget and returns the current value. │
407 │ This also sets the widget data exitType to vNOR‐ │
408 │ MAL. │
409 │Escape Exits the widget and returns the unknownUnsigned │
410 │ value (see the cdk_objs.h header file). This also │
411 │ sets the widget data exitType to vESCAPE_HIT. │
412 │Ctrl-R Refreshes the screen. │
413 └─────────────────────────────────────────────────────────────────────┘
414 If the cursor is not pointing to the field's value, the following key
415 bindings apply. You may use the left/right arrows to move the cursor
416 onto the field's value and modify it by typing characters to replace
417 the digits and sign.
418
419 ┌─────────────────────────────────────────────────────────────────────┐
420 │Key Action │
421 ├─────────────────────────────────────────────────────────────────────┤
422 │Left Arrow Decrements the scale by the normal value. │
423 │Right Arrow Increments the scale by the normal value. │
424 ├─────────────────────────────────────────────────────────────────────┤
425 │d Decrements the scale by the normal value. │
426 │D Increments the scale by the accelerated value. │
427 │- Decrements the scale by the normal value. │
428 │+ Increments the scale by the normal value. │
429 │0 Sets the scale to the low value. │
430 └─────────────────────────────────────────────────────────────────────┘
432 cdk(3), cdk_binding(3), cdk_display(3), cdk_position(3), cdk_screen(3)
433
434
435
436 cdk_uslider(3)