cdk_viewer(3)
- NetBSD Manual Pages
cdk_viewer(3) cdk_viewer(3)
NAME
newCDKViewer, activateCDKViewer, setCDKViewer, setCDKViewerInfo, getCD-
KViewerInfo, setCDKViewerTitle, getCDKViewerTitle, setCDKViewerHigh-
light, getCDKViewerHighlight, setCDKViewerInfoLine, getCDKViewerInfo-
Line, setCDKViewerBox, getCDKViewerBox, setCDKViewerULChar, setCD-
KViewerURChar, setCDKViewerLLChar, setCDKViewerLRChar, setCDKViewerVer-
ticalChar, setCDKViewerHorizontalChar, setCDKViewerBoxAttribute, setCD-
KViewerBackgroundColor, drawCDKViewer, eraseCDKViewer, destroyCDKViewer
- Creates a managed curses viewer list widget.
SYNOPSIS
cc [ flag ... ] file ... -lcdk [ library ... ]
#include <cdk.h>
CDKVIEWER *newCDKViewer (CDKSCREEN *cdkscreen, int xpos, int ypos, int
height, int width, char **buttonList, int buttonCount, chtype button-
Highlight, boolean box, boolean shadow);
int activateCDKViewer (CDKVIEWER *viewer);
void setCDKViewer (CDKVIEWER *viewer, char *title, char **info, int
infoSize, chtype buttonAttribute, boolean interpret, boolean showLine-
Info, boolean box);
void setCDKViewerInfo (CDKVIEWER *viewer, char **itemList, int list-
Size, boolean numbers);
int getCDKViewerInfo (CDKVIEWER *viewer, char **itemList);
void setCDKViewerTitle (CDKVIEWER *viewer, char *title);
int getCDKViewerTitle (CDKVIEWER *viewer);
void setCDKViewerHighlight (CDKVIEWER *viewer, chtype highlight);
chtype getCDKViewerHighlight (CDKVIEWER *viewer);
void setCDKViewerInfoLine (CDKVIEWER *viewer, boolean showInfoLine);
boolean getCDKViewerInfoLine (CDKVIEWER *viewer);
void setCDKViewerULChar (CDKVIEWER *,viewer, chtype character);
void setCDKViewerURChar (CDKVIEWER *,viewer, chtype character);
void setCDKViewerLLChar (CDKVIEWER *,viewer, chtype character);
void setCDKViewerLRChar (CDKVIEWER *,viewer, chtype character);
void setCDKViewerVerticalChar (CDKVIEWER *,viewer, chtype character);
void setCDKViewerHorizontalChar (CDKVIEWER *,viewer, chtype character);
void setCDKViewerBoxAttribute (CDKVIEWER *,viewer, chtype character);
void setCDKViewerBackgroundColor (CDKVIEWER *,viewer, char * color);
void moveCDKViewer (CDKVIEWEE *viewer, int box, int box, boolean rela-
tive, boolean refresh);
void positionCDKViewer (CDKVIEWEE *viewer);
void drawCDKViewer (CDKVIEWER *viewer, boolean box);
void eraseCDKViewer (CDKVIEWER *viewer);
void destroyCDKViewer (CDKVIEWER *viewer);
void bindCDKObject (EObjectType widgetType, void *object, chtype key,
BINDFN function, void *data);
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
CDKVIEWER *newCDKViewer (CDKSCREEN *screen, int xpos, int ypos, int
height, int width, char **buttons, int buttonCount, chtype buttonHigh-
light, boolean box, boolean shadow);
This function creates a pointer to a viewer widget. The screen
parameter is the screen you wish this widget to be placed in. The
parameter xpos controls the placement of the object along the hori-
zontal axis. This parameter can accept an integer value or one of
the pre-defined values of LEFT, RIGHT, and CENTER. The parameter
ypos controls the placement of the object along the vertical axis.
This parameter can accept an integer value or one of the pre-defined
values of TOP, BOTTOM, and CENTER. The parameters height and width
state how tall and wide the viewer window is to be. The buttons is
an array of the button labels which are to be attached to the viewer
on the bottom; buttonCount tells the viewer how many buttons there
are. The parameter buttonHighlight is the highlight attribute of the
currently selected button. The box parameter states whether the wid-
get will be drawn with a box around it or not. The shadow parameter
accepts a boolean value to turn the shadow on or off around this
widget. If the widget could not be created then a NULL pointer is
returned.
int activateCDKViewer (CDKVIEWER *viewer);
This function 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 structure
member exitType to vNORMAL. If the character entered into this wid-
get was ESCAPE then the widget will return a value of -1 and the
structure member exitType will be set to vESCAPE_HIT.
void setCDKViewer (CDKVIEWER *viewer, char *title, char **info, int
infoSize, chtype buttonAttribute, boolean interpret, boolean showLine-
Info, boolean box);
This function lets the programmer modify certain elements of an
already defined viewer widget. The parameter title is the title to
be displayed on the top of the viewer. The parameter info is the
information to display, while infoSize states how many rows there
are in the info array. The parameter buttonAttribute states the
attribute of the current highlighted button. The boolean parameter
interpret tells the viewer to interpret the contents of info for Cdk
display command, or not. The showLineInfo boolean flag tells the
viewer to show or not 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.
int setCDKViewerInfo (CDKVIEWER *viewer, char **info, int infoSize,
boolean interpret);
This sets the contents of the viewer widget.
chtype **getCDKViewerInfo (CDKVIEWER *viewer, int *size);
This returns the contents of the viewer widget.
void setCDKViewerTitle (CDKVIEWER *viewer, char *title);
This sets the title of the widget.
chtype **getCDKViewerTitle (CDKVIEWER *viewer);
This returns the title of the widget.
void setCDKViewerHighlight (CDKVIEWER *viewer, chtype buttonHighlight);
This sets the highlight attribute of the buttons on the widget.
chtype getCDKViewerHighlight (CDKVIEWER *viewer);
This returns the attribute of the buttons.
void setCDKViewerInfoLine (CDKVIEWER *viewer, boolean showLineInfo);
This 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.
boolean getCDKViewerInfoLine (CDKVIEWER *viewer);
This returns a boolena value stating if the information line is on
or off.
void setCDKViewerBox (CDKVIEWER *viewer, boolean Box);
This sets whether or not the widget will be draw with a box around
it.
boolean getCDKViewerBox (CDKVIEWER *viewer);
This returns whether or not the widget will be drawn with a box
around it.
void setCDKViewerULChar (CDKVIEWER *viewer, chtype character);
This function sets the upper left hand corner of the widgets box to
the given character.
void setCDKViewerURChar (CDKVIEWER *viewer, chtype character);
This function sets the upper right hand corner of the widgets box to
the given character.
void setCDKViewerLLChar (CDKVIEWER *viewer, chtype character);
This function sets the lower left hand corner of the widgets box to
the given character.
void setCDKViewerLRChar (CDKVIEWER *viewer, chtype character);
This function sets the lower right hand corner of the widgets box to
the given character.
void setCDKViewerVerticalChar (CDKVIEWER *viewer, chtype character);
This function sets the vertical drawing character for the box to the
given character.
void setCDKViewerHorizontalChar (CDKVIEWER *viewer, chtype character);
This function sets the horizontal drawing character for the box to
the given character.
void setCDKViewerBoxAttribute (CDKVIEWER *viewer, chtype attribute);
This function sets the attribute of the box.
void setCDKViewerBackgroundColor (CDKVIEWER *viewer, char *color);
This sets the background color of the widget. The parameter color is
in the format of the Cdk format strings. To get more information
look at the cdk_display manual page.
void moveCDKViewer (CDKVIEWEE *viewer, int xpos, int ypos, boolean rel-
ative, boolean refresh);
This function moves the given widget to the given position. The
parameters xpos and ypos is the new position of the widget. The
parameter xpos can accept an integer value or one of the pre-defined
values of TOP, BOTTOM, and CENTER. The parameter ypos can accept an
integer value or one of the pre-defined values of 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
of 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 or
not.
void positionCDKViewer (CDKVIEWEE *viewer);
This function allows the user to move the widget around the screen
via the cursor/keypad keys. The following key bindings can be used
to move the widget around the screen.
Key Bindings
Key Action
Up Arrow Moves the widget up one line.
Down Arrow Moves the widget down one line.
Left Arrow Moves the widget left one column
Right Arrow Moves the widget right one column
Keypad-1 Moves the widget down one line
and left one column.
Keypad-2 Moves the widget down one line.
Keypad-3 Moves the widget down one line
and right one column.
Keypad-4 Moves the widget left one column
Keypad-5 Centers the widget both vertically
and horizontally.
Keypad-6 Moves the widget right one column
Keypad-7 Moves the widget up one line
and left one column.
Keypad-8 Moves the widget up one line.
Keypad-9 Moves the widget up one line
and right one column.
t Moves the widget to the top of the screen.
b Moves the widget to the bottom of the screen.
l Moves the widget to the left of the screen.
r Moves the widget to the right of the screen.
c Centers the widget between the left and
right of the window.
C Centers the widget between the top and
bottom of the window.
Escape Returns the widget to its original position.
Return Exits the function and leaves the widget
where it was.
Keypad means that if the keyboard you are using has a keypad,
then the Num-Lock light has to be on in order to use the keys as
listed. (The numeric keys at the top of the keyboard will work as
well.)
void drawCDKViewer (CDKVIEWER *viewer, boolean box);
This function draws the viewer widget on the screen. The box
option draws the widget with or without a box.
void eraseCDKViewer (CDKVIEWER *viewer);
This function removes the widget from the screen. This does
NOT destroy the widget.
void destroyCDKViewer (CDKVIEWER *viewer);
This function removes the widget from the screen and frees up
any memory the object may be using.
void bindCDKObject (EObjectType widgetType, void *object, char
key, BINDFN function, void *data);
This function allows the user to create special key bindings.
The widgetType parameter is a defined type which states what
Cdk object type is being used. To learn more about the type
EObjectType read the cdk_binding manual page. The object
parameter is the pointer to the widget object. The key is the
character to bind. The function is the function type. To learn
more about the key binding call-back function types read the
cdk_binding manual page. The last parameter data is a pointer
to any data that needs to get passed to the call-back func-
tion.
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 wid-
get.
Key Action
Left Arrow Shifts the contents of the
viewer one character left.
Right Arrow Shifts the contents of the
viewer one character left
Up Arrow Scrolls the contents of the
viewer one line up.
Down Arrow Scrolls the contents of the
viewer one line up.
Prev Page Moves one page backwards.
Ctrl-B Moves one page backwards.
B Moves one page backwards.
b Moves one page backwards.
Next Page Moves one page forwards.
Ctrl-F Moves one page forwards.
Space Moves one page forwards.
F Moves one page forwards.
f Moves one page forwards.
Home Shifts the whole list to
the far left.
| Shifts the whole list to
the far left.
End Shifts the whole list to
the far right
$ Shifts the whole list to
the far right.
g Moves to the first line
in the viewer.
1 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.
: Jumps to a given line.
i Displays file statistics.
s Displays file statistics.
Tab Switches buttons.
Return Exits the widget and returns
an integer value representing
which button was selected. This
also sets the structure member
exitType in the widget pointer
to the value of vNORMAL.
Escape Exits the widget and returns -1.
This also sets the structure
member exitType in the
widget pointer to the value of
vESCAPE_HIT.
Ctrl-L Refreshes the screen.
SEE ALSO
cdk(3), cdk_binding(3), cdk_display(3), cdk_screen(3)
NOTES
The header file <cdk.h> automatically includes the header files
<curses.h>, <stdlib.h>, <string.h>, <ctype.h>, <unistd.h>, <dirent.h>,
<time.h>, <errno.h>, <pwd.h>, <grp.h>, <sys/stat.h>, and <sys/types.h>.
The <curses.h> header file includes <stdio.h> and <unctrl.h>.
If you have Ncurses installed on your machine add -DNCURSES to the com-
pile line to include the Ncurses header files instead.
24 April 1997 cdk_viewer(3)
Powered by man-cgi (2024-03-20).
Maintained for NetBSD
by Kimmo Suominen.
Based on man-cgi by Panagiotis Christias.