DOKK / manpages / debian 11 / libcdk5-dev / cdk_viewer.3.en
cdk_viewer(3) Library Functions Manual cdk_viewer(3)

cdk_viewer - curses viewer list widget.

cc [ flag ... ] file ... -lcdk [ library ... ]

#include <cdk.h>

CDKVIEWER *viewer);
CDKVIEWER *viewer);
CDKVIEWER *viewer);
CDKVIEWER *viewer,
boolean box);
CDKVIEWER *viewer);
CDKVIEWER *viewer);
CDKVIEWER *viewer);
CDKVIEWER *viewer,
char **itemList);
CDKVIEWER *viewer);
CDKVIEWER *viewer);
CDKVIEWEE *viewer,
int box,
int box,
boolean relative,
boolean refresh);
CDKSCREEN *cdkscreen,
int xpos,
int ypos,
int height,
int width,
CDK_CONST char **buttonList,
int buttonCount,
chtype buttonHighlight,
boolean box,
boolean shadow);
CDKVIEWER *viewer);
CDKVIEWER *viewer,
const char *title,
CDK_CONST char **list,
int listSize,
chtype buttonAttribute,
boolean interpret,
boolean showLineInfo,
boolean box);
CDKVIEWER *viewer,
chtype attribute);
CDKVIEWER *viewer,
const char * color);
CDKVIEWER *viewer,
boolean Box);
CDKVIEWER *viewer,
chtype character);
CDKVIEWER *viewer,
chtype highlight);
CDKVIEWER *viewer,
chtype character);
CDKVIEWER *viewer,
CDK_CONST char **list,
int listSize,
boolean interpret);
CDKVIEWER *viewer,
boolean showInfoLine);
CDKVIEWER *viewer,
chtype character);
CDKVIEWER *viewer,
chtype character);
CDKVIEWER *viewer,
const char *title);
CDKVIEWER *viewer,
chtype character);
CDKVIEWER *viewer,
chtype character);
CDKVIEWER *viewer,
chtype character);

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

activates the viewer widget and lets the user interact with the widget.
  • The parameter viewer is a pointer to a non-NULL viewer widget.
  • If the actions parameter is passed with a non-NULL value, the characters in the array will be injected into the widget.
To activate the widget interactively pass in a NULL pointer for actions.
If the character entered into this widget is RETURN then this function will return a value from 0 to the number of buttons -1, representing the button selected. It will also set the widget data exitType to vNORMAL.
If the character entered into this widget was ESCAPE then the widget will return a value of -1 and the widget data exitType will be set to vESCAPE_HIT.
clears the information from the window.
removes the widget from the screen and frees memory the object used.
draws the viewer widget on the screen. If the box option is true, the widget is drawn with a box.
removes the widget from the screen. This does NOT destroy the widget.
returns true if the widget will be drawn with a box around it.
returns the attribute of the buttons.
returns the contents of the viewer widget.
returns true if the information line is on.
returns the title of the widget.
function moves the given widget to the given position.
The parameters xpos and ypos are the new position of the widget.
The parameter xpos may be an integer or one of the pre-defined values TOP, BOTTOM, and CENTER.
The parameter ypos may be an integer or one of the pre-defined values LEFT, RIGHT, and CENTER.
The parameter relative states whether the xpos/ypos pair is a relative move or an absolute move.
For example, if xpos = 1 and ypos = 2 and relative = TRUE, then the widget would move one row down and two columns right. If the value of relative was FALSE then the widget would move to the position (1,2).
Do not use the values TOP, BOTTOM, LEFT, RIGHT, or CENTER when relative = TRUE. (weird things may happen).
The final parameter refresh is a boolean value which states whether the widget will get refreshed after the move.
*newCDKViewer
function creates a viewer widget and returns a pointer to it. Parameters:
is the screen you wish this widget to be placed in.
controls the placement of the object along the horizontal axis. It may be an integer or one of the pre-defined values LEFT, RIGHT, and CENTER.
controls the placement of the object along the vertical axis. It may be an integer or one of the pre-defined values TOP, BOTTOM, and CENTER.
are the height and width of the viewer window.
is an array of the button labels which are to be attached to the viewer on the bottom.
is the number of buttons in buttons.
is the highlight attribute of the currently selected button.
is true if the widget should be drawn with a box around it.
turns the shadow on or off around this widget.
If the widget could not be created then a NULL pointer is returned.
allows the user to move the widget around the screen via the cursor/keypad keys. See cdk_position (3) for key bindings.
lets the programmer modify several elements of an existing viewer widget.
  • title is the title to be displayed on the top of the viewer.
  • list is the information to display,
  • listSize states how many rows there are in the list array. If listSize is negative, list is scanned to find its length, including files which will be included via embedded links.
  • buttonAttribute states the attribute of the current highlighted button.
  • The boolean parameter interpret tells the viewer to interpret the contents of list for Cdk display command.
  • The showLineInfo boolean flag tells the viewer to show to show the line number and percentage in the top left corner of the viewer window.
  • The parameters box and shadow are the same as in the function description of newCDKViewer.
sets the background attribute of the widget.
The parameter attribute is a curses attribute, e.g., A_BOLD.
sets the background color of the widget.
The parameter color is in the format of the Cdk format strings.
See cdk_display (3).
sets whether the widget will be drawn with a box around it.
sets the attribute of the box.
sets the highlight attribute of the buttons on the widget.
sets the horizontal drawing character for the box to the given character.
sets the contents of the viewer widget.
See setCDKViewer for parameter descriptions.
turns on/off the information line in the top left hand corner of the widget. If the value of showInfoLine is TRUE, the information line will be displayed. If it is FALSE it won't.
sets the lower left hand corner of the widget's box to the given character.
sets the lower right hand corner of the widget's box to the given character.
sets the title of the widget.
sets the upper left hand corner of the widget's box to the given character.
sets the upper right hand corner of the widget's box to the given character.
sets the vertical drawing character for the box to the given character.

When the widget is activated there are several default key bindings which will help the user enter or manipulate the information quickly. The following table outlines the keys and their actions for this widget.

Key Action
Left Arrow Shifts the viewport one column left.
Right Arrow Shifts the viewport one column left
Up Arrow Scrolls the viewport one line up.
Down Arrow Scrolls the viewport one line down.
Prev Page
Ctrl-B
B
b Scroll one page backward.
Next Page
Ctrl-F
Space
F
f Scroll one page forward.
Home
| Shift the whole list to the far left.
End
$ Shift the whole list to the far right.
1
<
g Moves to the first line in the viewer.
>
G Moves to the last line in the viewer.
L Moves half the distance to the end of the viewer.
l Moves half the distance to the top of the viewer.
? Searches up for a pattern.
/ Searches down for a pattern.
n Repeats last search.
N Repeats last search, reversed direction.
: Jumps to a given line.
i Displays file statistics.
s Displays file statistics.
Tab Switches buttons.
Return Exit the widget and return the index of the selected button. Set the widget data exitType to vNORMAL.
Escape Exit the widget and return -1. Set the widget data exitType to vESCAPE_HIT.
Ctrl-L Refreshes the screen.

cdk(3), cdk_binding(3), cdk_display(3), cdk_position(3), cdk_screen(3)