cdk_selection(3) - NetBSD Manual Pages

cdk_selection(3)                                              cdk_selection(3)




NAME
newCDKSelection, activateCDKSelection, injectCDKSelection, setCDKSelec- tion, setCDKSelectionChoices, getCDKSelectionChoices, setCDKSelection- Choice, getCDKSelectionChoice, setCDKSelectionModes, getCDKSelection- Modes, setCDKSelectionMode, getCDKSelectionMode, setCDKSelectionBox, getCDKSelectionBox, setCDKSelectionULChar, setCDKSelectionURChar, setCDKSelectionLLChar, setCDKSelectionLRChar, setCDKSelectionVerti- calChar, setCDKSelectionHorizontalChar, setCDKSelectionBoxAttribute, setCDKSelectionBackgroundColor, drawCDKSelection, eraseCDKSelection, destroyCDKSelection, setCDKSelectionPreProcess, setCDKSelectionPostPro- cess - Creates a managed curses selection list widget.
SYNOPSIS
cc [ flag ... ] file ... -lcdk [ library ... ] #include <cdk.h> CDKSELECTION *newCDKSelection (CDKSCREEN *cdkscreen, int xpos, int ypos, int spos, int height, int width, char *title, char **selection- List, int selectionListLength, char **choiceList, int choiceListLength, chtype highlight, boolean box, boolean shadow); int activateCDKSelection (CDKSELECTION *selection, chtype * actions); int injectCDKSelection (CDKSELECTION *selection, chtype input); void setCDKSelection (CDKSELECTION *selection, chtype highlight, chtype choiceCharacter, boolean box); void setCDKSelectionULChar (CDKSELECTION *,selection, chtype charac- ter); void setCDKSelectionURChar (CDKSELECTION *,selection, chtype charac- ter); void setCDKSelectionLLChar (CDKSELECTION *,selection, chtype charac- ter); void setCDKSelectionLRChar (CDKSELECTION *,selection, chtype charac- ter); void setCDKSelectionVerticalChar (CDKSELECTION *,selection, chtype character); void setCDKSelectionHorizontalChar (CDKSELECTION *,selection, chtype character); void setCDKSelectionBoxAttribute (CDKSELECTION *,selection, chtype character); void setCDKSelectionBackgroundColor (CDKSELECTION *,selection, char * color); void moveCDKSelection (CDKSELECTION *selection, int box, int box, boolean relative, boolean refresh); void positionCDKSelection (CDKSELECTION *selection); void drawCDKSelection (CDKSELECTION *selection, boolean box); void eraseCDKSelection (CDKSELECTION *selection); void destroyCDKSelection (CDKSELECTION *selection); void setCDKSelectionPreProcess (CDKSELECTION *selection, PROCESSFN callback, void * data); void setCDKSelectionPostProcess (CDKSELECTION *selection, PROCESSFN callback, void * data); void bindCDKObject (EObjectType widgetType, void *object, chtype key, BINDFN function, void *data);
DESCRIPTION
The Cdk selection widget creates a selection list. The following are functions which create or manipulate the Cdk selection box widget.
AVAILABLE FUNCTIONS
CDKSELECTION *newCDKSelection (CDKSCREEN *screen, int xpos, int ypos, int spos, int height, int width, char *title, char **selectionList, int selectionListLength, char *choiceList, int choiceListLength, chtype highlight, boolean box, boolean shadow); This function creates a pointer to a selection 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 parameter spos is where the scroll bar is to be placed. This can accept one of three values: LEFT, which puts the scroll bar on the left of the scrolling list. RIGHT which puts the scroll bar on the right side of the list, and NONE which does not add a scroll bar. The parameters 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 pro- vide a negative value, the widget will be created the full height or width minus the value provided. The title 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 selectionList is the list of items to be displayed in the selection list; selectionListLength is the number of elements in the given list. The choiceList parameter is the list of choices that will be selected when the user presses the space bar; choiceListLength is the length of this list. The highlight parameter specifies the display attribute of the currently selected item. The box parameter states whether the widget 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 activateCDKSelection (CDKSELECTION *selection, chtype * actions); This function 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. Itm will also set the structure member exitType to vNORMAL. If the character entered into this widget was ESCAPE then the widget will return a value of -1 and the structure member exitType will be set to vESCAPE_HIT. int injectCDKSelection (CDKSELECTION *selection, chtype character); This function injects a single character into the widget. The param- eter selection is a pointer to a non-NULL selection widget. The parameter character is the character to inject into the widget. If the character injected into this widget was RETURN then the charac- ter injected into this widget is RETURN or TAB then this function will return 1. It will also set the structure member exitType to vNORMAL. If the character entered into this widget was ESCAPE then the widget will return a value of -1 and the structure member exit- Type will be set to vESCAPE_HIT. Any other character injected into the widget will set the structure member exitType to vEARLY_EXIT and the function will return -1. void setCDKSelection (CDKSELECTION *selection, chtype highlight, chtype choiceCharacter, boolean box); 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 newCDKSelection function. void setCDKSelectionChoices (CDKSELECTION *selection, int choices[]); This function sets the selection choice values of the widget. int *getCDKSelectionChoices (CDKSELECTION *selection); This returns an array of the current selection choices for the wid- get. void setCDKSelectionChoice (CDKSELECTION *selection, int index, int choice); This sets the selection choice value at the given index. int getCDKSelectionChoice (CDKSELECTION *selection, int index); This returns the selection choice at the given index. void setCDKSelectionModes (CDKSELECTION *selection, int modes[]); 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. int *getCDKSelectionModes (CDKSELECTION *selection); This returns an array of the current modes for the widget. void setCDKSelectionMode (CDKSELECTION *selection, int index, int mode); This sets the selection mode at the given index. int getCDKSelectionMode (CDKSELECTION *selection, int index); This returns the selection mode at the given index. void setCDKSelectionHighlight (CDKSELECTION *selection, chtype high- light); This sets the attribute of the highlight bar. chtype getCDKSelectionHighlight (CDKSELECTION *selection); This returns the attribute of the highlight bar. void setCDKSelectionBox (CDKSELECTION *selection, boolean boxWidget); This sets whether or not the widget will be draw with a box around it. boolean getCDKSelectionBox (CDKSELECTION *selection); This returns whether or not the widget will be drawn with a box around it. void setCDKSelectionULChar (CDKSELECTION *selection, chtype character); This function sets the upper left hand corner of the widgets box to the given character. void setCDKSelectionURChar (CDKSELECTION *selection, chtype character); This function sets the upper right hand corner of the widgets box to the given character. void setCDKSelectionLLChar (CDKSELECTION *selection, chtype character); This function sets the lower left hand corner of the widgets box to the given character. void setCDKSelectionLRChar (CDKSELECTION *selection, chtype character); This function sets the lower right hand corner of the widgets box to the given character. void setCDKSelectionVerticalChar (CDKSELECTION *selection, chtype char- acter); This function sets the vertical drawing character for the box to the given character. void setCDKSelectionHorizontalChar (CDKSELECTION *selection, chtype character); This function sets the horizontal drawing character for the box to the given character. void setCDKSelectionBoxAttribute (CDKSELECTION *selection, chtype attribute); This function sets the attribute of the box. void setCDKSelectionBackgroundColor (CDKSELECTION *selection, 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 moveCDKSelection (CDKSELECTION *selection, int xpos, int ypos, boolean relative, 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 positionCDKSelection (CDKSELECTION *selection); 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 drawCDKSelection (CDKSELECTION *selection, boolean box); This function draws the selection widget on the screen. The box option draws the widget with or without a box. void eraseCDKSelection (CDKSELECTION *selection); This function removes the widget from the screen. This does NOT destroy the widget. void destroyCDKSelection (CDKSELECTION *selection); This function removes the widget from the screen and frees up any memory the object may be using. void setCDKSelectionPreProcess (CDKSELECTION *selection, PRO- CESSFN function, void *data); This function allows the user to have the widget call a func- tion after a key is hit and before the key is applied to the widget. The parameter function if of type PROCESSFN. The parameter data is a pointer to void. To learn more about pre- processing read the cdk_process manual page. void setCDKSelectionPostProcess (CDKSELECTION *selection, PRO- CESSFN function, void *data); This function allows the user to have the widget call a func- tion after the key has been applied to the widget. The param- eter function if of type PROCESSFN. The parameter data is a pointer to void. To learn more about post-processing read the cdk_process manual page. 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 callback 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 callback function.
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 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 exitType in the widget pointer to the value of vNORMAL. Tab Exits the widget and returns 1. 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_selection(3)

Powered by man-cgi (2024-08-26). Maintained for NetBSD by Kimmo Suominen. Based on man-cgi by Panagiotis Christias.