1cdk_slider(3) Library Functions Manual cdk_slider(3)
2
3
4
6 cdk_slider - curses slider widget (type int)
7
9 cc [ flag ... ] file ... -lcdk [ library ... ]
10
11 #include <cdk.h>
12
13 int activateCDKSlider (
14 CDKSLIDER *slider,
15 chtype *actions);
16
17 void destroyCDKSlider (
18 CDKSLIDER *slider);
19
20 void drawCDKSlider (
21 CDKSLIDER *slider,
22 boolean box);
23
24 void eraseCDKSlider (
25 CDKSLIDER *slider);
26
27 boolean getCDKSliderBox (
28 CDKSLIDER *slider);
29
30 int getCDKSliderHighValue (
31 CDKSLIDER *slider);
32
33 int getCDKSliderLowValue (
34 CDKSLIDER *slider);
35
36 int getCDKSliderValue (
37 CDKSLIDER *slider);
38
39 int injectCDKSlider (
40 CDKSLIDER *slider,
41 chtype input);
42
43 void moveCDKSlider (
44 CDKSLIDER *slider,
45 int xpos,
46 int ypos,
47 boolean relative,
48 boolean refresh);
49
50 CDKSLIDER *newCDKSlider (
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 int lowValue,
60 int highValue,
61 int increment,
62 int fastIncrement,
63 boolean box,
64 boolean shadow);
65
66 void positionCDKSlider (
67 CDKSLIDER *slider);
68
69 void setCDKSlider (
70 CDKSLIDER *slider,
71 int lowValue,
72 int highValue,
73 int currentValue,
74 boolean box);
75
76 void setCDKSliderBackgroundAttrib (
77 CDKSLIDER *slider,
78 chtype attribute);
79
80 void setCDKSliderBackgroundColor (
81 CDKSLIDER *slider,
82 const char * color);
83
84 void setCDKSliderBox (
85 CDKSLIDER *slider,
86 boolean boxWidget);
87
88 void setCDKSliderBoxAttribute (
89 CDKSLIDER *slider,
90 chtype character);
91
92 void setCDKSliderHorizontalChar (
93 CDKSLIDER *slider,
94 chtype character);
95
96 void setCDKSliderLLChar (
97 CDKSLIDER *slider,
98 chtype character);
99
100 void setCDKSliderLRChar (
101 CDKSLIDER *slider,
102 chtype character);
103
104 void setCDKSliderLowHigh (
105 CDKSLIDER *slider,
106 int lowValue,
107 int highValue);
108
109 void setCDKSliderPostProcess (
110 CDKSLIDER *slider,
111 PROCESSFN callback,
112 void * data);
113
114 void setCDKSliderPreProcess (
115 CDKSLIDER *slider,
116 PROCESSFN callback,
117 void * data);
118
119 void setCDKSliderULChar (
120 CDKSLIDER *slider,
121 chtype character);
122
123 void setCDKSliderURChar (
124 CDKSLIDER *slider,
125 chtype character);
126
127 void setCDKSliderValue (
128 CDKSLIDER *slider,
129 int value);
130
131 void setCDKSliderVerticalChar (
132 CDKSLIDER *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 activateCDKSlider
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 unknownInt value (see the cdk_objs.h header file).
159 The widget data exitType is set to vESCAPE_HIT.
160
161 destroyCDKSlider
162 removes the widget from the screen and frees memory the object
163 used.
164
165 drawCDKSlider
166 draws the slider widget on the screen. If the box option is true,
167 the widget is drawn with a box.
168
169 eraseCDKSlider
170 removes the widget from the screen. This does NOT destroy the
171 widget.
172
173 getCDKSliderBox
174 returns true if the widget will be drawn with a box around it.
175
176 getCDKSliderHighValue
177 returns the high value of the slider widget.
178
179 getCDKSliderLowValue
180 returns the low value of the slider widget.
181
182 getCDKSliderValue
183 returns the current value of the widget.
184
185 injectCDKSlider
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 unknownInt 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 unknownInt value (see the
207 cdk_objs.h header file). The widget data exitType is set to
208 vEARLY_EXIT.
209
210 moveCDKSlider
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 newCDKSlider
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 positionCDKSlider
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 setCDKSlider
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 newCDKSlider function.
300
301 setCDKSliderBackgroundAttrib
302 sets the background attribute of the widget.
303
304 The parameter attribute is a curses attribute, e.g., A_BOLD.
305
306 setCDKSliderBackgroundColor
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 setCDKSliderBox
314 sets whether the widget will be drawn with a box around it.
315
316 setCDKSliderBoxAttribute
317 function sets the attribute of the box.
318
319 setCDKSliderHorizontalChar
320 sets the horizontal drawing character for the box to the given
321 character.
322
323 setCDKSliderLLChar
324 sets the lower left hand corner of the widget's box to the given
325 character.
326
327 setCDKSliderLRChar
328 sets the lower right hand corner of the widget's box to the given
329 character.
330
331 setCDKSliderLowHigh
332 sets the low and high values of the widget.
333
334 setCDKSliderPostProcess
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 setCDKSliderPreProcess
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 setCDKSliderULChar
357 sets the upper left hand corner of the widget's box to the given
358 character.
359
360 setCDKSliderURChar
361 sets the upper right hand corner of the widget's box to the given
362 character.
363
364 setCDKSliderValue
365 sets the current value of the widget.
366
367 setCDKSliderVerticalChar
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 unknownInt value │
410 │ (see the cdk_objs.h header file). This also sets │
411 │ 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_slider(3)