cdk_viewer(3)

NAME
cdk_viewer - curses viewer list widget.

SYNOPSIS

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

#include <cdk/cdk.h>

int activateCDKViewer (
    CDKVIEWER *viewer);

void cleanCDKViewer (
    CDKVIEWER *viewer);

void destroyCDKViewer (
    CDKVIEWER *viewer);

void drawCDKViewer (
    CDKVIEWER *viewer,
    boolean box);

void eraseCDKViewer (
    CDKVIEWER *viewer);

boolean getCDKViewerBox (
    CDKVIEWER *viewer);

chtype getCDKViewerHighlight (
    CDKVIEWER *viewer);

chtype **getCDKViewerInfo (
    CDKVIEWER *viewer,
    char **itemList);

boolean getCDKViewerInfoLine (
    CDKVIEWER *viewer);

chtype **getCDKViewerTitle (
    CDKVIEWER *viewer);

void moveCDKViewer (
    CDKVIEWEE *viewer,
    int box,
    int box,
    boolean relative,
    boolean refresh);

CDKVIEWER *newCDKViewer (
    CDKSCREEN *cdkscreen,
    int xpos,
    int ypos,
    int height,
    int width,
    char **buttonList,
    int buttonCount,
    chtype buttonHighlight,
    boolean box,
    boolean shadow);

void positionCDKViewer (
    CDKVIEWER *viewer);

void setCDKViewer (
    CDKVIEWER *viewer,
    char *title,
    char **list,
    int listSize,
    chtype buttonAttribute,
    boolean interpret,
    boolean showLineInfo,
    boolean box);

void setCDKViewerBackgroundAttrib (
    CDKVIEWER *viewer,
    chtype attribute);

void setCDKViewerBackgroundColor (
    CDKVIEWER *viewer,
    char * color);

void setCDKViewerBox (
    CDKVIEWER *viewer,
    boolean Box);

void setCDKViewerBoxAttribute (
    CDKVIEWER *viewer,
    chtype character);

void setCDKViewerHighlight (
    CDKVIEWER *viewer,
    chtype highlight);

void setCDKViewerHorizontalChar (
    CDKVIEWER *viewer,
    chtype character);

void setCDKViewerInfo (
    CDKVIEWER *viewer,
    char **list,
    int listSize,
    boolean interpret);

void setCDKViewerTitle (
    CDKVIEWER *viewer,
    char *title);

void setCDKViewerInfoLine (
    CDKVIEWER *viewer,
    boolean showInfoLine);

void setCDKViewerLLChar (
    CDKVIEWER *viewer,
    chtype character);

void setCDKViewerLRChar (
    CDKVIEWER *viewer,
    chtype character);

void setCDKViewerTitle (
    CDKVIEWER *viewer,
    char *title);

void setCDKViewerULChar (
    CDKVIEWER *viewer,
    chtype character);

void setCDKViewerURChar (
    CDKVIEWER *viewer,
    chtype character);

void setCDKViewerVerticalChar (
    CDKVIEWER *viewer,
    chtype character);

DESCRIPTION
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.

AVAILABLE FUNCTIONS

activateCDKViewer
    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.

cleanCDKViewer
    clears the information from the window.

destroyCDKViewer
    removes the widget from the screen and frees memory the object used.

drawCDKViewer
    draws the viewer widget on the screen. If the box option is true, the widget is drawn with a box.

eraseCDKViewer
    removes the widget from the screen. This does NOT destroy the widget.

getCDKViewerBox
    returns true if the widget will be drawn with a box around it.

getCDKViewerHighlight
    returns the attribute of the buttons.

getCDKViewerInfo
    returns the contents of the viewer widget.

getCDKViewerInfoLine
    returns true if the information line is on.

getCDKViewerTitle
    returns the title of the widget.

moveCDKViewer
    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:

    screen
        is the screen you wish this widget to be placed in.

    xpos
        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.

    ypos
        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.

    height and

    width
        are the height and width of the viewer window.

    buttons
        is an array of the button labels which are to be attached to the viewer on the bottom.

    buttonCount
        is the number of buttons in buttons.

    buttonHighlight
        is the highlight attribute of the currently selected button.

    box is true if the widget should be drawn with a box around it.

    shadow
        turns the shadow on or off around this widget.

    If the widget could not be created then a NULL pointer is returned.

positionCDKViewer
    allows the user to move the widget around the screen via the cursor/keypad keys. See cdk_position (3) for key bindings.

