~cfuhrman/+junk/netbsd-othersrc-trunk

« back to all changes in this revision

Viewing changes to dist/cdk/man/cdk_menu.3

  • Committer: garbled
  • Date: 2001-01-04 19:59:48 UTC
  • Revision ID: svn-v4:288d5a72-fed7-e111-8680-000c29dcf8fe:trunk:174
Initial import of CDK 4.9.9.  The work to port this was performed by
Charles Hannum, and that is the version being imported:
cdk-4.9.9-20000407-myc3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
.de It
 
2
.br
 
3
.ie \\n(.$>=3 .ne \\$3
 
4
.el .ne 3
 
5
.IP "\\$1" \\$2
 
6
..
 
7
.TH cdk_menu 3 "24 April 1997"
 
8
.SH NAME
 
9
newCDKMenu, activateCDKMenu, injectCDKMenu, 
 
10
setCDKMenu, 
 
11
setCDKMenuCurrentItem, getCDKMenuCurrentItem
 
12
setCDKMenuTitleHighlight, getCDKMenuTitleHighlight
 
13
setCDKMenuSubTitleHighlight, getCDKMenuSubTitleHighlight,
 
14
drawCDKMenu, eraseCDKMenu, 
 
15
destroyCDKMenu, setCDKMenuPreProcess, setCDKMenuPostProcess
 
16
 \- Creates a managed curses menu widget.
 
17
.SH SYNOPSIS
 
18
.LP
 
19
.B cc
 
20
.RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|."
 
21
.B \-lcdk
 
22
.RI "[ " "library" " \|.\|.\|. ]"
 
23
.LP
 
24
#include <cdk.h>
 
25
.LP
 
26
.BI "CDKMENU *newCDKMenu (CDKSCREEN *" "cdkscreen",
 
27
.BI "char ***" "menuList",
 
28
.BI "int " "menuListLength",
 
29
.BI "int *" "submenuListLength",
 
30
.BI "int *" "menuLocation",
 
31
.BI "int " "menuPos",
 
32
.BI "chtype " "titleAttribute",
 
33
.BI "chtype " "subtitleAttribute");
 
34
.LP
 
35
.BI "int activateCDKMenu (CDKMENU *" "menu",
 
36
.BI "chtype * " "actions");
 
37
.LP
 
38
.BI "int injectCDKMenu (CDKMENU *" "menu",
 
39
.BI "chtype " "input");
 
40
.LP
 
41
.BI "void setCDKMenu (CDKMENU *" "menu",
 
42
.BI "int " "menuItem",
 
43
.BI "int " "submenuItem",
 
44
.BI "chtype " "titleAttribute",
 
45
.BI "chtype " "subtitleAttribute");
 
46
.LP
 
47
.BI "void setCDKMenuCurrentItem (CDKMENU *" "menu",
 
48
.BI "int " "menuItem",
 
49
.BI "int " "submenuItem");
 
50
.LP
 
51
.BI "void getCDKMenuCurrentItem (CDKMENU *" "menu",
 
52
.BI "int *" "menuItem",
 
53
.BI "int *" "submenuItem");
 
54
.LP
 
55
.BI "void setCDKMenuTitleHighlight (CDKMENU *" "menu",
 
56
.BI "chtype " "highlight");
 
57
.LP
 
58
.BI "chtype getCDKMenuTitleHighlight (CDKMENU *" "menu");
 
59
.BI "void setCDKMenuSubTitleHighlight (CDKMENU *" "menu",
 
60
.BI "chtype " "highlight");
 
61
.LP
 
62
.BI "chtype getCDKMenuSubTitleHighlight (CDKMENU *" "menu");
 
63
.BI "void drawCDKMenu (CDKMENU *" "menu",
 
64
.BI "boolean " "box");
 
65
.LP
 
66
.BI "void eraseCDKMenu (CDKMENU *" "menu");
 
67
.LP
 
68
.BI "void destroyCDKMenu (CDKMENU *" "menu");
 
69
.LP
 
70
.BI "void setCDKMenuPreProcess (CDKMENU *" "menu",
 
71
.BI "PROCESSFN " "callback",
 
72
.BI "void * " "data");
 
73
.LP
 
74
.BI "void setCDKMenuPostProcess (CDKMENU *" "menu",
 
75
.BI "PROCESSFN " "callback",
 
76
.BI "void * " "data");
 
77
.LP
 
78
.BI "void bindCDKObject (EObjectType " "widgetType",
 
79
.BI "void *" "object",
 
80
.BI "chtype " "key",
 
81
.BI "BINDFN " "function",
 
82
.BI "void *" "data");
 
83
.SH DESCRIPTION
 
