Scroll to navigation

cdk_selection(3) Library Functions Manual cdk_selection(3)

NAME

cdk_selection - curses selection list widget.

SYNOPSIS

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

#include <cdk.h>

CDKSELECTION *selection,
chtype * actions);
CDKSELECTION *selection);
CDKSELECTION *selection,
boolean box);
CDKSELECTION *selection);
CDKSELECTION *selection);
CDKSELECTION *selection,
int index);
CDKSELECTION *selection);
CDKSELECTION *selection);
CDKSELECTION *selection);
CDKSELECTION *selection,
char **list);
CDKSELECTION *selection,
int index);
CDKSELECTION *selection);
CDKSELECTION *selection);
CDKSELECTION *selection,
chtype input);
CDKSELECTION *selection,
int xpos,
int ypos,
boolean relative,
boolean refresh);
CDKSCREEN *cdkscreen,
int xpos,
int ypos,
int spos,
int height,
int width,
const char *title,
CDK_CONST char **selectionList,
int selectionListLength,
CDK_CONST char **choiceList,
int choiceListLength,
chtype highlight,
boolean box,
boolean shadow);
CDKSELECTION *selection);
CDKSELECTION *selection,
chtype highlight,
int *defChoices,
boolean box);
CDKSELECTION *selection,
chtype attribute);
CDKSELECTION *selection,
const char * color);
CDKSELECTION *selection,
boolean boxWidget);
CDKSELECTION *selection,
chtype character);
CDKSELECTION *selection,
int index,
int choice);
CDKSELECTION *selection,
int *choices);
CDKSELECTION *selection,
intindex);
CDKSELECTION *selection,
chtype highlight);
CDKSELECTION *selection,
chtype character);
CDKSELECTION *selection,
CDK_CONST char **list,
int listSize);
CDKSELECTION *selection,
chtype character);
CDKSELECTION *selection,
chtype character);
CDKSELECTION *selection,
int index,
int mode);
CDKSELECTION *selection,
int *modes);
CDKSELECTION *selection,
PROCESSFN callback,
void * data);
CDKSELECTION *selection,
PROCESSFN callback,
void * data);
CDKSELECTION *selection,
const char *title);
CDKSELECTION *selection,
chtype character);
CDKSELECTION *selection,
chtype character);
CDKSELECTION *selection,
chtype character);

DESCRIPTION

The Cdk selection widget creates a selection list. The following functions create or manipulate the Cdk selection list widget.

AVAILABLE FUNCTIONS

activates the selection widget and lets the user interact with the widget.
  • The parameter selection is a pointer to a non-NULL selection 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 or TAB then this function will return 1. 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.
removes the widget from the screen and frees memory the object used.
draws the selection widget on the screen. If the box parameter 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 selection choice at the given index.
returns an array of the current selection choices for the widget.
returns the current selection index.
returns the attribute of the highlight bar.
copies the selection-list items into the caller's array and returns the number of items in the list.
returns the selection mode at the given index.
returns an array of the current modes for the widget.
returns the first line of the title of the selection widget. The caller must free the returned value.
injects a single character into the widget.
  • The parameter selection is a pointer to a non-NULL selection widget.
  • The parameter character is the character to inject into the widget.
The return value and side-effect (setting the widget data exitType) depend upon the injected character:
the function returns 1. The widget data exitType is set to vNORMAL.
the function returns -1. vESCAPE_HIT. The widget data exitType is set to vESCAPE_HIT.
unless modified by preprocessing, postprocessing or key bindings, the function returns -1. The widget data exitType is set to vEARLY_EXIT.
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.
creates a selection 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.
is where the scroll bar is to be placed. It may be one of three values:
puts the scroll bar on the left of the scrolling list. RIGHT puts the scroll bar on the right side of the list, and
does not add a scroll bar.
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.
is the string which to display at the top of the widget. The title can be more than one line; just provide a carriage return character at the line break.
is the list of items to display in the selection list
is the number of elements in the given list.
is the list of choices that will be selected when the user presses the space bar.
is the length of this list.
specifies the display attribute of the currently selected item.
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 certain elements of an existing selection widget. The parameter names correspond to the same parameter names listed in the newCDKSelection function.
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 selection choice value at the given index.
sets the selection choice values of the widget.
sets the current selection index.
sets the attribute of the highlight bar.
sets the horizontal drawing character for the box to the given character.
sets the selection list items.
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 selection mode at the given index.
sets the selection mode of the elements of the widget. There are two acceptable values for the modes: 0 which allows the user to change the selection value at the given index; and 1 which sets the element to a read-only state.
allows the user to have the widget call a function after the key has been applied to the widget. The parameter function is the callback function. The parameter data points to data passed to the callback function. To learn more about post-processing see cdk_process (3).
allows the user to have the widget call a function after a key is hit and before the key is applied to the widget. The parameter function is the callback function. The parameter data is a pointer to void. To learn more about pre-processing see cdk_process (3).
set the selection list's title.
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.

KEY BINDINGS

When the widget is activated there are several default key bindings which help the user enter or manipulate the information quickly:

Key Action
Left Arrow Shift the whole list left one column.
Right Arrow Shift the whole list right one column.
Up Arrow Select the previous item in the list.
Down Arrow Select the next item in the list.
Prev Page
Ctrl-B Scroll one page backward.
Next Page
Ctrl-F Scroll one page forward.
1
<
g
Home Move to the first element in the list.
>
G
End Move to the last element in the list.
$ Shift the whole list to the far right.
| Shift the whole list to the far left.
Space Cycles to the next choice on the current item.
Return Exit the widget and return 1. Also set the widget data exitType to vNORMAL.
Tab Exit the widget and return 1. Also set the widget data exitType to vNORMAL.
Escape Exit the widget and return -1. Also set the widget data exitType to vESCAPE_HIT.
Ctrl-L Refreshes the screen.

SEE ALSO

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