1cdk_viewer(3) Library Functions Manual cdk_viewer(3)
2
3
4
6 cdk_viewer - curses viewer list widget.
7
9 cc [ flag ... ] file ... -lcdk [ library ... ]
10
11 #include <cdk.h>
12
13 int activateCDKViewer (
14 CDKVIEWER *viewer);
15
16 void cleanCDKViewer (
17 CDKVIEWER *viewer);
18
19 void destroyCDKViewer (
20 CDKVIEWER *viewer);
21
22 void drawCDKViewer (
23 CDKVIEWER *viewer,
24 boolean box);
25
26 void eraseCDKViewer (
27 CDKVIEWER *viewer);
28
29 boolean getCDKViewerBox (
30 CDKVIEWER *viewer);
31
32 chtype getCDKViewerHighlight (
33 CDKVIEWER *viewer);
34
35 chtype **getCDKViewerInfo (
36 CDKVIEWER *viewer,
37 char **itemList);
38
39 boolean getCDKViewerInfoLine (
40 CDKVIEWER *viewer);
41
42 chtype **getCDKViewerTitle (
43 CDKVIEWER *viewer);
44
45 void moveCDKViewer (
46 CDKVIEWEE *viewer,
47 int box,
48 int box,
49 boolean relative,
50 boolean refresh);
51
52 CDKVIEWER *newCDKViewer (
53 CDKSCREEN *cdkscreen,
54 int xpos,
55 int ypos,
56 int height,
57 int width,
58 CDK_CONST char **buttonList,
59 int buttonCount,
60 chtype buttonHighlight,
61 boolean box,
62 boolean shadow);
63
64 void positionCDKViewer (
65 CDKVIEWER *viewer);
66
67 void setCDKViewer (
68 CDKVIEWER *viewer,
69 const char *title,
70 CDK_CONST char **list,
71 int listSize,
72 chtype buttonAttribute,
73 boolean interpret,
74 boolean showLineInfo,
75 boolean box);
76
77 void setCDKViewerBackgroundAttrib (
78 CDKVIEWER *viewer,
79 chtype attribute);
80
81 void setCDKViewerBackgroundColor (
82 CDKVIEWER *viewer,
83 const char * color);
84
85 void setCDKViewerBox (
86 CDKVIEWER *viewer,
87 boolean Box);
88
89 void setCDKViewerBoxAttribute (
90 CDKVIEWER *viewer,
91 chtype character);
92
93 void setCDKViewerHighlight (
94 CDKVIEWER *viewer,
95 chtype highlight);
96
97 void setCDKViewerHorizontalChar (
98 CDKVIEWER *viewer,
99 chtype character);
100
101 void setCDKViewerInfo (
102 CDKVIEWER *viewer,
103 CDK_CONST char **list,
104 int listSize,
105 boolean interpret);
106
107 void setCDKViewerInfoLine (
108 CDKVIEWER *viewer,
109 boolean showInfoLine);
110
111 void setCDKViewerLLChar (
112 CDKVIEWER *viewer,
113 chtype character);
114
115 void setCDKViewerLRChar (
116 CDKVIEWER *viewer,
117 chtype character);
118
119 void setCDKViewerTitle (
120 CDKVIEWER *viewer,
121 const char *title);
122
123 void setCDKViewerULChar (
124 CDKVIEWER *viewer,
125 chtype character);
126
127 void setCDKViewerURChar (
128 CDKVIEWER *viewer,
129 chtype character);
130
131 void setCDKViewerVerticalChar (
132 CDKVIEWER *viewer,
133 chtype character);
134
136 The Cdk viewer widget creates a file viewer widget. This widget allows
137 a user to interact with a file. It does NOT allow editing, this is
138 view only. The following are functions which create or manipulate the
139 Cdk viewer list widget.
140
142 activateCDKViewer
143 activates the viewer widget and lets the user interact with the
144 widget. The parameter viewer is a pointer to a non-NULL viewer
145 widget. If the actions parameter is passed with a non-NULL value,
146 the characters in the array will be injected into the widget. To
147 activate the widget interactively pass in a NULL pointer for
148 actions. If the character entered into this widget is RETURN then
149 this function will return a value from 0 to the number of buttons
150 -1, representing the button selected. It will also set the widget
151 data exitType to vNORMAL. If the character entered into this wid‐
152 get was ESCAPE then the widget will return a value of -1 and the
153 widget data exitType will be set to vESCAPE_HIT.
154
155 cleanCDKViewer
156 clears the information from the window.
157
158 destroyCDKViewer
159 removes the widget from the screen and frees memory the object
160 used.
161
162 drawCDKViewer
163 draws the viewer widget on the screen. If the box option is true,
164 the widget is drawn with a box.
165
166 eraseCDKViewer
167 removes the widget from the screen. This does NOT destroy the
168 widget.
169
170 getCDKViewerBox
171 returns true if the widget will be drawn with a box around it.
172
173 getCDKViewerHighlight
174 returns the attribute of the buttons.
175
176 getCDKViewerInfo
177 returns the contents of the viewer widget.
178
179 getCDKViewerInfoLine
180 returns true if the information line is on.
181
182 getCDKViewerTitle
183 returns the title of the widget.
184
185 moveCDKViewer
186 function moves the given widget to the given position. The param‐
187 eters xpos and ypos are the new position of the widget. The
188 parameter xpos may be an integer or one of the pre-defined values
189 TOP, BOTTOM, and CENTER. The parameter ypos may be an integer or
190 one of the pre-defined values LEFT, RIGHT, and CENTER. The param‐
191 eter relative states whether the xpos/ypos pair is a relative move
192 or an absolute move. For example, if xpos = 1 and ypos = 2 and
193 relative = TRUE, then the widget would move one row down and two
194 columns right. If the value of relative was FALSE then the widget
195 would move to the position (1,2). Do not use the values TOP, BOT‐
196 TOM, LEFT, RIGHT, or CENTER when relative = TRUE. (weird things
197 may happen). The final parameter refresh is a boolean value which
198 states whether the widget will get refreshed after the move.
199
200 *newCDKViewer
201 function creates a viewer widget and returns a pointer to it.
202 Parameters:
203
204 screen
205 is the screen you wish this widget to be placed in.
206
207 xpos controls the placement of the object along the horizontal
208 axis. It may be an integer or one of the pre-defined values
209 LEFT, RIGHT, and CENTER.
210
211 ypos controls the placement of the object along the vertical axis.
212 It may be an integer or one of the pre-defined values TOP,
213 BOTTOM, and CENTER.
214
215 height and
216
217 width
218 are the height and width of the viewer window.
219
220 buttons
221 is an array of the button labels which are to be attached to
222 the viewer on the bottom.
223
224 buttonCount
225 is the number of buttons in buttons.
226
227 buttonHighlight
228 is the highlight attribute of the currently selected button.
229
230 box is true if the widget should be drawn with a box around it.
231
232 shadow
233 turns the shadow on or off around this widget.
234
235 If the widget could not be created then a NULL pointer is
236 returned.
237
238 positionCDKViewer
239 allows the user to move the widget around the screen via the cur‐
240 sor/keypad keys. See cdk_position (3) for key bindings.
241
242 setCDKViewer
243 lets the programmer modify several elements of an existing viewer
244 widget. The parameter title is the title to be displayed on the
245 top of the viewer.
246
247 The parameter list is the information to display, while listSize
248 states how many rows there are in the list array. If listSize is
249 negative, list is scanned to find its length, including files
250 which will be included via embedded links.
251
252 The parameter buttonAttribute states the attribute of the current
253 highlighted button. The boolean parameter interpret tells the
254 viewer to interpret the contents of list for Cdk display command.
255 The showLineInfo boolean flag tells the viewer to show to show the
256 line number and percentage in the top left corner of the viewer
257 window. The parameters box and shadow are the same as in the
258 function description of newCDKViewer.
259
260 setCDKViewerBackgroundAttrib
261 sets the background attribute of the widget. The parameter
262 attribute is a curses attribute, e.g., A_BOLD.
263
264 setCDKViewerBackgroundColor
265 sets the background color of the widget. The parameter color is
266 in the format of the Cdk format strings. See cdk_display (3).
267
268 setCDKViewerBox
269 sets whether the widget will be drawn with a box around it.
270
271 setCDKViewerBoxAttribute
272 sets the attribute of the box.
273
274 setCDKViewerHighlight
275 sets the highlight attribute of the buttons on the widget.
276
277 setCDKViewerHorizontalChar
278 sets the horizontal drawing character for the box to the given
279 character.
280
281 setCDKViewerInfo
282 sets the contents of the viewer widget. See setCDKViewer for
283 parameter descriptions.
284
285 setCDKViewerInfoLine
286 turns on/off the information line in the top left hand corner of
287 the widget. If the value of showInfoLine is TRUE, the information
288 line will be displayed. If it is FALSE it won't.
289
290 setCDKViewerLLChar
291 sets the lower left hand corner of the widget's box to the given
292 character.
293
294 setCDKViewerLRChar
295 sets the lower right hand corner of the widget's box to the given
296 character.
297
298 setCDKViewerTitle
299 sets the title of the widget.
300
301 setCDKViewerULChar
302 sets the upper left hand corner of the widget's box to the given
303 character.
304
305 setCDKViewerURChar
306 sets the upper right hand corner of the widget's box to the given
307 character.
308
309 setCDKViewerVerticalChar
310 sets the vertical drawing character for the box to the given char‐
311 acter.
312
314 When the widget is activated there are several default key bindings
315 which will help the user enter or manipulate the information quickly.
316 The following table outlines the keys and their actions for this wid‐
317 get.
318
319 ┌───────────────────────────────────────────────────────────┐
320 │Key Action │
321 ├───────────────────────────────────────────────────────────┤
322 │Left Arrow Shifts the viewport one column left. │
323 │Right Arrow Shifts the viewport one column left │
324 │Up Arrow Scrolls the viewport one line up. │
325 │Down Arrow Scrolls the viewport one line down. │
326 ├───────────────────────────────────────────────────────────┤
327 │Prev Page │
328 │Ctrl-B │
329 │B │
330 │b Scroll one page backward. │
331 ├───────────────────────────────────────────────────────────┤
332 │Next Page │
333 │Ctrl-F │
334 │Space │
335 │F │
336 │f Scroll one page forward. │
337 ├───────────────────────────────────────────────────────────┤
338 │Home │
339 │| Shift the whole list to the far left. │
340 ├───────────────────────────────────────────────────────────┤
341 │End │
342 │$ Shift the whole list to the far right. │
343 ├───────────────────────────────────────────────────────────┤
344 │1 │
345 │< │
346 │g Moves to the first line in the viewer. │
347 ├───────────────────────────────────────────────────────────┤
348 │> │
349 │G Moves to the last line in the viewer. │
350 ├───────────────────────────────────────────────────────────┤
351 │L Moves half the distance to the end of │
352 │ the viewer. │
353 │l Moves half the distance to the top of │
354 │ the viewer. │
355 ├───────────────────────────────────────────────────────────┤
356 │? Searches up for a pattern. │
357 │/ Searches down for a pattern. │
358 │n Repeats last search. │
359 │N Repeats last search, reversed direction. │
360 │: Jumps to a given line. │
361 ├───────────────────────────────────────────────────────────┤
362 │i Displays file statistics. │
363 │s Displays file statistics. │
364 ├───────────────────────────────────────────────────────────┤
365 │Tab Switches buttons. │
366 │Return Exit the widget and return the index of │
367 │ the selected button. Set the widget │
368 │ data exitType to vNORMAL. │
369 │Escape Exit the widget and return -1. Set the │
370 │ widget data exitType to vESCAPE_HIT. │
371 │Ctrl-L Refreshes the screen. │
372 └───────────────────────────────────────────────────────────┘
374 cdk(3), cdk_binding(3), cdk_display(3), cdk_position(3), cdk_screen(3)
375
376
377
378 cdk_viewer(3)