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                      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                      char *title,
70                      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                      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                      char **list,
104                      int listSize,
105                      boolean interpret);
106
107       void setCDKViewerTitle (
108                      CDKVIEWER *viewer,
109                      char *title);
110
111       void setCDKViewerInfoLine (
112                      CDKVIEWER *viewer,
113                      boolean showInfoLine);
114
115       void setCDKViewerLLChar (
116                      CDKVIEWER *viewer,
117                      chtype character);
118
119       void setCDKViewerLRChar (
120                      CDKVIEWER *viewer,
121                      chtype character);
122
123       void setCDKViewerTitle (
124                      CDKVIEWER *viewer,
125                      char *title);
126
127       void setCDKViewerULChar (
128                      CDKVIEWER *viewer,
129                      chtype character);
130
131       void setCDKViewerURChar (
132                      CDKVIEWER *viewer,
133                      chtype character);
134
135       void setCDKViewerVerticalChar (
136                      CDKVIEWER *viewer,
137                      chtype character);
138

DESCRIPTION

140       The Cdk viewer widget creates a file viewer widget.  This widget allows
141       a user to interact with a file.  It does NOT  allow  editing,  this  is
142       view  only.  The following are functions which create or manipulate the
143       Cdk viewer list widget.
144

AVAILABLE FUNCTIONS

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

KEY BINDINGS

318       When  the  widget  is  activated there are several default key bindings
319       which will help the user enter or manipulate the  information  quickly.
320       The  following  table outlines the keys and their actions for this wid‐
321       get.
322
323            ┌───────────────────────────────────────────────────────────┐
324Key               Action                                   
325            ├───────────────────────────────────────────────────────────┤
326            │Left Arrow        Shifts the viewport one column left.     │
327            │Right Arrow       Shifts the viewport one column left      │
328            │Up Arrow          Scrolls the viewport one line up.        │
329            │Down Arrow        Scrolls the viewport one line down.      │
330            ├───────────────────────────────────────────────────────────┤
331            │Prev Page                                                  │
332            │Ctrl-B                                                     │
333            │B                                                          │
334            │b                 Scroll one page backward.                │
335            ├───────────────────────────────────────────────────────────┤
336            │Next Page                                                  │
337            │Ctrl-F                                                     │
338            │Space                                                      │
339            │F                                                          │
340            │f                 Scroll one page forward.                 │
341            ├───────────────────────────────────────────────────────────┤
342            │Home                                                       │
343            │|                 Shift the whole list to the far left.    │
344            ├───────────────────────────────────────────────────────────┤
345            │End                                                        │
346            │$                 Shift the whole list to the far right.   │
347            ├───────────────────────────────────────────────────────────┤
348            │1                                                          │
349            │<                                                          │
350            │g                 Moves to the first line in the viewer.   │
351            ├───────────────────────────────────────────────────────────┤
352            │>                                                          │
353            │G                 Moves to the last line in the viewer.    │
354            ├───────────────────────────────────────────────────────────┤
355            │L                 Moves half the distance to  the  end  of │
356            │                  the viewer.                              │
357            │l                 Moves  half  the  distance to the top of │
358            │                  the viewer.                              │
359            ├───────────────────────────────────────────────────────────┤
360            │?                 Searches up for a pattern.               │
361            │/                 Searches down for a pattern.             │
362            │n                 Repeats last search.                     │
363            │N                 Repeats last search, reversed direction. │
364            │:                 Jumps to a given line.                   │
365            ├───────────────────────────────────────────────────────────┤
366            │i                 Displays file statistics.                │
367            │s                 Displays file statistics.                │
368            ├───────────────────────────────────────────────────────────┤
369            │Tab               Switches buttons.                        │
370            │Return            Exit the widget and return the index  of │
371            │                  the  selected  button.   Set  the widget │
372            │                  data exitType to vNORMAL.                │
373            │Escape            Exit the widget and return -1.  Set  the │
374            │                  widget data exitType to vESCAPE_HIT.     │
375            │Ctrl-L            Refreshes the screen.                    │
376            └───────────────────────────────────────────────────────────┘

SEE ALSO

378       cdk(3), cdk_binding(3), cdk_display(3), cdk_position(3), cdk_screen(3)
379
380
381
382                                                                 cdk_viewer(3)
Impressum