cdk_menu(3)
- NetBSD Manual Pages
cdk_menu(3) cdk_menu(3)
NAME
newCDKMenu, activateCDKMenu, injectCDKMenu, setCDKMenu, setCDKMenuCur-
rentItem, getCDKMenuCurrentItem setCDKMenuTitleHighlight, getCDKMenuTi-
tleHighlight setCDKMenuSubTitleHighlight, getCDKMenuSubTitleHighlight,
drawCDKMenu, eraseCDKMenu, destroyCDKMenu, setCDKMenuPreProcess, setCD-
KMenuPostProcess
- Creates a managed curses menu widget.
SYNOPSIS
cc [ flag ... ] file ... -lcdk [ library ... ]
#include <cdk.h>
CDKMENU *newCDKMenu (CDKSCREEN *cdkscreen, char ***menuList, int
menuListLength, int *submenuListLength, int *menuLocation, int menuPos,
chtype titleAttribute, chtype subtitleAttribute);
int activateCDKMenu (CDKMENU *menu, chtype * actions);
int injectCDKMenu (CDKMENU *menu, chtype input);
void setCDKMenu (CDKMENU *menu, int menuItem, int submenuItem, chtype
titleAttribute, chtype subtitleAttribute);
void setCDKMenuCurrentItem (CDKMENU *menu, int menuItem, int submenu-
Item);
void getCDKMenuCurrentItem (CDKMENU *menu, int *menuItem, int *submenu-
Item);
void setCDKMenuTitleHighlight (CDKMENU *menu, chtype highlight);
chtype getCDKMenuTitleHighlight (CDKMENU *menu); void setCDKMenuSubTi-
tleHighlight (CDKMENU *menu, chtype highlight);
chtype getCDKMenuSubTitleHighlight (CDKMENU *menu); void drawCDKMenu
(CDKMENU *menu, boolean box);
void eraseCDKMenu (CDKMENU *menu);
void destroyCDKMenu (CDKMENU *menu);
void setCDKMenuPreProcess (CDKMENU *menu, PROCESSFN callback, void *
data);
void setCDKMenuPostProcess (CDKMENU *menu, PROCESSFN callback, void *
data);
void bindCDKObject (EObjectType widgetType, void *object, chtype key,
BINDFN function, void *data);
DESCRIPTION
The Cdk menu widget creates a pull-down menu list. The following are
functions which create or manipulate the Cdk menu widget.
AVAILABLE FUNCTIONS
CDKMENU *newCDKMenu (CDKSCREEN *screen, char ***menuList, int
f2menuListLength, int **submenuListLength, int *menuLocation, int menu-
Pos, chtype titleAttribute, chtype subtitleAttribute);
This function creates a pointer to a menu widget. The screen parame-
ter is the screen you wish this widget to be placed in. The parame-
ter menuList is a list of the menu list titles while menuListLength
states how many pull down menus there are. The parameter sub-
menuListLength states how many menu items are under each menu list.
The menuLocation parameter state where each menu is to be located.
Valid values are LEFT and RIGHT. The parameter menuPos sets whether
the menu is to be on the top of the screen or the bottom. Valid val-
ues are TOP and BOTTOM. The parameters titleAttribute and subti-
tleAttribute are the character attributes of the title and sub-
titles respectively. If the widget could not be created then a NULL
pointer is returned.
int activateCDKMenu (CDKMENU *menu, chtype *actions); This function
activates the menu widget and lets the user interact with the widget.
The parameter menu is a pointer to a non-NULL menu 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 then this then this function returns
an integer value which is a value of the current menu list * 100 + the
sub-menu number. 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 injectCDKMenu (CDKMENU *menu, chtype character);
This function injects a single character into the widget. The param-
eter menu is a pointer to a non-NULL menu widget. The parameter
character is the character to inject into the widget. If the charac-
ter injected into this widget was RETURN then the character injected
into this widget is RETURN or TAB then this function will returns an
integer value which is a value of the current menu list * 100 + the
sub-menu number. 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 setCDKMenu (CDKMENU *menu, int menuItem, int submenuItem, chtype
titleAttribute, chtype subtitleAttribute);
This function lets the programmer modify certain elements of an
already defined menu widget. The parameters menuItem and submenuItem
set which menu list and sub-menu item are going to be highlighted
when the widget is activated. The other parameter names correspond
to the same parameter names listed in the newCDKMenu function.
void setCDKMenuCurrentItem (CDKMENU *menu, int menuItem, int subMenu-
Item);
This sets the current item in the menu widget.
void getCDKMenuCurrentItem (CDKMENU *menu, int *menuItem, int *subMenu-
Item);
This sets the values of menuItem and submenuItem to the current menu
selection.
void setCDKMenuTitleHighlight (CDKMENU *menu, chtype highlight);
This sets the highlight attributes of the menu title.
chtype getCDKMenuTitleHighlight (CDKMENU *menu);
This returns the highlight attributes of the menu title.
void setCDKMenuSubTitleHighlight (CDKMENU *menu, chtype highlight);
THis sets the highlight attribute of the sub-menu selection bar.
chtype getCDKMenuSubTitleHighlight (CDKMENU *menu);
THis returns the highlight attribute of the sub-menu selection bar.
void drawCDKMenu (CDKMENU *menu, boolean box);
This function draws the menu widget on the screen. The box option
draws the widget with or without a box.
void eraseCDKMenu (CDKMENU *menu);
This function removes the widget from the screen. This does NOT
destroy the widget.
void destroyCDKMenu (CDKMENU *menu);
This function removes the widget from the screen and frees up any
memory the object may be using.
void setCDKMenuPreProcess (CDKMENU *menu, PROCESSFN 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 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 setCDKMenuPostProcess (CDKMENU *menu, 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 func-
tion 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 call-
back 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 Highlights the menu list to the left
of the current menu.
Right Arrow Highlights the menu list to the right
of the current menu.
Up Arrow Moves the current menu selection up one.
Down Arrow Moves the current menu selection down one.
Space Moves the current menu selection down one.
Tab Highlights the menu list to the right
of the current menu.
Return Exits the widget and returns an integer value
representing which menu item 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_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_menu(3)
Powered by man-cgi (2024-03-20).
Maintained for NetBSD
by Kimmo Suominen.
Based on man-cgi by Panagiotis Christias.