84
The Cdk menu widget creates a pull-down menu list. The following are functions 
 
85
which create or manipulate the Cdk menu widget.
 
86
 
 
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);
 
89
.RS 3
 
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.
 
101
.RE
 
102
 
 
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.
 
115
.RS 3
 
116
.RE
 
117
 
 
118
int injectCDKMenu (CDKMENU *\f2menu\f1, chtype \f2character\f1);
 
119
.RS 3
 
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 
 
131
return -1.
 
132
.RE
 
133
 
 
134
void setCDKMenu (CDKMENU *\f2menu\f1, int \f2menuItem\f1, int \f2submenuItem\f1, chtype \f2titleAttribute\f1, chtype \f2subtitleAttribute\f1);
 
135
.RS 3
 
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.
 
141
.RE
 
142
 
 
143
void setCDKMenuCurrentItem (CDKMENU *menu, int menuItem, int subMenuItem);
 
144
.RS 3
 
145
This sets the current item in the menu widget.
 
146
.RE
 
147
 
 
148
void getCDKMenuCurrentItem (CDKMENU *menu, int *menuItem, int *subMenuItem);
 
149
.RS 3
 
150
This sets the values of \f2menuItem\f1 and \f2submenuItem\f1 to the current
 
151
menu selection.
 
152
.RE
 
153
 
 
154
void setCDKMenuTitleHighlight (CDKMENU *menu, chtype highlight);
 
155
.RS 3
 
156
This sets the highlight attributes of the menu title.
 
157
.RE
 
158
 
 
159
chtype getCDKMenuTitleHighlight (CDKMENU *menu);
 
160
.RS 3
 
161
This returns the highlight attributes of the menu title.
 
162
.RE
 
163
 
 
164
void setCDKMenuSubTitleHighlight (CDKMENU *menu, chtype highlight);
 
165
.RS 3
 
166
THis sets the highlight attribute of the sub-menu selection bar.
 
167
.RE
 
168
 
 
169
chtype getCDKMenuSubTitleHighlight (CDKMENU *menu);
 
170
.RS 3
 
171
THis returns the highlight attribute of the sub-menu selection bar.
 
172
.RE
 
173
 
 
174
void drawCDKMenu (CDKMENU *\f2menu\f1, boolean \f2box\f1);
 
175
.RS 3
 
176
This function draws the menu widget on the screen. The \f2box\f1 option 
 
177
draws the widget with or without a box.
 
178
.RE
 
179
 
 
180
void eraseCDKMenu (CDKMENU *\f2menu\f1);
 
181
.RS 3
 
182
This function removes the widget from the screen. This does \f4NOT\f1 destroy
 
183
the widget.
 
184
.RE
 
185
 
 
186
void destroyCDKMenu (CDKMENU *\f2menu\f1);
 
187
.RS 3
 
188
This function removes the widget from the screen and frees up any memory the
 
189
object may be using.
 
190
.RE
 
191
 
 
192
void setCDKMenuPreProcess (CDKMENU *\f2menu\f1, PROCESSFN \f2function\f1, void *\f2data\f2);
 
193
.RS 3
 
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
 
198
manual page.
 
199
.RE
 
200
 
 
201
void setCDKMenuPostProcess (CDKMENU *\f2menu\f1, PROCESSFN \f2function\f1, void *\f2data\f2);
 
202
.RS 3
 
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.
 
207
.RE
 
208
 
 
209
void bindCDKObject (EObjectType \f2widgetType\f1, void *\f2object\f1, char \f2key\f1, BINDFN \f2function\f1, void *\f2data\f1);
 
210
.RS 3
 
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.
 
220
.RE
 
221
 
 
222
.SH KEY BINDINGS
 
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.
 
226
.LP
 
227
.nf
 
228
.RS 3
 
229
\f2Key         Action\f1
 
230
Left Arrow  Highlights the menu list to the left
 
231
            of the current menu.
 
232
Right Arrow Highlights the menu list to the right
 
233
            of the current menu.
 
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
 
238
            of the current menu.
 
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
 
243
            \f4vNORMAL\f1.
 
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 
 
247
            \f4vESCAPE_HIT\f1.
 
248
Ctrl-L      Refreshes the screen.
 
249
.RE
 
250
.fi
 
251
.SH SEE ALSO
 
252
.BR cdk (3),
 
253
.BR cdk_binding (3),
 
254
.BR cdk_display (3),
 
255
.BR cdk_screen (3)
 
256
.SH NOTES
 
257
.PP
 
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.
 
263
.PP
 
264
If you have \f4Ncurses\f1 installed on your machine add -DNCURSES to the 
 
265
compile line to include the Ncurses header files instead.