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