1cdk_viewer(3)              Library Functions Manual              cdk_viewer(3)
2
3
4

NAME

6       cdk_viewer - curses viewer list widget.
7

SYNOPSIS

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

DESCRIPTION

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

AVAILABLE FUNCTIONS

142       activateCDKViewer
143            activates the viewer widget and lets the user  interact  with  the
144            widget.
145
146            ·   The parameter viewer is a pointer to a non-NULL viewer widget.
147
148            ·   If  the actions parameter is passed with a non-NULL value, the
149                characters in the array will be injected into the widget.
150
151                To activate the widget interactively pass in  a  NULL  pointer
152                for actions.
153
154            If  the  character  entered  into  this widget is RETURN then this
155            function will return a value from 0 to the number of  buttons  -1,
156            representing  the  button  selected.   It will also set the widget
157            data exitType to vNORMAL.
158
159            If the character entered into this widget  was  ESCAPE,  then  the
160            widget will return a value of -1 and the widget data exitType will
161            be set to vESCAPE_HIT.
162
163       cleanCDKViewer
164            clears the information from the window.
165
166       destroyCDKViewer
167            removes the widget from the screen and  frees  memory  the  object
168            used.
169
170       drawCDKViewer
171            draws the viewer widget on the screen.  If the box option is true,
172            the widget is drawn with a box.
173
174       eraseCDKViewer
175            removes the widget from the screen.  This  does  NOT  destroy  the
176            widget.
177
178       getCDKViewerBox
179            returns true if the widget will be drawn with a box around it.
180
181       getCDKViewerHighlight
182            returns the attribute of the buttons.
183
184       getCDKViewerInfo
185            returns the contents of the viewer widget.
186
187       getCDKViewerInfoLine
188            returns true if the information line is on.
189
190       getCDKViewerTitle
191            returns the title of the widget.
192
193       moveCDKViewer
194            function moves the given widget to the given position.
195
196            ·   The  parameters xpos and ypos are the new position of the wid‐
197                get.
198
199                The parameter xpos may be an integer or one of the pre-defined
200                values TOP, BOTTOM, and CENTER.
201
202                The parameter ypos may be an integer or one of the pre-defined
203                values LEFT, RIGHT, and CENTER.
204
205            ·   The parameter relative states whether the xpos/ypos pair is  a
206                relative move or an absolute move.
207
208                For  example,  if  xpos  = 1 and ypos = 2 and relative = TRUE,
209                then the widget would move one row down and two columns right.
210                If the value of relative was FALSE, then the widget would move
211                to the position (1,2).
212
213                Do not use the values TOP, BOTTOM, LEFT, RIGHT, or CENTER when
214                relative = TRUE.  (weird things may happen).
215
216            ·   The  final  parameter  refresh is a boolean value which states
217                whether the widget will get refreshed after the move.
218
219       *newCDKViewer
220            function creates a viewer widget and  returns  a  pointer  to  it.
221            Parameters:
222
223            screen
224                 is the screen you wish this widget to be placed in.
225
226            xpos controls  the  placement  of  the object along the horizontal
227                 axis.  It may be an integer or one of the pre-defined  values
228                 LEFT, RIGHT, and CENTER.
229
230            ypos controls the placement of the object along the vertical axis.
231                 It may be an integer or one of the  pre-defined  values  TOP,
232                 BOTTOM, and CENTER.
233
234            height and
235
236            width
237                 are the height and width of the viewer window.
238
239            buttons
240                 is  an array of the button labels which are to be attached to
241                 the viewer on the bottom.
242
243            buttonCount
244                 is the number of buttons in buttons.
245
246            buttonHighlight
247                 is the highlight attribute of the currently selected button.
248
249            box  is true if the widget should be drawn with a box around it.
250
251            shadow
252                 turns the shadow on or off around this widget.
253
254            If the widget  could  not  be  created  then  a  NULL  pointer  is
255            returned.
256
257       positionCDKViewer
258            allows  the user to move the widget around the screen via the cur‐
259            sor/keypad keys.  See cdk_position (3) for key bindings.
260
261       setCDKViewer
262            lets the programmer modify several elements of an existing  viewer
263            widget.
264
265            ·   title is the title to be displayed on the top of the viewer.
266
267            ·   list is the information to display,
268
269            ·   listSize states how many rows there are in the list array.  If
270                listSize is negative, list is  scanned  to  find  its  length,
271                including files which will be included via embedded links.
272
273            ·   buttonAttribute  states  the  attribute  of  the current high‐
274                lighted button.
275
276            ·   The boolean parameter interpret tells the viewer to  interpret
277                the contents of list for Cdk display command.
278
279            ·   The showLineInfo boolean flag tells the viewer to show to show
280                the line number and percentage in the top left corner  of  the
281                viewer window.
282
283            ·   The  parameters box and shadow are the same as in the function
284                description of newCDKViewer.
285
286       setCDKViewerBackgroundAttrib
287            sets the background attribute of the widget.
288
289            The parameter attribute is a curses attribute, e.g., A_BOLD.
290
291       setCDKViewerBackgroundColor
292            sets the background color of the widget.
293
294            The parameter color is in the format of the Cdk format strings.
295
296            See cdk_display (3).
297
298       setCDKViewerBox
299            sets whether the widget will be drawn with a box around it.
300
301       setCDKViewerBoxAttribute
302            sets the attribute of the box.
303
304       setCDKViewerHighlight
305            sets the highlight attribute of the buttons on the widget.
306
307       setCDKViewerHorizontalChar
308            sets the horizontal drawing character for the  box  to  the  given
309            character.
310
311       setCDKViewerInfo
312            sets the contents of the viewer widget.
313
314            See setCDKViewer for parameter descriptions.
315
316       setCDKViewerInfoLine
317            turns  on/off  the information line in the top left hand corner of
318            the widget.  If the value of showInfoLine is TRUE, the information
319            line will be displayed.  If it is FALSE it won't.
320
321       setCDKViewerLLChar
322            sets  the  lower left hand corner of the widget's box to the given
323            character.
324
325       setCDKViewerLRChar
326            sets the lower right hand corner of the widget's box to the  given
327            character.
328
329       setCDKViewerTitle
330            sets the title of the widget.
331
332       setCDKViewerULChar
333            sets  the  upper left hand corner of the widget's box to the given
334            character.
335
336       setCDKViewerURChar
337            sets the upper right hand corner of the widget's box to the  given
338            character.
339
340       setCDKViewerVerticalChar
341            sets the vertical drawing character for the box to the given char‐
342            acter.
343

