1cdk_swindow(3) Library Functions Manual cdk_swindow(3)
2
3
4
6 cdk_swindow - a curses scrolling window widget.
7
9 cc [ flag ... ] file ... -lcdk [ library ... ]
10
11 #include <cdk.h>
12
13 void activateCDKSwindow (
14 CDKSWINDOW *swindow,
15 chtype * actions);
16
17 void addCDKSwindow (
18 CDKSWINDOW *swindow,
19 char *info,
20 int insertPosition);
21
22 void cleanCDKSwindow (
23 CDKSWINDOW *swindow);
24
25 int execCDKSwindow (
26 CDKSWINDOW *swindow,
27 char * command,
28 int insertPosition);
29
30 void destroyCDKSwindow (
31 CDKSWINDOW *swindow);
32
33 void drawCDKSwindow (
34 CDKSWINDOW *swindow,
35 boolean box);
36
37 void dumpCDKSwindow (
38 CDKSWINDOW *swindow,
39 char *filename);
40
41 void eraseCDKSwindow (
42 CDKSWINDOW *swindow);
43 void execCDKSwindow (
44 CDKSWINDOW *swindow,
45 char *command,
46 int insertPosition);
47 boolean getCDKSwindowBox (
48 CDKSWINDOW *swindow);
49
50 chtype **getCDKSwindowContents (
51 CDKSWINDOW *swindow);
52
53 int injectCDKSwindow (
54 CDKSWINDOW *swindow,
55 chtype input);
56
57 void jumpToLineCDKSwindow (
58 CDKSWINDOW *swindow,
59 int line);
60
61 void loadCDKSwindowInformation (
62 CDKSWINDOW *swindow);
63
64 void moveCDKSwindow (
65 CDKSWINDOW *swindow,
66 int xpos,
67 int ypos,
68 boolean relative,
69 boolean refresh);
70
71 CDKSWINDOW *newCDKSwindow (
72 CDKSCREEN *cdkscreen,
73 int xpos,
74 int ypos,
75 int height,
76 int width,
77 char *title,
78 int saveLines,
79 boolean box,
80 boolean shadow);
81
82 void positionCDKSwindow (
83 CDKSWINDOW *swindow);
84
85 void saveCDKSwindowInformation (
86 CDKSWINDOW *swindow);
87
88 void setCDKSwindow (
89 CDKSWINDOW *swindow,
90 char **info,
91 int lines,
92 boolean box);
93
94 void setCDKSwindowBackgroundAttrib (
95 CDKSWINDOW *swindow,
96 chtype attribute);
97
98 void setCDKSwindowBackgroundColor (
99 CDKSWINDOW *swindow,
100 char * color);
101 void setCDKSwindowBox (
102 CDKSWINDOW *swindow,
103 boolean boxWidget);
104
105 void setCDKSwindowBoxAttribute (
106 CDKSWINDOW *swindow,
107 chtype character);
108
109 void setCDKSwindowContents (
110 CDKSWINDOW *swindow,
111 char **info,
112 int lines);
113
114 void setCDKSwindowHorizontalChar (
115 CDKSWINDOW *swindow,
116 chtype character);
117
118 void setCDKSwindowLLChar (
119 CDKSWINDOW *swindow,
120 chtype character);
121
122 void setCDKSwindowLRChar (
123 CDKSWINDOW *swindow,
124 chtype character);
125
126 void setCDKSwindowPostProcess (
127 CDKSWINDOW *swindow,
128 PROCESSFN callback,
129 void * data);
130
131 void setCDKSwindowPreProcess (
132 CDKSWINDOW *swindow,
133 PROCESSFN callback,
134 void * data);
135
136 void setCDKSwindowULChar (
137 CDKSWINDOW *swindow,
138 chtype character);
139
140 void setCDKSwindowURChar (
141 CDKSWINDOW *swindow,
142 chtype character);
143
144 void setCDKSwindowVerticalChar (
145 CDKSWINDOW *swindow,
146 chtype character);
147
148 void trimCDKSwindow (
149 CDKSWINDOW *swindow,
150 int start,
151 int finish);
152
154 The Cdk scrolling window (swindow) widget can be used to display mes‐
155 sages. The following functions create or manipulate the Cdk swindow
156 box widget.
157
159 activateCDKSwindow
160 function activates the swindow widget and lets the user interact
161 with the widget. The parameter swindow is a pointer to a non-NULL
162 swindow widget. If the actions parameter is passed with a non-
163 NULL value, the characters in the array will be injected into the
164 widget. To activate the widget interactively pass in a NULL
165 pointer for actions. If the character entered into this widget is
166 RETURN or TAB then this function will return 1. It will also set
167 the widget data exitType to vNORMAL. If the character entered
168 into this widget was ESCAPE then the widget will return a value of
169 -1 and the widget data exitType will be set to vESCAPE_HIT.
170
171 addCDKSwindow
172 adds information to a scrolling window. The information is sup‐
173 plied by the info parameter. The information is immediately added
174 to the scrolling window. The position of the new information is
175 governed by the value of the parameter insertPosition. This
176 parameter may be two values: TOP or BOTTOM.
177
178 cleanCDKSwindow
179 clears the information from the window.
180
181 destroyCDKSwindow
182 removes the widget from the screen and frees memory the object
183 used.
184
185 drawCDKSwindow
186 draws the swindow widget on the screen. If the box parameter is
187 true, the widget is drawn with a box.
188
189 dumpCDKSwindow
190 saves the contents of the scrolling window into the file specified
191 by the filename parameter. It returns -1 on failure, and the num‐
192 ber of lines saved if the dump was successful.
193
194 eraseCDKSwindow
195 removes the widget from the screen. This does NOT destroy the
196 widget.
197
198 execCDKSwindow
199 allows the user to execute a shell command and have the output of
200 the shell command direct itself to the scrolling window. The com‐
201 mand parameter is the command to execute. The insertPosition
202 parameter tells where the output will be inserted within the
203 scrolling window.
204
205 getCDKSwindowBox
206 returns true if the widget will be drawn with a box around it.
207
208 getCDKSwindowContents
209 returns the contents of the scrolling window. The parameter lines
210 will be set to the number of lines returned.
211
212 injectCDKSwindow
213 injects a single character into the widget. The parameter swindow
214 is a pointer to a non-NULL swindow widget. The parameter charac‐
215 ter is the character to inject into the widget. The return value
216 and side-effect (setting the widget data exitType) depend upon the
217 injected character:
218
219 RETURN or TAB
220 the function returns 1. The widget data exitType is set to
221 vNORMAL.
222
223 ESCAPE the function returns -1. The widget data exitType is set
224 to vESCAPE_HIT.
225
226 Otherwise
227 unless modified by preprocessing, postprocessing or key
228 bindings, the function returns -1. The widget data exit‐
229 Type is set to vEARLY_EXIT.
230
231 jumpToLineCDKSwindow
232 moves the scrolling window to the given line. The parameter line
233 may be an integer or one of the two predefined values TOP and BOT‐
234 TOM.
235
236 loadCDKSwindowInformation
237 allows the user to load the contents of a file into the scrolling
238 window. This function is interactive, and will ask for a file‐
239 name.
240
241 moveCDKSwindow
242 moves the given widget to the given position. The parameters xpos
243 and ypos are the new position of the widget. The parameter xpos
244 may be an integer or one of the pre-defined values TOP, BOTTOM,
245 and CENTER. The parameter ypos may be an integer or one of the
246 pre-defined values LEFT, RIGHT, and CENTER. The parameter rela‐
247 tive states whether the xpos/ypos pair is a relative move or an
248 absolute move. For example, if xpos = 1 and ypos = 2 and relative
249 = TRUE, then the widget would move one row down and two columns
250 right. If the value of relative was FALSE then the widget would
251 move to the position (1,2). Do not use the values TOP, BOTTOM,
252 LEFT, RIGHT, or CENTER when relative = TRUE (weird things may hap‐
253 pen). The final parameter refresh is a boolean value which states
254 whether the widget will get refreshed after the move.
255
256 newCDKSwindow
257 creates a swindow widget and returns a pointer to it. Parameters:
258
259 screen
260 is the screen you wish this widget to be placed in.
261
262 xpos controls the placement of the object along the horizontal
263 axis. It may be an integer or one of the pre-defined values
264 LEFT, RIGHT, and CENTER.
265
266 ypos controls the placement of the object along the vertical axis.
267 It may be an integer or one of the pre-defined values TOP,
268 BOTTOM, and CENTER.
269
270 height and
271
272 width
273 control the height and width of the widget. If you provide a
274 value of zero for either of the height or the width, the wid‐
275 get will be created with the full width and height of the
276 screen. If you provide a negative value, the widget will be
277 created the full height or width minus the value provided.
278
279 title
280 is the string to display at the top of the widget. The title
281 can be more than one line; just provide a carriage return
282 character at the line break.
283
284 saveLines
285 is the number of lines to save before throwing information
286 away.
287
288 box is true if the widget should be drawn with a box around it.
289
290 The shadow
291 turns the shadow on or off around this widget.
292
293 If the widget could not be created then a NULL pointer is
294 returned.
295
296 positionCDKSwindow
297 allows the user to move the widget around the screen via the cur‐
298 sor/keypad keys. See cdk_position (3) for key bindings.
299
300 saveCDKSwindowInformation
301 allows the user to save the contents of the scrolling window into
302 a file. This function is interactive, and will ask for a file‐
303 name.
304
305 setCDKSwindow
306 lets the programmer modify certain elements of an existing swindow
307 widget. The parameter info is a char ** of the information to set
308 in the scrolling window; lines is the number of lines being added.
309 The other parameter names correspond to the same parameter names
310 listed in the newCDKSwindow function.
311
312 setCDKSwindowBackgroundAttrib
313 sets the background attribute of the widget. The parameter
314 attribute is a curses attribute, e.g., A_BOLD.
315
316 setCDKSwindowBackgroundColor
317 sets the background color of the widget. The parameter color is
318 in the format of the Cdk format strings. See cdk_display (3).
319
320 setCDKSwindowBox
321 sets whether the widget will be drawn with a box around it.
322
323 setCDKSwindowBoxAttribute
324 sets the attribute of the box.
325
326 setCDKSwindowContents
327 lets the programmer modify certain elements of an existing swindow
328 widget. The parameter info is a char ** of the information to set
329 in the scrolling window; lines is the number of lines being added.
330
331 setCDKSwindowHorizontalChar
332 sets the horizontal drawing character for the box to the given
333 character.
334
335 setCDKSwindowLLChar
336 sets the lower left hand corner of the widget's box to the given
337 character.
338
339 setCDKSwindowLRChar
340 sets the lower right hand corner of the widget's box to the given
341 character.
342
343 setCDKSwindowPostProcess
344 allows the user to have the widget call a function after the key
345 has been applied to the widget. The parameter function is the
346 callback function. The parameter data points to data passed to
347 the callback function. To learn more about post-processing see
348 cdk_process [4m(3).
349
350 setCDKSwindowPreProcess
351 allows the user to have the widget call a function after a key is
352 hit and before the key is applied to the widget. The parameter
353 function is the callback function. The parameter data points to
354 data passed to the callback function. To learn more about pre-
355 processing see cdk_process [4m(3).
356
357 setCDKSwindowULChar
358 sets the upper left hand corner of the widget's box to the given
359 character.
360
361 setCDKSwindowURChar
362 sets the upper right hand corner of the widget's box to the given
363 character.
364
365 setCDKSwindowVerticalChar
366 sets the vertical drawing character for the box to the given char‐
367 acter.
368
369 trimCDKSwindow
370 removes information from a scrolling window. The parameters start
371 and end state where to start cutting from and where to stop. The
372 first element in the scrolling window starts at index 0.
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 │Left Arrow Scrolls the window left one column. │
384 │Right Arrow Scrolls the window right one column. │
385 │Up Arrow Scrolls the window up one row. │
386 │Down Arrow Scrolls the window down one row. │
387 ├────────────────────────────────────────────────────────────────┤
388 │Prev Page │
389 │Ctrl-B │
390 │b │
391 │B Scroll the window backward one page. │
392 ├────────────────────────────────────────────────────────────────┤
393 │Next Page │
394 │Ctrl-F │
395 │Space │
396 │f │
397 │F Scroll the window forward one page. │
398 ├────────────────────────────────────────────────────────────────┤
399 │Home │
400 │| Scroll the list to the left margin. │
401 ├────────────────────────────────────────────────────────────────┤
402 │End │
403 │$ Scroll the list to the right margin. │
404 ├────────────────────────────────────────────────────────────────┤
405 │1 │
406 │< │
407 │g Move to the top of the scrolling window. │
408 │> │
409 │G Move to the bottom of the scrolling window. │
410 ├────────────────────────────────────────────────────────────────┤
411 │l │
412 │L Load a file into the scrolling window. │
413 ├────────────────────────────────────────────────────────────────┤
414 │s │
415 │S Save the contents of the scrolling window │
416 │ into a file. │
417 ├────────────────────────────────────────────────────────────────┤
418 │Return Set the widget's exitType to vNORMAL, exit │
419 │ the widget and return 1. │
420 │Tab Set the widget's exitType to vNORMAL, exit │
421 │ the widget and return 1. │
422 │Escape Set the widget's exitType to vESCAPE_HIT, │
423 │ exit the widget and return -1. │
424 │Ctrl-L Refreshes the screen. │
425 ├────────────────────────────────────────────────────────────────┤
426 └────────────────────────────────────────────────────────────────┘
428 cdk(3), cdk_binding(3), cdk_display(3), cdk_position(3), cdk_screen(3)
429
430
431
432 cdk_swindow(3)