cdk_dialog(3) cdk_dialog(3)
NAME
newCDKDialog, activateCDKDialog, injectCDKDialog, drawCD- KDialog, setCDKDialog, setCDKDialogHighlight, getCDKDi- alogHighlight, setCDKDialogSeparator, getCDKDialogSepara- tor, setCDKDialogBox, getCDKDialogBox, setCDKDialogULChar, setCDKDialogURChar, setCDKDialogLLChar, setCDKDialogLR- Char, setCDKDialogVerticalChar, setCDKDialogHorizon- talChar, setCDKDialogBoxAttribute, setCDKDialogBackground- Color, eraseCDKDialog, destroyCDKDialog, setCDKDialogPre- Process, setCDKDialogPostProcess - Creates a managed curses dialog widget.
SYNOPSIS
cc [ flag ... ] file ... -lcdk [ library ... ] #include <cdk.h> CDKDIALOG *newCDKDialog (CDKSCREEN *cdkscreen, int xpos, int ypos, char ** message, int rows, char ** buttons, int buttonCount, chtype highlight, boolean separator, boolean box, boolean shadow); int activateCDKDialog (CDKDIALOG *dialog, chtype * actions); int injectCDKDialog (CDKDIALOG *dialog, chtype input); void setCDKDialog (CDKDIALOG *dialog, chtype highlight, boolean separator, boolean box); void setCDKDialogHighlight (CDKDIALOG *dialog, chtype highlight); chtype getCDKDialogHighlight (CDKDIALOG *dialog); void setCDKDialogSeparator (CDKDIALOG *dialog, boolean separator); boolean getCDKDialogSeparator (CDKDIALOG *dialog); void setCDKDialogBox (CDKDIALOG *dialog, boolean box); boolean getCDKDialogBox (CDKDIALOG *dialog); void setCDKDialogULChar (CDKDIALOG *,dialog, chtype char- acter); void setCDKDialogURChar (CDKDIALOG *,dialog, chtype char- acter); void setCDKDialogLLChar (CDKDIALOG *,dialog, chtype char- acter); void setCDKDialogLRChar (CDKDIALOG *,dialog, chtype 24 APril 1997 1 cdk_dialog(3) cdk_dialog(3) character); void setCDKDialogVerticalChar (CDKDIALOG *,dialog, chtype character); void setCDKDialogHorizontalChar (CDKDIALOG *,dialog, chtype character); void setCDKDialogBoxAttribute (CDKDIALOG *,dialog, chtype character); void setCDKDialogBackgroundColor (CDKDIALOG *,dialog, char * color); void moveCDKDialog (CDKDIALOG *dialog, int box, int box, boolean relative, boolean refresh); void positionCDKDialog (CDKDIALOG *dialog); void drawCDKDialog (CDKDIALOG *dialog, boolean box); void eraseCDKDialog (CDKDIALOG *dialog); void setCDKDialogPreProcess (CDKDIALOG *dialog, PROCESSFN callback, void * data); void setCDKDialogPostProcess (CDKDIALOG *dialog, PROCESSFN callback, void * data); void destroyCDKDialog (CDKDIALOG *dialog); void bindCDKObject (EObjectType widgetType, void * object, chtype key, BINDFN function, void * data);
DESCRIPTION
The Cdk dialog widget creates a dialog box with a message and a varied number of buttons to choose from. The follow- ing are functions which create or manipulate the Cdk dia- log box widget.
AVAILABLE FUNCTIONS
CDKDIALOG *newCDKDialog (CDKSCREEN *screen, int xpos, int ypos, char **message , int rows, char **buttons, int but- tonCount, chtype highLight, boolean separator, boolean box, boolean shadow); This function creates a pointer to a dialog 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 horizontal axis. This parameter accepts an integer value or one of the pre-defined val- ues of LEFT, RIGHT, and CENTER. The parameter ypos con- trols the placement of the object along the vertical 24 APril 1997 2 cdk_dialog(3) cdk_dialog(3) axis. This parameter can accept an integer value or one of the pre-defined values of TOP, BOTTOM, and CENTER. The parameter message is the message to be displayed in the message region of the dialog box. The rows parame- ter states how many elements there are in the message. The buttons array contains a list of all the buttons to be displayed on the bottom of the dialog box; while buttonCount is the number of elements in the button array. highlight is the attribute of the currently highlighted button. The box parameter states whether the widget will be drawn with a box around it or not. separator states whether a separator line will be drawn between the message region and the buttons. 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 activateCDKDialog (CDKDIALOG *dialog, chtype *actions); This function activates the dialog widget and lets the user interact with the widget. The parameter dialog is a pointer to a non-NULL dialog widget. If the actions parameter is passed with a non-NULL value, the charac- ters 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 buttons -1, represent- ing the button selected. 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 exitType will be set to vESCAPE_HIT. int injectCDKDialog (CDKDIALOG *dialog, chtype character); This function injects a single character into the wid- get. The parameter dialog is a pointer to a non-NULL dialog widget. The parameter character is the character to inject into the widget. If the character injected into this widget was RETURN then the character injected into this widget is RETURN or TAB then this function will return a value from 0 to the number of buttons -1, representing the button selected. 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 exitType will be set to vESCAPE_HIT. Any other charac- ter injected into the widget will set the structure member exitType to vEARLY_EXIT and the function will return -1. void setCDKDialog (CDKDIALOG *dialog, chtype highlight, boolean separator, boolean box); This function lets the programmer modify certain 24 APril 1997 3 cdk_dialog(3) cdk_dialog(3) elements of an already defined dialog widget. The parameter names correspond to the same parameter names listed in the newCDKDialog function. void setCDKDialogHighlight (CDKDIALOG *dialog, chtype highlight); This sets the highlight attribute of the selected but- ton. chtype getCDKDialogHighlight (CDKDIALOG *dialog); This returns the highlight attribute of the widget. void setCDKDialogSeparator (CDKDIALOG *dialog, boolean separator); This sets the boolean flag whether the widget will be drawn with the separator bar between the buttons and the message area. boolean getCDKDialogSeparator (CDKDIALOG *dialog); This returns the state of the separator flag. void setCDKAlphalistBox (CDKDIALOG *dialog, boolean boxWidget); This sets whether or not the widget will be draw with a box around it. boolean getCDKAlphalistBox (CDKDIALOG *dialog); This returns whether or not the widget will be drawn with a box around it. void setCDKDialogULChar (CDKDIALOG *dialog, chtype charac- ter); This function sets the upper left hand corner of the widgets box to the given character. void setCDKDialogURChar (CDKDIALOG *dialog, chtype charac- ter); This function sets the upper right hand corner of the widgets box to the given character. void setCDKDialogLLChar (CDKDIALOG *dialog, chtype charac- ter); This function sets the lower left hand corner of the widgets box to the given character. void setCDKDialogLRChar (CDKDIALOG *dialog, chtype charac- ter); This function sets the lower right hand corner of the widgets box to the given character. void setCDKDialogVerticalChar (CDKDIALOG *dialog, chtype character); This function sets the vertical drawing character for the box to the given character. void setCDKDialogHorizontalChar (CDKDIALOG *dialog, chtype 24 APril 1997 4 cdk_dialog(3) cdk_dialog(3) character); This function sets the horizontal drawing character for the box to the given character. void setCDKDialogBoxAttribute (CDKDIALOG *dialog, chtype attribute); This function sets the attribute of the box. void setCDKDialogBackgroundColor (CDKDIALOG *dialog, 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_dis- play manual page. void moveCDKDialog (CDKDIALOG *dialog, int xpos, int ypos, boolean relative, boolean refresh); This function moves the given widget to the given posi- tion. 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 positionCDKDialog (CDKDIALOG *dialog); 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 24 APril 1997 5 cdk_dialog(3) cdk_dialog(3) 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. 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 drawCDKDialog (CDKDIALOG *dialog, boolean box); This function draws the dialog widget on the screen. The box option draws the widget with or without a box. void eraseCDKDialog (CDKDIALOG *dialog); This function removes the widget from the screen. This does NOT destroy the widget. void destroyCDKDialog (CDKDIALOG *dialog); This function removes the widget from the screen and frees up any memory the object may be using. void setCDKDialogPreProcess (CDKDIALOG *dialog, PRO- CESSFN function, void *data); 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 func- tion if of type PROCESSFN. The parameter data is a pointer to void. To learn more about pre-pro- cessing read the cdk_process manual page. void setCDKDialogPostProcess (CDKDIALOG *dialog, PROCESSFN function, void *data); This function allows the user to have the widget call a function after the key has been applied to the widget. The parameter 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. 24 APril 1997 6 cdk_dialog(3) cdk_dialog(3) void bindCDKObject (EObjectType widgetType, void *object, chtype 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 EOb- jectType 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 param- eter 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 widget. Key Action Left Arrow Selects the button to the left of the current button. Right Arrow Selects the button to the right of the current button. Tab Selects the button to the right of the current button. Space Selects the button to the right of the current button. Return Exits the widget and returns an integer value representing which button was selected. This also sets the structure member exitType in the widget pointer to the value of vNORMAL. Tab Exits the widget and returns an integer value representing which button was selected. 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_process(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 compile line to include the Ncurses header files instead. 24 APril 1997 7
Powered by man-cgi (2024-08-26). Maintained for NetBSD by Kimmo Suominen. Based on man-cgi by Panagiotis Christias.