cdk_radio (3) - Linux Manuals

NAME

cdk_radio - curses radio list widget.

SYNOPSIS

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

#include <cdk.h>

int activateCDKRadio (
CDKRADIO *radio, chtype *actions);
void destroyCDKRadio (
CDKRADIO *radio);
void drawCDKRadio (
CDKRADIO *radio, boolean box);
void eraseCDKRadio (
CDKRADIO *radio);
boolean getCDKRadioBox (
CDKRADIO *radio);
chtype getCDKRadioChoiceCharacter (
CDKRADIO *radio);
int getCDKRadioCurrentItem (
CDKRADIO *radio);
chtype getCDKRadioHighlight (
CDKRADIO *radio);
int getCDKRadioItems (
CDKRADIO *radio, char **list);
chtype getCDKRadioLeftBrace (
CDKRADIO *radio);
chtype getCDKRadioRightBrace (
CDKRADIO *radio);
int getCDKRadioSelectedItem (
CDKRADIO *radio);
int injectCDKRadio (
CDKRADIO *radio, chtype input);
void moveCDKRadio (
CDKRADIO *radio, int xpos, int ypos, boolean relative, boolean refresh);
CDKRADIO *newCDKRadio (
CDKSCREEN *cdkscreen, int xpos, int ypos, int spos, int height, int width, const char *title, CDK_CONST char **radioList, int radioListLength, chtype choiceCharacter, int defaultItem, chtype highlight, boolean box, boolean shadow);
void positionCDKRadio (
CDKRADIO *radio);
void setCDKRadio (
CDKRADIO *radio, chtype highlight, chtype choiceCharacter, boolean box);
void setCDKRadioBackgroundAttrib (
CDKRADIO *radio, chtype attribute);
void setCDKRadioBackgroundColor (
CDKRADIO *radio, const char * color);
void setCDKRadioBox (
CDKRADIO *radio, boolean box);
void setCDKRadioBoxAttribute (
CDKRADIO *radio, chtype character);
void setCDKRadioChoiceCharacter (
CDKRADIO *radio, chtype character);
void setCDKRadioCurrentItem (
CDKRADIO *radio, intindex);
void setCDKRadioHighlight (
CDKRADIO *radio, chtype highlight);
void setCDKRadioHorizontalChar (
CDKRADIO *radio, chtype character);
void setCDKRadioItems (
CDKRADIO *radio, CDK_CONST char **list, int listSize);
void setCDKRadioLLChar (
CDKRADIO *radio, chtype character);
void setCDKRadioLRChar (
CDKRADIO *radio, chtype character);
void setCDKRadioLeftBrace (
CDKRADIO *radio, chtype character);
void setCDKRadioPostProcess (
CDKRADIO *radio, PROCESSFN callback, void * data);
void setCDKRadioPreProcess (
CDKRADIO *radio, PROCESSFN callback, void * data);
void setCDKRadioRightBrace (
CDKRADIO *radio, chtype character);
void setCDKRadioSelectedItem (
CDKRADIO *radio, int item);
void setCDKRadioULChar (
CDKRADIO *radio, chtype character);
void setCDKRadioURChar (
CDKRADIO *radio, chtype character);
void setCDKRadioVerticalChar (
CDKRADIO *radio, chtype character);

DESCRIPTION

The Cdk radio widget creates a radio list. The following are functions which create or manipulate the Cdk radio box widget.

AVAILABLE FUNCTIONS