KEY BINDINGS

345       When the widget is activated there are  several  default  key  bindings
346       which  will  help the user enter or manipulate the information quickly.
347       The following table outlines the keys and their actions for  this  wid‐
348       get.
349
350            ┌───────────────────────────────────────────────────────────┐
351Key               Action                                   
352            ├───────────────────────────────────────────────────────────┤
353            │Left Arrow        Shifts the viewport one column left.     │
354            │Right Arrow       Shifts the viewport one column left      │
355            │Up Arrow          Scrolls the viewport one line up.        │
356            │Down Arrow        Scrolls the viewport one line down.      │
357            ├───────────────────────────────────────────────────────────┤
358            │Prev Page                                                  │
359            │Ctrl-B                                                     │
360            │B                                                          │
361            │b                 Scroll one page backward.                │
362            ├───────────────────────────────────────────────────────────┤
363            │Next Page                                                  │
364            │Ctrl-F                                                     │
365            │Space                                                      │
366            │F                                                          │
367            │f                 Scroll one page forward.                 │
368            ├───────────────────────────────────────────────────────────┤
369            │Home                                                       │
370            │|                 Shift the whole list to the far left.    │
371            ├───────────────────────────────────────────────────────────┤
372            │End                                                        │
373            │$                 Shift the whole list to the far right.   │
374            ├───────────────────────────────────────────────────────────┤
375            │1                                                          │
376            │<                                                          │
377            │g                 Moves to the first line in the viewer.   │
378            ├───────────────────────────────────────────────────────────┤
379            │>                                                          │
380            │G                 Moves to the last line in the viewer.    │
381            ├───────────────────────────────────────────────────────────┤
382            │L                 Moves  half  the  distance to the end of │
383            │                  the viewer.                              │
384            │l                 Moves half the distance to  the  top  of │
385            │                  the viewer.                              │
386            ├───────────────────────────────────────────────────────────┤
387            │?                 Searches up for a pattern.               │
388            │/                 Searches down for a pattern.             │
389            │n                 Repeats last search.                     │
390            │N                 Repeats last search, reversed direction. │
391            │:                 Jumps to a given line.                   │
392            ├───────────────────────────────────────────────────────────┤
393            │i                 Displays file statistics.                │
394            │s                 Displays file statistics.                │
395            ├───────────────────────────────────────────────────────────┤
396            │Tab               Switches buttons.                        │
397            │Return            Exit  the widget and return the index of │
398            │                  the selected  button.   Set  the  widget │
399            │                  data exitType to vNORMAL.                │
400            │Escape            Exit  the widget and return -1.  Set the │
401            │                  widget data exitType to vESCAPE_HIT.     │
402            │Ctrl-L            Refreshes the screen.                    │
403            └───────────────────────────────────────────────────────────┘

SEE ALSO

405       cdk(3), cdk_binding(3), cdk_display(3), cdk_position(3), cdk_screen(3)
406
407
408
409                                                                 cdk_viewer(3)
Impressum