7
.TH cdk_menu 3 "24 April 1997"
9
newCDKMenu, activateCDKMenu, injectCDKMenu,
11
setCDKMenuCurrentItem, getCDKMenuCurrentItem
12
setCDKMenuTitleHighlight, getCDKMenuTitleHighlight
13
setCDKMenuSubTitleHighlight, getCDKMenuSubTitleHighlight,
14
drawCDKMenu, eraseCDKMenu,
15
destroyCDKMenu, setCDKMenuPreProcess, setCDKMenuPostProcess
16
\- Creates a managed curses menu widget.
20
.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|."
22
.RI "[ " "library" " \|.\|.\|. ]"
26
.BI "CDKMENU *newCDKMenu (CDKSCREEN *" "cdkscreen",
27
.BI "char ***" "menuList",
28
.BI "int " "menuListLength",
29
.BI "int *" "submenuListLength",
30
.BI "int *" "menuLocation",
32
.BI "chtype " "titleAttribute",
33
.BI "chtype " "subtitleAttribute");
35
.BI "int activateCDKMenu (CDKMENU *" "menu",
36
.BI "chtype * " "actions");
38
.BI "int injectCDKMenu (CDKMENU *" "menu",
39
.BI "chtype " "input");
41
.BI "void setCDKMenu (CDKMENU *" "menu",
42
.BI "int " "menuItem",
43
.BI "int " "submenuItem",
44
.BI "chtype " "titleAttribute",
45
.BI "chtype " "subtitleAttribute");
47
.BI "void setCDKMenuCurrentItem (CDKMENU *" "menu",
48
.BI "int " "menuItem",
49
.BI "int " "submenuItem");
51
.BI "void getCDKMenuCurrentItem (CDKMENU *" "menu",
52
.BI "int *" "menuItem",
53
.BI "int *" "submenuItem");
55
.BI "void setCDKMenuTitleHighlight (CDKMENU *" "menu",
56
.BI "chtype " "highlight");
58
.BI "chtype getCDKMenuTitleHighlight (CDKMENU *" "menu");
59
.BI "void setCDKMenuSubTitleHighlight (CDKMENU *" "menu",
60
.BI "chtype " "highlight");
62
.BI "chtype getCDKMenuSubTitleHighlight (CDKMENU *" "menu");
63
.BI "void drawCDKMenu (CDKMENU *" "menu",
64
.BI "boolean " "box");
66
.BI "void eraseCDKMenu (CDKMENU *" "menu");
68
.BI "void destroyCDKMenu (CDKMENU *" "menu");
70
.BI "void setCDKMenuPreProcess (CDKMENU *" "menu",
71
.BI "PROCESSFN " "callback",
72
.BI "void * " "data");
74
.BI "void setCDKMenuPostProcess (CDKMENU *" "menu",
75
.BI "PROCESSFN " "callback",
76
.BI "void * " "data");
78
.BI "void bindCDKObject (EObjectType " "widgetType",
79
.BI "void *" "object",
81
.BI "BINDFN " "function",
84
The Cdk menu widget creates a pull-down menu list. The following are functions
85
which create or manipulate the Cdk menu widget.
87
.SH AVAILABLE FUNCTIONS
88
CDKMENU *newCDKMenu (CDKSCREEN *\f2screen\f1, char ***\f2menuList\f1, int \f2f2menuListLength\f1, int **\f2submenuListLength\f1, int *\f2menuLocation\f1, int \f2menuPos\f1, chtype \f2titleAttribute\f1, chtype \f2subtitleAttribute\f1);
90
This function creates a pointer to a menu widget. The \f2screen\f1 parameter
91
is the screen you wish this widget to be placed in. The parameter \f2menuList\f1
92
is a list of the menu list titles while \f2menuListLength\f1 states how
93
many pull down menus there are. The parameter \f2submenuListLength\f1 states
94
how many menu items are under each menu list. The \f2menuLocation\f1 parameter
95
state where each menu is to be located. Valid values are \f4LEFT\f1 and
96
\f4RIGHT\f1. The parameter \f2menuPos\f1 sets whether the menu is to be on
97
the top of the screen or the bottom. Valid values are \f4TOP\f1 and \f4BOTTOM\f1.
98
The parameters \f2titleAttribute\f1 and \f2subtitleAttribute\f1 are the character
99
attributes of the title and sub-titles respectively. If the widget could not
100
be created then a \f4NULL\f1 pointer is returned.
103
int activateCDKMenu (CDKMENU *\f2menu\f1, chtype *\f2actions\f1);
104
This function activates the menu widget and lets the user interact with the
105
widget. The parameter \f2menu\f1 is a pointer to a non-NULL menu widget.
106
If the \f2actions\f1 parameter is passed with a non-NULL value, the characters
107
in the array will be injected into the widget. To activate the widget
108
interactively pass in a \f4NULL\f1 pointer for \f2actions\f1. If the character entered
109
into this widget is \f4RETURN\f1 then this then this function returns an
110
integer value which is a value of the current menu list * 100 + the sub-menu
111
number. It will also set the structure member \f4exitType\f1 to \f4vNORMAL\f1.
112
If the character entered into this widget was \f4ESCAPE\f1 then the widget
113
will return a value of -1 and the structure member \f4exitType\f1 will be
114
set to \f4vESCAPE_HIT\f1.
118
int injectCDKMenu (CDKMENU *\f2menu\f1, chtype \f2character\f1);
120
This function injects a single character into the widget. The parameter
121
\f2menu\f1 is a pointer to a non-NULL menu widget. The parameter
122
\f2character\f1 is the character to inject into the widget. If the character
123
injected into this widget was \f4RETURN\f1 then the character injected into
124
this widget is \f4RETURN\f1 or \f4TAB\f1 then this function will returns an
125
integer value which is a value of the current menu list * 100 + the sub-menu
126
number. It will also set the structure member \f4exitType\f1 to \f4vNORMAL\f1.
127
If the character entered into this widget was \f4ESCAPE\f1 then the widget
128
will return a value of -1 and the structure member \f4exitType\f1 will be set
129
to \f4vESCAPE_HIT\f1. Any other character injected into the widget will set the
130
structure member \f4exitType\f1 to \f4vEARLY_EXIT\f1 and the function will
134
void setCDKMenu (CDKMENU *\f2menu\f1, int \f2menuItem\f1, int \f2submenuItem\f1, chtype \f2titleAttribute\f1, chtype \f2subtitleAttribute\f1);
136
This function lets the programmer modify certain elements of an already defined
137
menu widget. The parameters \f2menuItem\f1 and \f2submenuItem\f1 set which
138
menu list and sub-menu item are going to be highlighted when the widget is
139
activated. The other parameter names correspond to the same parameter names
140
listed in the \f4newCDKMenu\f1 function.
143
void setCDKMenuCurrentItem (CDKMENU *menu, int menuItem, int subMenuItem);
145
This sets the current item in the menu widget.
148
void getCDKMenuCurrentItem (CDKMENU *menu, int *menuItem, int *subMenuItem);
150
This sets the values of \f2menuItem\f1 and \f2submenuItem\f1 to the current
154
void setCDKMenuTitleHighlight (CDKMENU *menu, chtype highlight);
156
This sets the highlight attributes of the menu title.
159
chtype getCDKMenuTitleHighlight (CDKMENU *menu);
161
This returns the highlight attributes of the menu title.
164
void setCDKMenuSubTitleHighlight (CDKMENU *menu, chtype highlight);
166
THis sets the highlight attribute of the sub-menu selection bar.
169
chtype getCDKMenuSubTitleHighlight (CDKMENU *menu);
171
THis returns the highlight attribute of the sub-menu selection bar.
174
void drawCDKMenu (CDKMENU *\f2menu\f1, boolean \f2box\f1);
176
This function draws the menu widget on the screen. The \f2box\f1 option
177
draws the widget with or without a box.
180
void eraseCDKMenu (CDKMENU *\f2menu\f1);
182
This function removes the widget from the screen. This does \f4NOT\f1 destroy
186
void destroyCDKMenu (CDKMENU *\f2menu\f1);
188
This function removes the widget from the screen and frees up any memory the
192
void setCDKMenuPreProcess (CDKMENU *\f2menu\f1, PROCESSFN \f2function\f1, void *\f2data\f2);
194
This function allows the user to have the widget call a function after a key
195
is hit and before the key is applied to the widget. The parameter \f2function\f1
196
if of type \f4PROCESSFN\f1. The parameter \f2data\f1 is a pointer to
197
\f4void\f1. To learn more about pre-processing read the \f4cdk_process\f1
201
void setCDKMenuPostProcess (CDKMENU *\f2menu\f1, PROCESSFN \f2function\f1, void *\f2data\f2);
203
This function allows the user to have the widget call a function after the
204
key has been applied to the widget. The parameter \f2function\f1 if of type
205
\f4PROCESSFN\f1. The parameter \f2data\f1 is a pointer to \f4void\f1. To
206
learn more about post-processing read the \f4cdk_process\f1 manual page.
209
void bindCDKObject (EObjectType \f2widgetType\f1, void *\f2object\f1, char \f2key\f1, BINDFN \f2function\f1, void *\f2data\f1);
211
This function allows the user to create special key bindings. The
212
\f2widgetType\f1 parameter is a defined type which states what Cdk object
213
type is being used. To learn more about the type \f4EObjectType\f1 read
214
the \f2cdk_binding\f1 manual page. The \f2object\f1 parameter is the
215
pointer to the widget object. The \f2key\f1 is the character to bind. The
216
\f2function\f1 is the function type. To learn more about the key binding
217
callback function types read the \f4cdk_binding\f1 manual page. The last
218
parameter \f2data\f1 is a pointer to any data that needs to get passed to
219
the callback function.
223
When the widget is activated there are several default key bindings which will
224
help the user enter or manipulate the information quickly. The following table
225
outlines the keys and their actions for this widget.
230
Left Arrow Highlights the menu list to the left
232
Right Arrow Highlights the menu list to the right
234
Up Arrow Moves the current menu selection up one.
235
Down Arrow Moves the current menu selection down one.
236
Space Moves the current menu selection down one.
237
Tab Highlights the menu list to the right
239
Return Exits the widget and returns an integer value
240
representing which menu item was selected. This
241
also sets the structure member \f4exitType\f1
242
in the widget pointer to the value of
244
Escape Exits the widget and returns -1. This also
245
sets the structure member \f4exitType\f1 in
246
the widget pointer to the value of
248
Ctrl-L Refreshes the screen.
258
The header file \f4<cdk.h>\f1 automatically includes the header files
259
\f4<curses.h>\f1, \f4<stdlib.h>\f1, \f4<string.h>\f1, \f4<ctype.h>\f1,
260
\f4<unistd.h>\f1, \f4<dirent.h>\f1, \f4<time.h>\f1, \f4<errno.h>\f1,
261
\f4<pwd.h>\f1, \f4<grp.h>\f1, \f4<sys/stat.h>\f1, and \f4<sys/types.h>\f1.
262
The \f4<curses.h>\f1 header file includes \f4<stdio.h>\f1 and \f4<unctrl.h>\f1.
264
If you have \f4Ncurses\f1 installed on your machine add -DNCURSES to the
265
compile line to include the Ncurses header files instead.