setCDKViewer
    lets the programmer modify several elements of an existing viewer widget. The parameter title is the title to be displayed on the top of the viewer.

    The parameter list is the information to display, while 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.

    The parameter 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.

setCDKViewerBackgroundAttrib
    sets the background attribute of the widget. The parameter attribute is a curses attribute, e.g., A_BOLD.

setCDKViewerBackgroundColor
    sets the background color of the widget. The parameter color is in the format of the Cdk format strings. See cdk_display (3).

setCDKViewerBox
    sets whether the widget will be drawn with a box around it.

setCDKViewerBoxAttribute
    sets the attribute of the box.

setCDKViewerHighlight
    sets the highlight attribute of the buttons on the widget.

setCDKViewerHorizontalChar
    sets the horizontal drawing character for the box to the given character.

setCDKViewerInfo
    sets the contents of the viewer widget. See setCDKViewer for parameter descriptions.

setCDKViewerInfoLine
    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.

setCDKViewerLLChar
    sets the lower left hand corner of the widget's box to the given character.

setCDKViewerLRChar
    sets the lower right hand corner of the widget's box to the given character.

setCDKViewerTitle
    sets the title of the widget.

setCDKViewerULChar
    sets the upper left hand corner of the widget's box to the given character.

setCDKViewerURChar
    sets the upper right hand corner of the widget's box to the given character.

setCDKViewerVerticalChar
    sets the vertical drawing character for the box to the given character.

KEY BINDINGS
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.

Moves half the distance to the top of the viewer.
Exit the widget and return the index of the selected button.
Set the widget data exitType to vNORMAL.
Exit the widget and return -1.
Set the widget data exitType to vESCAPE_HIT.
]
.nr 3crow 0
KeyAction
.nr 3brule 1
]
.nr 3brule 0
.nr 3crow 1
Left ArrowShifts the viewport one column left.
.nr 3brule 1
.nr 3crow 2
Right ArrowShifts the viewport one column left
.nr 3brule 1
.nr 3crow 3
Up ArrowScrolls the viewport one line up.
.nr 3brule 1
.nr 3crow 4
Down ArrowScrolls the viewport one line down.
.nr 3brule 1
]
.nr 3brule 0
.nr 3crow 5
Prev Page
.nr 3brule 1
.nr 3crow 6
Ctrl-B
.nr 3brule 1
.nr 3crow 7
B
.nr 3brule 1
.nr 3crow 8
bScroll one page backward.
.nr 3brule 1
]
.nr 3brule 0
.nr 3crow 9
Next Page
.nr 3brule 1
.nr 3crow 10
Ctrl-F
.nr 3brule 1
.nr 3crow 11
Space
.nr 3brule 1
.nr 3crow 12
F
.nr 3brule 1
.nr 3crow 13
fScroll one page forward.
.nr 3brule 1
]
.nr 3brule 0
.nr 3crow 14
Home
.nr 3brule 1
.nr 3crow 15
|Shift the whole list to the far left.
.nr 3brule 1
]
.nr 3brule 0
.nr 3crow 16
End
.nr 3brule 1
.nr 3crow 17
$Shift the whole list to the far right.
.nr 3brule 1
]
.nr 3brule 0
.nr 3crow 18
1
.nr 3brule 1
.nr 3crow 19
<
.nr 3brule 1
.nr 3crow 20
gMoves to the first line in the viewer.
.nr 3brule 1
]
.nr 3brule 0
.nr 3crow 21
>
.nr 3brule 1
.nr 3crow 22
GMoves to the last line in the viewer.
.nr 3brule 1
]
.nr 3brule 0
.nr 3crow 23
L
.nr 3brule 1
.nr 3crow 24
l
.nr 3brule 1
]
.nr 3brule 0
.nr 3crow 25
?Searches up for a pattern.
.nr 3brule 1
.nr 3crow 26
/Searches down for a pattern.
.nr 3brule 1
.nr 3crow 27
nRepeats last search.
.nr 3brule 1
.nr 3crow 28
NRepeats last search, reversed direction.
.nr 3brule 1
.nr 3crow 29
:Jumps to a given line.
.nr 3brule 1
]
.nr 3brule 0
.nr 3crow 30
iDisplays file statistics.
.nr 3brule 1
.nr 3crow 31
sDisplays file statistics.
.nr 3brule 1
]
.nr 3brule 0
.nr 3crow 32
TabSwitches buttons.
.nr 3brule 1
.nr 3crow 33
Return
.nr 3brule 1
.nr 3crow 34
Escape
.nr 3brule 1
.nr 3crow 35
Ctrl-LRefreshes the screen.
.nr 3brule 1

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