NetBSD/dist/cdk/man/cdk_fselect.3

513 lines
20 KiB
Groff
Raw Normal View History

.de It
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH cdk_fselect 3 "24 April 1997"
.SH NAME
newCDKFselect, activateCDKFselect, injectCDKFselect,
setCDKFselect,
setCDKFselectDirectory, getCDKFselectDirectory,
setCDKFselectFillerChar, getCDKFselectFillerChar,
setCDKFselectHighlight, getCDKFselectHighlight,
setCDKFselectFileArttibute, getCDKFselectFileArttibute,
setCDKFselectDirArttibute, getCDKFselectDirArttibute,
setCDKFselectLinkArttibute, getCDKFselectLinkArttibute,
setCDKFselectSocketArttibute, getCDKFselectSocketArttibute,
setCDKFselectBox, getCDKFselectBox,
setCDKFselectULChar, setCDKFselectURChar,
setCDKFselectLLChar, setCDKFselectLRChar,
setCDKFselectVerticalChar, setCDKFselectHorizontalChar,
setCDKFselectBoxAttribute,
setCDKFselectBackgroundColor,
drawCDKFselect, eraseCDKFselect, destroyCDKFselect \-
Creates a managed curses file selector widget.
.SH SYNOPSIS
.LP
.B cc
.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|."
.B \-lcdk
.RI "[ " "library" " \|.\|.\|. ]"
.LP
#include <cdk.h>
.LP
.BI "CDKFSELECT *newCDKFselect (CDKSCREEN *" "cdkscreen",
.BI "int " "xpos",
.BI "int " "ypos",
.BI "int " "height",
.BI "int " "width",
.BI "char *" "title",
.BI "char *" "label",
.BI "chtype " "fieldAttribute",
.BI "chtype " "fillerCharacter",
.BI "chtype " "highlight",
.BI "char *" "dirAttribute",
.BI "char *" "fileAttribute",
.BI "char *" "linkAttribute",
.BI "char *" "sockAttribute",
.BI "boolean " "box",
.BI "boolean " "shadow");
.LP
.BI "char *activateCDKFselect (CDKFSELECT *" "fselect",
.BI "chtype *" "actions");
.LP
.BI "char *injectCDKFselect (CDKFSELECT *" "fselect",
.BI "chtype " "input");
.LP
.BI "void setCDKFselect (CDKFSELECT *" "fselect",
.BI "chtype " "fieldAttribute",
.BI "chtype " "fillerCharacter",
.BI "chtype " "highlight",
.BI "char *" "dirAttribute",
.BI "char *" "fileAttribute",
.BI "char *" "linkAttribute",
.BI "char *" "sockAttribute",
.BI "boolean " "box");
.LP
.BI "void setCDKFselectDirectory (CDKFSELECT *" "fselect",
.BI "char *" "directory");
.LP
.BI "char **getCDKFselectDirectory (CDKFSELECT *" "fselect");
.LP
.BI "void setCDKFselectFillerChar (CDKFSELECT *" "fselect",
.BI "chtype " "filler");
.LP
.BI "chtype getCDKFselectFillerChar (CDKFSELECT *" "fselect");
.LP
.BI "void setCDKFselectHighlight (CDKFSELECT *" "fselect",
.BI "chtype " "highlight");
.LP
.BI "chtype getCDKFselectHighlight (CDKFSELECT *" "fselect");
.LP
.BI "void setCDKFselectFileAttribute (CDKFSELECT *" "fselect",
.BI "char *" "attribute");
.LP
.BI "char *getCDKFselectFileAttribute (CDKFSELECT *" "fselect");
.LP
.BI "void setCDKFselectDirAttribute (CDKFSELECT *" "fselect",
.BI "char *" "attribute");
.LP
.BI "char *getCDKFselectDirAttribute (CDKFSELECT *" "fselect");
.LP
.BI "void setCDKFselectLinkAttribute (CDKFSELECT *" "fselect",
.BI "char *" "attribute");
.LP
.BI "char *getCDKFselectLinkAttribute (CDKFSELECT *" "fselect");
.LP
.BI "void setCDKFselectSocketAttribute (CDKFSELECT *" "fselect",
.BI "char *" "attribute");
.LP
.BI "char *getCDKFselectSocketAttribute (CDKFSELECT *" "fselect");
.LP
.BI "void setCDKFselectBox (CDKFSELECT *" "fselect",
.BI "boolean " "box");
.LP
.BI "boolean getCDKFselectBox (CDKFSELECT *" "fselect");
.LP
.BI "void setCDKFselectULChar (CDKFSELECT *", "fselect",
.BI "chtype " "character");
.LP
.BI "void setCDKFselectURChar (CDKFSELECT *", "fselect",
.BI "chtype " "character");
.LP
.BI "void setCDKFselectLLChar (CDKFSELECT *", "fselect",
.BI "chtype " "character");
.LP
.BI "void setCDKFselectLRChar (CDKFSELECT *", "fselect",
.BI "chtype " "character");
.LP
.BI "void setCDKFselectVerticalChar (CDKFSELECT *", "fselect",
.BI "chtype " "character");
.LP
.BI "void setCDKFselectHorizontalChar (CDKFSELECT *", "fselect",
.BI "chtype " "character");
.LP
.BI "void setCDKFselectBoxAttribute (CDKFSELECT *", "fselect",
.BI "chtype " "character");
.LP
.BI "void setCDKFselectBackgroundColor (CDKFSELECT *", "fselect",
.BI "char * " "color");
.LP
.BI "void moveCDKFselect (CDKFSELECT *" "fselect",
.BI "int " "box",
.BI "int " "box",
.BI "boolean " "relative",
.BI "boolean " "refresh");
.LP
.BI "void positionCDKFselect (CDKFSELECT *" "fselect");
.LP
.BI "void drawCDKFselect (CDKFSELECT *" "fselect",
.BI "boolean " "box");
.LP
.BI "void eraseCDKFselect (CDKFSELECT *" "fselect");
.LP
.BI "void destroyCDKFselect (CDKFSELECT *" "fselect");
.LP
.BI "void bindCDKObject (EObjectType " "widgetType",
.BI "void *" "object",
.BI "chtype " "key",
.BI "BINDFN " "function",
.BI "void *" "data");
.SH DESCRIPTION
The Cdk file selector widget creates a widget which allows a user to interact
with the Unix file system. This widget allows the user to traverse the file
system and even delete files. (See \f4NOTES\f1 below for more information)
.SH AVAILABLE FUNCTIONS
CDKFSELECT *newCDKFselect (CDKSCREEN *\f2screen\f1, int \f2xpos\f1, int \f2ypos\f1, int \f2height\f1, int \f2width\f1, char *\f2title\f1, char *\f2label\f1, chtype \f2fieldAttribute\f1, chtype \f2fillerChar\f1, chtype \f2highlight\f1, chtype \f2dirAttribute\f1, chtype \f2fileAttribute\f1, chtype \f2linkAttribute\f1, chtype \f2sockAttribute\f1, boolean \f2box\f1, boolean \f2shadow\f1);
.RS 3
This function creates a pointer to a fselect widget. The \f2screen\f1 parameter
is the screen you wish this widget to be placed in. The parameter \f2xpos\f1
controls the placement of the object along the horizontal axis. This parameter
can accept an integer value or one of the pre-defined values of \f4LEFT\f1,
\f4RIGHT\f1, and \f4CENTER\f1. The parameter \f2ypos\f1 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 \f4TOP\f1, \f4BOTTOM\f1, and \f4CENTER\f1.
The parameters \f2height\f1 and \f2width\f1 control the height and width of the
widget. If you provide a value of zero for either of the height or the width,
the widget will be created with the full width and height of the screen. If
you provide a negative value, the widget will be created the full height or
width minus the value provided. The \f2title\f1 parameter is the string which
will be displayed at the top of the widget. The title can be more than one
line; just provide a carriage return character at the line break. The parameter
\f2label\f1 sets the label of the file selector. The \f2fieldAttribute\f1
parameter sets the attribute of the entry field at the top of the widget;
\f2fillerCharacter\f1 defines the filler character for the entry field. The
\f2highlight\f1 sets the highlight attribute on the scrolling list. The next
four parameters: \f2dirAttribute\f1, \f2fileAttribute\f1, \f2linkAttribute\f1,
and \f2sockAttribute\f1 set the attributes of directories, files, links, and
sockets found in the directory list. The \f2box\f1 parameter states whether
the widget will be drawn with a box around it or not. The \f2shadow\f1
parameter accepts a boolean value to turn the shadow on or off around this
widget. If the widget could not be created then a \f4NULL\f1 pointer is returned.
.RE
char *activateCDKFselect (CDKFSELECT *\f2fselect\f1, chtype *\f2actions\f1);
.RS 3
This function activates the file selector widget and lets the user interact with the
widget. The parameter \f2fselect\f1 is a pointer to a non-NULL file selector widget.
If the \f2actions\f1 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 \f4NULL\f1 pointer for \f2actions\f1. If the character entered
into this widget is \f4RETURN\f1 or \f4TAB\f1 then this function will return
a \f4char *\f1 representing the information typed into the widget and the
structure member \f4exitType\f1 will be set to \f4vNORMAL\f1. If the character
entered was \f4ESCAPE\f1 then the function will returns \f4NULL\f1 pointer and
the structure member \f4exitType\f1 is set to \f4vESCAPE_HIT\f1.
.RE
char *injectCDKFselect (CDKFSELECT *\f2fselect\f1, chtype \f2character\f1);
.RS 3
This function injects a single character into the widget. The parameter
\f2fselect\f1 is a pointer to a non-NULL file selector. The parameter
\f2character\f1 is the character to inject into the widget. If the character
injected into this widget was \f4RETURN\f1 or \f4TAB\f1 then this function will
return a \f4char *\f1 representing the information typed into the widget and the
structure member \f4exitType\f1 will be set to \f4vNORMAL\f1. If the character
entered was \f4ESCAPE\f1 then the function will returns \f4NULL\f1 pointer and
the structure member \f4exitType\f1 is set to \f4vESCAPE_HIT\f1. Any other
character injected into the widget will set the structure member \f4exitType\f1
to \f4vEARLY_EXIT\f1 and the function will return a \f4NULL\f1 pointer.
.RE
void setCDKFselect (CDKFSELECT *\f2fselect\f1, char *\f2directory\f1, chtype \f2fieldAttribute\f1, chtype \f2fillerChar\f1, chtype \f2highlight\f1, chtype \f2dirAttribute\f1, chtype \f2fileAttribute\f1, chtype \f2linkAttribute\f1, chtype \f2sockAttribute\f1, boolean \f2box\f1);
.RS 3
This function lets the programmer modify certain elements of an already
defined fselect widget. The parameter names correspond to the same parameter
names listed in the \f4newCDKFselect\f1 function.
.RE
void setCDKFselectDirectory (CDKFSELECT *\f2fselect\f1, char *\f2directory\f1);
.RS 3
This sets the current directory of the widget.
.RE
char *getCDKFselectDirectory (CDKFSELECT *\f2fselect\f1);
.RS 3
This returns the current directory of the widget.
.RE
void setCDKFselectFillerChar (CDKFSELECT *\f2fselect\f1, chtype \f2filler\f1);
.RS 3
This sets the character to use when drawing the entry field portion of the
widget.
.RE
chtype getCDKFselectFillerChar (CDKFSELECT *\f2fselect\f1);
.RS 3
This returns the character being used as the filler character in the
entry field portion of the widget.
.RE
void setCDKFselectHighlight (CDKFSELECT *\f2fselect\f1, chtype \f2highlight\f1);
.RS 3
This function sets the attribute of the highlight bar of the scrolling
list portion of the widget.
.RE
chtype getCDKFselectHighlight (CDKFSELECT *\f2fselect\f1);
.RS 3
This returns the attribute of the highlight bar of the scrolling
list portion of the widget.
.RE
void setCDKFselectFileAttribute (CDKFSELECT *\f2fselect\f1, char *\f2attribute\f1);
.RS 3
This sets the attribute that plain files will be drawn with in the scrolling
region of the widget.
.RE
char *getCDKFselectFileAttribute (CDKFSELECT *\f2fselect\f1);
.RS 3
This returns the attribute that plain files are drawn with in the
scrolling region of the widget.
.RE
void setCDKFselectDirAttribute (CDKFSELECT *\f2fselect\f1, char *\f2attribute\f1);
.RS 3
This sets the attribute that directories will be drawn with in the scrolling
region of the widget.
.RE
char *getCDKFselectDirAttribute (CDKFSELECT *\f2fselect\f1);
.RS 3
This returns the attribute that directories are drawn with in the
scrolling region of the widget.
.RE
void setCDKFselectLinkAttribute (CDKFSELECT *\f2fselect\f1, char *\f2attribute\f1);
.RS 3
This sets the attribute that symbolic links will be drawn with in the scrolling
region of the widget.
.RE
char *getCDKFselectLinkAttribute (CDKFSELECT *\f2fselect\f1);
.RS 3
This returns the attribute that symbolic links are drawn with in the
scrolling region of the widget.
.RE
void setCDKFselectSocketAttribute (CDKFSELECT *\f2fselect\f1, char *\f2attribute\f1);
.RS 3
This sets the attribute that sockets will be drawn with in the scrolling
region of the widget.
.RE
char *getCDKFselectSocketAttribute (CDKFSELECT *\f2fselect\f1);
.RS 3
This returns the attribute that sockets are drawn with in the
scrolling region of the widget.
.RE
void setCDKFselectBox (CDKFSELECT *\f2fselect\f1, boolean \f2boxWidget\f1);
.RS 3
This sets whether or not the widget will be draw with a box around it.
.RE
boolean getCDKFselectBox (CDKFSELECT *\f2fselect\f1);
.RS 3
This returns whether or not the widget will be drawn with a box around it.
.RE
void setCDKFselectULChar (CDKFSELECT *\f2fselect\f1, chtype \f2character\f1);
.RS 3
This function sets the upper left hand corner of the widgets box to
the given character.
.RE
void setCDKFselectURChar (CDKFSELECT *\f2fselect\f1, chtype \f2character\f1);
.RS 3
This function sets the upper right hand corner of the widgets box to
the given character.
.RE
void setCDKFselectLLChar (CDKFSELECT *\f2fselect\f1, chtype \f2character\f1);
.RS 3
This function sets the lower left hand corner of the widgets box to
the given character.
.RE
void setCDKFselectLRChar (CDKFSELECT *\f2fselect\f1, chtype \f2character\f1);
.RS 3
This function sets the lower right hand corner of the widgets box to
the given character.
.RE
void setCDKFselectVerticalChar (CDKFSELECT *\f2fselect\f1, chtype \f2character\f1);
.RS 3
This function sets the vertical drawing character for the box to
the given character.
.RE
void setCDKFselectHorizontalChar (CDKFSELECT *\f2fselect\f1, chtype \f2character\f1);
.RS 3
This function sets the horizontal drawing character for the box to
the given character.
.RE
void setCDKFselectBoxAttribute (CDKFSELECT *\f2fselect\f1, chtype \f2attribute\f1);
.RS 3
This function sets the attribute of the box.
.RE
void setCDKFselectBackgroundColor (CDKFSELECT *\f2fselect\f1, char *\f2color\f1);
.RS 3
This sets the background color of the widget. The parameter \f2color\f1
is in the format of the Cdk format strings. To get more information look
at the \f4cdk_display\f1 manual page.
.RE
void moveCDKFselect (CDKFSELECT *\f2fselect\f1, int \f2xpos\f1, int \f2ypos\f1, boolean \f2relative\f1, boolean \f2refresh\f1);
.RS 3
This function moves the given widget to the given position. The parameters
\f2xpos\f1 and \f2ypos\f1 is the new position of the widget. The parameter
\f2xpos\f1 can accept an integer value or one of the pre-defined values of
\f4TOP\f1, \f4BOTTOM\f1, and \f4CENTER\f1. The parameter \f2ypos\f1 can
accept an integer value or one of the pre-defined values of \f4LEFT\f1,
\f4RIGHT\f1, and \f4CENTER\f1. The parameter \f2relative\f1 states whether
the \f2xpos\f1/\f2ypos\f1 pair is a relative move or an absolute move. For
example if \f2xpos\f1 = 1 and \f2ypos\f1 = 2 and \f2relative\f1 = \f2TRUE\f1,
then the widget would move one row down and two columns right. If the value
of \f2relative\f1 was \f2FALSE\f1 then the widget would move to the position
(1,2). Do not use the values of \f4TOP\f1, \f4BOTTOM\f1, \f4LEFT\f1,
2001-08-20 16:20:01 +04:00
\f4RIGHT\f1, or \f4CENTER\f1 when \f2relative\f1 = \f4TRUE\f1. (weird things
may happen). The final parameter \f2refresh\f1 is a boolean value which states
whether the widget will get refreshed after the move or not.
.RE
void positionCDKFselect (CDKFSELECT *\f2fselect\f1);
.RS 3
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.
.LP
.nf
\f4Key Bindings\f1
.RS 3
\f2Key Action\f1
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.
.fi
.RE
.RS 3
.LP
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.)
.LP
void drawCDKFselect (CDKFSELECT *\f2fselect\f1, boolean \f2box\f1);
.RS 3
This function draws the fselect widget on the screen. The \f2box\f1 option
draws the widget with or without a box.
.RE
void eraseCDKFselect (CDKFSELECT *\f2fselect\f1);
.RS 3
This function removes the widget from the screen. This does \f4NOT\f1 destroy
the widget.
.RE
void destroyCDKFselect (CDKFSELECT *\f2fselect\f1);
.RS 3
This function removes the widget from the screen and frees up any memory the
object may be using.
.RE
void bindCDKObject (EObjectType \f2widgetType\f1, void *\f2object\f1, char \f2key\f1, BINDFN \f2function\f1, void *\f2data\f1);
.RS 3
This function allows the user to create special key bindings. The
\f2widgetType\f1 parameter is a defined type which states what Cdk object
type is being used. To learn more about the type \f4EObjectType\f1 read
the \f2cdk_binding\f1 manual page. The \f2object\f1 parameter is the pointer
to the widget object. The \f2key\f1 is the character to bind. The
\f2function\f1 is the function type. To learn more about the key binding
call-back function types read the \f4cdk_binding\f1 manual page. The last
parameter \f2data\f1 is a pointer to any data that needs to get passed to
the call-back function.
.RE
.SH KEY BINDINGS
When the widget is activated there are several default key bindings which will
help the user enter or manipulate the information quickly. Since this widget is
built from both the scrolling list widget and the entry field widget, the key
bindings are the same for the respective fields. The extra key bindings are
listed below.
.LP
.nf
\f4Key Bindings\f1
.RS 3
\f2Key Action\f1
Tab Tries to complete the current filename.
Up Arrow Scrolls the scrolling list up one line.
Down Arrow Scrolls the scrolling list down one line.
Page Up Scrolls the scrolling list up one page.
CTRL-B Scrolls the scrolling list up one page.
Page Down Scrolls the scrolling list down one page.
CTRL-F Scrolls the scrolling list down one page.
Return Returns the filename in the entry field of
the file selector. It also sets the structure
member \f4exitType\f1 in the widget to \f4vNORMAL\f1.
Escape Exits the widget and returns a \f4NULL\f1 pointer.
It also sets the structure member \f4exitType\f1
in the widget to \f4vESCAPE_HIT\f1.
.RE
.fi
.SH SEE ALSO
.BR cdk (3),
.BR cdk_binding (3),
.BR cdk_display (3),
.BR cdk_screen (3)
.SH NOTES
.PP
This widget is created from the scrolling list widget and the entry field
widget. This is a good example on how to build your own widgets using the
base widgets provided in this distribution. In order for you to delete
files using the file selector, you must add the following line of code
into your program. (the character X is the character you wish to use to
tell the file selector you want to delete a file.)
.LP
.ce
.B "bindCDKObject (vSCROLL, fselect->filelist, X, deleteFile, fselect)"
.LP
where \f2fselect\f1 is a pointer to the object. This was originally turned on,
but I thought it better to put the control of file deletion on an 'as-need'
basis.
.PP
The header file \f4<cdk.h>\f1 automatically includes the header files
\f4<curses.h>\f1, \f4<stdlib.h>\f1, \f4<string.h>\f1, \f4<ctype.h>\f1,
\f4<unistd.h>\f1, \f4<dirent.h>\f1, \f4<time.h>\f1, \f4<errno.h>\f1,
\f4<pwd.h>\f1, \f4<grp.h>\f1, \f4<sys/stat.h>\f1, and \f4<sys/types.h>\f1.
The \f4<curses.h>\f1 header file includes \f4<stdio.h>\f1 and \f4<unctrl.h>\f1.
.PP
If you have \f4Ncurses\f1 installed on your machine add -DNCURSES to the
compile line to include the Ncurses header files instead.