activateCDKRadio
activates the radio widget and lets the user interact with the widget. The parameter radio is a pointer to a non-NULL radio 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 a value from 0 to the number of items -1, representing the item 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.
destroyCDKRadio
removes the widget from the screen and frees memory the object used.
drawCDKRadio
draws the radio widget on the screen. If the box parameter is true, the widget is drawn with a box.
eraseCDKRadio
removes the widget from the screen. This does NOT destroy the widget.
getCDKRadioBox
returns true if the widget will be drawn with a box around it.
getCDKRadioChoiceCharacter
returns the character being used to draw the selected element in the list.
getCDKRadioCurrentItem
returns the index of the current item.
getCDKRadioHighlight
returns the attribute of the highlight bar.
getCDKRadioItems
copies the radio box items into the caller's list, which must be large enough since this function does not allocate it. It returns the list size.
getCDKRadioLeftBrace
returns the character being used to draw the left brace of the selection box.
getCDKRadioRightBrace
returns the character being used to draw the right brace of the selection box.
getCDKRadioSelectedItem,
returns the selected item of the widget.
injectCDKRadio
function injects a single character into the widget. The parameter radio is a pointer to a non-NULL radio 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:
RETURN or TAB
the function returns a value ranging from zero to one less than the number of items, representing the items selected. The widget data exitType is set to vNORMAL.
ESCAPE
the function returns -1. The widget data exitType is set to vESCAPE_HIT.
Otherwise
unless modified by preprocessing, postprocessing or key bindings, the function returns -1. The widget data exitType is set to vEARLY_EXIT.
moveCDKRadio
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.
newCDKRadio
creates a radio 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.
spos
tells where the scroll bar is to be placed. This may be one of three values:
LEFT
puts the scroll bar on the left of the scrolling list.
RIGHT
puts the scroll bar on the right side of the list, and
NONE
does not add a scroll bar.
height and
width 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.
title
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.
radioList
is the list of items to display in the radio list.
radioListLength
is the number of elements in the given list.
choiceCharacter
is the character to use to highlight the current selection.
highlight
specifies the display attribute of the currently selected item.
defaultItem
is the index in the list of the default selection.
box
is true if 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.
positionCDKRadio
allows the user to move the widget around the screen via the cursor/keypad keys. See cdk_position (3) for key bindings.
setCDKRadio
lets the programmer modify certain elements of an existing radio widget. The parameter names correspond to the same parameter names listed in the newCDKRadio function.
setCDKRadioBackgroundAttrib
sets the background attribute of the widget. The parameter attribute is a curses attribute, e.g., A_BOLD.
setCDKRadioBackgroundColor
sets the background color of the widget. The parameter color is in the format of the Cdk format strings. See cdk_display (3).
setCDKRadioBox
sets whether the widget will be drawn with a box around it.
setCDKRadioBoxAttribute
function sets the attribute of the box.
setCDKRadioChoiceCharacter
sets the character to use to draw the selected element in the list.
setCDKRadioCurrentItem
sets the current item by its index in the list.
setCDKRadioHighlight
sets the attribute of the highlight bar.
setCDKRadioHorizontalChar
sets the horizontal drawing character for the box to the given character.
setCDKRadioItems
set the radio list items and display the result. The current item is set to the beginning of the list.
setCDKRadioLLChar
sets the lower left hand corner of the widget's box to the given character.
setCDKRadioLRChar
sets the lower right hand corner of the widget's box to the given character.
setCDKRadioLeftBrace
sets the character to use to draw the left brace of the selection box.
setCDKRadioPostProcess
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).
setCDKRadioPreProcess
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 points to data passed to the callback function. To learn more about pre-processing see cdk_process (3).
setCDKRadioRightBrace
sets the character to use to draw the right brace of the selection box.
setCDKRadioSelectedItem
sets the selected item.
setCDKRadioULChar
function sets the upper left hand corner of the widget's box to the given character.
setCDKRadioURChar
function sets the upper right hand corner of the widget's box to the given character.
setCDKRadioVerticalChar
function 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.

KeyAction


Left ArrowShifts the whole list left one character.
Right ArrowShifts the whole list right one character.
Up ArrowSelects the next item up in the list.
Down ArrowSelects the next item down in the list.

Prev Page
Ctrl-BScroll one page backward.

Next Page
Ctrl-FScroll one page forward.

1
<
g
HomeMove to the first element in the list.

>
G
EndMove to the last element in the list.

$Shifts the whole list to the far right.
|Shifts the whole list to the far left.

SpaceSelects or deselects the current choice.
Return Exits the widget and returns the index of the selected item. This also sets the widget data exitType to vNORMAL.
Tab Exit the widget and return the index of the selected item. Set the widget data exitType to vNORMAL.
Escape Exit the widget and return -1. Set the widget data exitType to vESCAPE_HIT.
Ctrl-LRefreshes the screen.

SEE ALSO

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