.de It .br .ie \\n(.$>=3 .ne \\$3 .el .ne 3 .IP "\\$1" \\$2 .. .TH cdk_selection 3 "24 April 1997" .SH NAME newCDKSelection, activateCDKSelection, injectCDKSelection, setCDKSelection, setCDKSelectionChoices, getCDKSelectionChoices, setCDKSelectionChoice, getCDKSelectionChoice, setCDKSelectionModes, getCDKSelectionModes, setCDKSelectionMode, getCDKSelectionMode, setCDKSelectionBox, getCDKSelectionBox, setCDKSelectionULChar, setCDKSelectionURChar, setCDKSelectionLLChar, setCDKSelectionLRChar, setCDKSelectionVerticalChar, setCDKSelectionHorizontalChar, setCDKSelectionBoxAttribute, setCDKSelectionBackgroundColor, drawCDKSelection, eraseCDKSelection, destroyCDKSelection, setCDKSelectionPreProcess, setCDKSelectionPostProcess \- Creates a managed curses selection list widget. .SH SYNOPSIS .LP .B cc .RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." .B \-lcdk .RI "[ " "library" " \|.\|.\|. ]" .LP #include .LP .BI "CDKSELECTION *newCDKSelection (CDKSCREEN *" "cdkscreen", .BI "int " "xpos", .BI "int " "ypos", .BI "int " "spos", .BI "int " "height", .BI "int " "width", .BI "char *" "title", .BI "char **" "selectionList", .BI "int " "selectionListLength", .BI "char **" "choiceList", .BI "int " "choiceListLength", .BI "chtype " "highlight", .BI "boolean " "box", .BI "boolean " "shadow"); .LP .BI "int activateCDKSelection (CDKSELECTION *" "selection", .BI "chtype * " "actions"); .LP .BI "int injectCDKSelection (CDKSELECTION *" "selection", .BI "chtype " "input"); .LP .BI "void setCDKSelection (CDKSELECTION *" "selection", .BI "chtype " "highlight", .BI "chtype " "choiceCharacter", .BI "boolean " "box"); .LP .BI "void setCDKSelectionULChar (CDKSELECTION *", "selection", .BI "chtype " "character"); .LP .BI "void setCDKSelectionURChar (CDKSELECTION *", "selection", .BI "chtype " "character"); .LP .BI "void setCDKSelectionLLChar (CDKSELECTION *", "selection", .BI "chtype " "character"); .LP .BI "void setCDKSelectionLRChar (CDKSELECTION *", "selection", .BI "chtype " "character"); .LP .BI "void setCDKSelectionVerticalChar (CDKSELECTION *", "selection", .BI "chtype " "character"); .LP .BI "void setCDKSelectionHorizontalChar (CDKSELECTION *", "selection", .BI "chtype " "character"); .LP .BI "void setCDKSelectionBoxAttribute (CDKSELECTION *", "selection", .BI "chtype " "character"); .LP .BI "void setCDKSelectionBackgroundColor (CDKSELECTION *", "selection", .BI "char * " "color"); .LP .BI "void moveCDKSelection (CDKSELECTION *" "selection", .BI "int " "box", .BI "int " "box", .BI "boolean " "relative", .BI "boolean " "refresh"); .LP .BI "void positionCDKSelection (CDKSELECTION *" "selection"); .LP .BI "void drawCDKSelection (CDKSELECTION *" "selection", .BI "boolean " "box"); .LP .BI "void eraseCDKSelection (CDKSELECTION *" "selection"); .LP .BI "void destroyCDKSelection (CDKSELECTION *" "selection"); .LP .BI "void setCDKSelectionPreProcess (CDKSELECTION *" "selection", .BI "PROCESSFN " "callback", .BI "void * " "data"); .LP .BI "void setCDKSelectionPostProcess (CDKSELECTION *" "selection", .BI "PROCESSFN " "callback", .BI "void * " "data"); .LP .BI "void bindCDKObject (EObjectType " "widgetType", .BI "void *" "object", .BI "chtype " "key", .BI "BINDFN " "function", .BI "void *" "data"); .SH DESCRIPTION The Cdk selection widget creates a selection list. The following are functions which create or manipulate the Cdk selection box widget. .SH AVAILABLE FUNCTIONS CDKSELECTION *newCDKSelection (CDKSCREEN *\f2screen\f1, int \f2xpos\f1, int \f2ypos\f1, int \f2spos\f1, int \f2height\f1, int \f2width\f1, char *\f2title\f1, char **\f2selectionList\f1, int \f2selectionListLength\f1, char *\f2choiceList\f1, int \f2choiceListLength\f1, chtype \f2highlight\f1, boolean \f2box\f1, boolean \f2shadow\f1); .RS 3 This function creates a pointer to a selection 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 parameter \f2spos\f1 is where the scroll bar is to be placed. This can accept one of three values: \f4LEFT\f1, which puts the scroll bar on the left of the scrolling list. \f4RIGHT\f1 which puts the scroll bar on the right side of the list, and \f4NONE\f1 which does not add a scroll bar. 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 \f2selectionList\f1 is the list of items to be displayed in the selection list; \f2selectionListLength\f1 is the number of elements in the given list. The \f2choiceList\f1 parameter is the list of choices that will be selected when the user presses the space bar; \f2choiceListLength\f1 is the length of this list. The \f2highlight\f1 parameter specifies the display attribute of the currently selected item. 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 int activateCDKSelection (CDKSELECTION *\f2selection\f1, chtype * \f2actions\f1); .RS 3 This function activates the selection widget and lets the user interact with the widget. The parameter \f2selection\f1 is a pointer to a non-NULL selection 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 1. Itm will also set the structure member \f4exitType\f1 to \f4vNORMAL\f1. If the character entered into this widget was \f4ESCAPE\f1 then the widget will return a value of -1 and the structure member \f4exitType\f1 will be set to \f4vESCAPE_HIT\f1. .RE int injectCDKSelection (CDKSELECTION *\f2selection\f1, chtype \f2character\f1); .RS 3 This function injects a single character into the widget. The parameter \f2selection\f1 is a pointer to a non-NULL selection widget. The parameter \f2character\f1 is the character to inject into the widget. If the character injected into this widget was \f4RETURN\f1 then the character injected into this widget is \f4RETURN\f1 or \f4TAB\f1 then this function will return 1. It will also set the structure member \f4exitType\f1 to \f4vNORMAL\f1. If the character entered into this widget was \f4ESCAPE\f1 then the widget will return a value of -1 and the structure member \f4exitType\f1 will be 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 -1. .RE void setCDKSelection (CDKSELECTION *\f2selection\f1, chtype \f2highlight\f1, chtype \f2choiceCharacter\f1, boolean \f2box\f1); .RS 3 This function lets the programmer modify certain elements of an already defined selection widget. The parameter names correspond to the same parameter names listed in the \f4newCDKSelection\f1 function. .RE void setCDKSelectionChoices (CDKSELECTION *\f2selection\f1, int \f2choices[]\f1); .RS 3 This function sets the selection choice values of the widget. .RE int *getCDKSelectionChoices (CDKSELECTION *\f2selection\f1); .RS 3 This returns an array of the current selection choices for the widget. .RE void setCDKSelectionChoice (CDKSELECTION *\f2selection\f1, int \f2index\f1, int \f2choice\f1); .RS 3 This sets the selection choice value at the given index. .RE int getCDKSelectionChoice (CDKSELECTION *\f2selection\f1, int \f2index\f1); .RS 3 This returns the selection choice at the given index. .RE void setCDKSelectionModes (CDKSELECTION *\f2selection\f1, int \f2modes[]\f1); .RS 3 This function 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. .RE int *getCDKSelectionModes (CDKSELECTION *\f2selection\f1); .RS 3 This returns an array of the current modes for the widget. .RE void setCDKSelectionMode (CDKSELECTION *\f2selection\f1, int \f2index\f1, int \f2mode\f1); .RS 3 This sets the selection mode at the given index. .RE int getCDKSelectionMode (CDKSELECTION *\f2selection\f1, int \f2index\f1); .RS 3 This returns the selection mode at the given index. .RE void setCDKSelectionHighlight (CDKSELECTION *\f2selection\f1, chtype \f2highlight\f1); .RS 3 This sets the attribute of the highlight bar. .RE chtype getCDKSelectionHighlight (CDKSELECTION *\f2selection\f1); .RS 3 This returns the attribute of the highlight bar. .RE void setCDKSelectionBox (CDKSELECTION *\f2selection\f1, boolean \f2boxWidget\f1); .RS 3 This sets whether or not the widget will be draw with a box around it. .RE boolean getCDKSelectionBox (CDKSELECTION *\f2selection\f1); .RS 3 This returns whether or not the widget will be drawn with a box around it. .RE void setCDKSelectionULChar (CDKSELECTION *\f2selection\f1, chtype \f2character\f1); .RS 3 This function sets the upper left hand corner of the widgets box to the given character. .RE void setCDKSelectionURChar (CDKSELECTION *\f2selection\f1, chtype \f2character\f1); .RS 3 This function sets the upper right hand corner of the widgets box to the given character. .RE void setCDKSelectionLLChar (CDKSELECTION *\f2selection\f1, chtype \f2character\f1); .RS 3 This function sets the lower left hand corner of the widgets box to the given character. .RE void setCDKSelectionLRChar (CDKSELECTION *\f2selection\f1, chtype \f2character\f1); .RS 3 This function sets the lower right hand corner of the widgets box to the given character. .RE void setCDKSelectionVerticalChar (CDKSELECTION *\f2selection\f1, chtype \f2character\f1); .RS 3 This function sets the vertical drawing character for the box to the given character. .RE void setCDKSelectionHorizontalChar (CDKSELECTION *\f2selection\f1, chtype \f2character\f1); .RS 3 This function sets the horizontal drawing character for the box to the given character. .RE void setCDKSelectionBoxAttribute (CDKSELECTION *\f2selection\f1, chtype \f2attribute\f1); .RS 3 This function sets the attribute of the box. .RE void setCDKSelectionBackgroundColor (CDKSELECTION *\f2selection\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 moveCDKSelection (CDKSELECTION *\f2selection\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, \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 positionCDKSelection (CDKSELECTION *\f2selection\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 it's 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 drawCDKSelection (CDKSELECTION *\f2selection\f1, boolean \f2box\f1); .RS 3 This function draws the selection widget on the screen. The \f2box\f1 option draws the widget with or without a box. .RE void eraseCDKSelection (CDKSELECTION *\f2selection\f1); .RS 3 This function removes the widget from the screen. This does \f4NOT\f1 destroy the widget. .RE void destroyCDKSelection (CDKSELECTION *\f2selection\f1); .RS 3 This function removes the widget from the screen and frees up any memory the object may be using. .RE void setCDKSelectionPreProcess (CDKSELECTION *\f2selection\f1, PROCESSFN \f2function\f1, void *\f2data\f1); .RS 3 This function 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 \f2function\f1 if of type \f4PROCESSFN\f1. The parameter \f2data\f1 is a pointer to \f4void\f1. To learn more about pre-processing read the \f4cdk_process\f1 manual page. .RE void setCDKSelectionPostProcess (CDKSELECTION *\f2selection\f1, PROCESSFN \f2function\f1, void *\f2data\f1); .RS 3 This function allows the user to have the widget call a function after the key has been applied to the widget. The parameter \f2function\f1 if of type \f4PROCESSFN\f1. The parameter \f2data\f1 is a pointer to \f4void\f1. To learn more about post-processing read the \f4cdk_process\f1 manual page. .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 \f4cdk_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 callback 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 callback 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. The following table outlines the keys and their actions for this widget. .LP .RS 3 .nf \f2Key Action\f1 Left Arrow Shifts the whole list left one character. Right Arrow Shifts the whole list right one character. Up Arrow Selects the next item up in the list. Down Arrow Selects the next item down in the list. Space Cycles to the next choice on the current item. Prev Page Moves one page backwards. Ctrl-B Moves one page backwards. Next Page Moves one page forwards. Ctrl-F Moves one page forwards. g Moves to the first element in the list. 1 Moves to the first element in the list. G Moves to the last element in the list. $ Shifts the whole list to the far right. | Shifts the whole list to the far left. Return Exits the widget and returns 1. This also sets the structure member \f4exitType\f1 in the widget pointer to the value of \f4vNORMAL\f1. Tab Exits the widget and returns 1. This also sets the structure member \f4exitType\f1 in the widget pointer to the value of \f4vNORMAL\f1. Escape Exits the widget and returns -1. This also sets the structure member \f4exitType\f1 in the widget pointer to the value of \f4vESCAPE_HIT\f1. Ctrl-L Refreshes the screen. .RE .fi .SH SEE ALSO .BR cdk (3), .BR cdk_binding (3), .BR cdk_display (3), .BR cdk_screen (3) .SH NOTES .PP The header file \f4\f1 automatically includes the header files \f4\f1, \f4\f1, \f4\f1, \f4\f1, \f4\f1, \f4\f1, \f4\f1, \f4\f1, \f4\f1, \f4\f1, \f4\f1, and \f4\f1. The \f4\f1 header file includes \f4\f1 and \f4\f1. .PP If you have \f4Ncurses\f1 installed on your machine add -DNCURSES to the compile line to include the Ncurses header files instead.