]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/menuitem.tex
Added wxODBC changes to the log
[wxWidgets.git] / docs / latex / wx / menuitem.tex
CommitLineData
a660d684
KB
1\section{\class{wxMenuItem}}\label{wxmenuitem}
2
d65c269b
VZ
3A menu item represents an item in a menu. Note that you usually don't have to
4deal with it directly as \helpref{wxMenu}{wxmenu} methods usually construct an
5object of this class for you.
6
7Also please note that the methods related to fonts and bitmaps are currently
8only implemented for Windows.
a660d684
KB
9
10\wxheading{Derived from}
11
12wxOwnerDrawn (Windows only)\\
13\helpref{wxObject}{wxobject}
14
954b8ae6
JS
15\wxheading{Include files}
16
17<wx/menuitem.h>
18
a660d684
KB
19\wxheading{See also}
20
2432b92d 21\helpref{wxMenuBar}{wxmenubar}, \helpref{wxMenu}{wxmenu}
a660d684
KB
22
23\latexignore{\rtfignore{\wxheading{Members}}}
24
1892d641 25
dcbd177f 26\membersection{wxMenuItem::wxMenuItem}\label{wxmenuitemctor}
a660d684 27
0ed48c11 28\func{}{wxMenuItem}{\param{wxMenu*}{ parentMenu = NULL}, \param{int}{ id = wxID\_SEPARATOR},
a660d684 29 \param{const wxString\& }{text = ""}, \param{const wxString\& }{helpString = ""},
3980000c 30 \param{wxItemKind }{kind = wxITEM\_NORMAL}, \param{wxMenu*}{ subMenu = NULL}}
a660d684
KB
31
32Constructs a wxMenuItem object.
33
34\wxheading{Parameters}
35
36\docparam{parentMenu}{Menu that the menu item belongs to.}
37
0ed48c11 38\docparam{id}{Identifier for this menu item, or wxID\_SEPARATOR to indicate a separator.}
a660d684 39
2b5f62a0
VZ
40\docparam{text}{Text for the menu item, as shown on the menu. An accelerator
41key can be specified using the ampersand '\&' character. In order to embed an
42ampersand character in the menu item text, the ampersand must be doubled.}
a660d684
KB
43
44\docparam{helpString}{Optional help string that will be shown on the status bar.}
45
8def689d
VZ
46\docparam{kind}{May be {\tt wxITEM\_SEPARATOR}, {\tt wxITEM\_NORMAL},
47{\tt wxITEM\_CHECK} or {\tt wxITEM\_RADIO}}
a660d684
KB
48
49\docparam{subMenu}{If non-NULL, indicates that the menu item is a submenu.}
50
1892d641 51
dcbd177f 52\membersection{wxMenuItem::\destruct{wxMenuItem}}\label{wxmenuitemdtor}
a660d684
KB
53
54\func{}{\destruct{wxMenuItem}}{\void}
55
56Destructor.
57
1892d641 58
a660d684
KB
59\membersection{wxMenuItem::Check}\label{wxmenuitemcheck}
60
3980000c 61\func{void}{Check}{\param{bool}{ check = true}}
a660d684
KB
62
63Checks or unchecks the menu item.
64
1892d641
VZ
65Note that this only works when the item is already appended to a menu.
66
67
a660d684
KB
68\membersection{wxMenuItem::Enable}\label{wxmenuitemenable}
69
3980000c 70\func{void}{Enable}{\param{bool}{ enable = true}}
a660d684
KB
71
72Enables or disables the menu item.
73
1892d641 74
a660d684
KB
75\membersection{wxMenuItem::GetBackgroundColour}\label{wxmenuitemgetbackgroundcolour}
76
77\constfunc{wxColour\&}{GetBackgroundColour}{\void}
78
79Returns the background colour associated with the menu item (Windows only).
80
1892d641 81
a660d684
KB
82\membersection{wxMenuItem::GetBitmap}\label{wxmenuitemgetbitmap}
83
cc81d32f 84\constfunc{wxBitmap\&}{GetBitmap}{\param{bool}{ checked = true}}
a660d684
KB
85
86Returns the checked or unchecked bitmap (Windows only).
87
1892d641 88
a660d684
KB
89\membersection{wxMenuItem::GetFont}\label{wxmenuitemgetfont}
90
91\constfunc{wxFont\&}{GetFont}{\void}
92
93Returns the font associated with the menu item (Windows only).
94
1892d641 95
a660d684
KB
96\membersection{wxMenuItem::GetHelp}\label{wxmenuitemgethelp}
97
98\constfunc{wxString}{GetHelp}{\void}
99
100Returns the help string associated with the menu item.
101
1892d641 102
a660d684
KB
103\membersection{wxMenuItem::GetId}\label{wxmenuitemgetid}
104
105\constfunc{int}{GetId}{\void}
106
107Returns the menu item identifier.
108
1892d641 109
d65c269b
VZ
110\membersection{wxMenuItem::GetKind}\label{wxmenuitemgetkind}
111
112\constfunc{wxItemKind}{GetKind}{\void}
113
8def689d
VZ
114Returns the item kind, one of {\tt wxITEM\_SEPARATOR}, {\tt wxITEM\_NORMAL},
115{\tt wxITEM\_CHECK} or {\tt wxITEM\_RADIO}.
d65c269b 116
1892d641 117
64a89766
VZ
118\membersection{wxMenuItem::GetLabel}\label{wxmenuitemgetlabel}
119
120\constfunc{wxString}{GetLabel}{\void}
121
122Returns the text associated with the menu item without any accelerator
2edb0bde 123characters it might contain.
64a89766
VZ
124
125\wxheading{See also}
126
fa482912 127\helpref{GetText}{wxmenuitemgettext},
3b59cdbf
VZ
128\helpref{GetLabelFromText}{wxmenuitemgetlabelfromtext}
129
1892d641 130
3b59cdbf
VZ
131\membersection{wxMenuItem::GetLabelFromText}\label{wxmenuitemgetlabelfromtext}
132
133\func{static wxString}{GetLabelFromText}{\param{const wxString\& }{text}}
134
2edb0bde 135Strips all accelerator characters and mnemonics from the given {\it text}.
3b59cdbf
VZ
136For example,
137
138\begin{verbatim}
139wxMenuItem::GetLabelFromText("&Hello\tCtrl-H");
140\end{verbatim}
141
142will return just {\tt "Hello"}.
143
144\wxheading{See also}
145
fa482912 146\helpref{GetText}{wxmenuitemgettext},
3b59cdbf 147\helpref{GetLabel}{wxmenuitemgetlabel}
64a89766 148
1892d641 149
a660d684
KB
150\membersection{wxMenuItem::GetMarginWidth}\label{wxmenuitemgetmarginwidth}
151
152\constfunc{int}{GetMarginWidth}{\void}
153
154Gets the width of the menu item checkmark bitmap (Windows only).
155
1892d641 156
a660d684
KB
157\membersection{wxMenuItem::GetName}\label{wxmenuitemgetname}
158
159\constfunc{wxString}{GetName}{\void}
160
161Returns the text associated with the menu item.
162
64a89766
VZ
163{\bf NB:} this function is deprecated, please use
164\helpref{GetText}{wxmenuitemgettext} or \helpref{GetLabel}{wxmenuitemgetlabel}
165instead.
166
1892d641 167
64a89766
VZ
168\membersection{wxMenuItem::GetText}\label{wxmenuitemgettext}
169
170\constfunc{wxString}{GetText}{\void}
171
172Returns the text associated with the menu item, such as it was passed to the
173wxMenuItem constructor, i.e. with any accelerator characters it may contain.
174
175\wxheading{See also}
176
fa482912 177\helpref{GetLabel}{wxmenuitemgetlabel},
3b59cdbf 178\helpref{GetLabelFromText}{wxmenuitemgetlabelfromtext}
64a89766 179
1892d641 180
a660d684
KB
181\membersection{wxMenuItem::GetSubMenu}\label{wxmenuitemgetsubmenu}
182
183\constfunc{wxMenu*}{GetSubMenu}{\void}
184
185Returns the submenu associated with the menu item, or NULL if there isn't one.
186
1892d641 187
a660d684
KB
188\membersection{wxMenuItem::GetTextColour}\label{wxmenuitemgettextcolour}
189
190\constfunc{wxColour\&}{GetTextColour}{\void}
191
192Returns the text colour associated with the menu item (Windows only).
193
1892d641 194
a660d684
KB
195\membersection{wxMenuItem::IsCheckable}\label{wxmenuitemischeckable}
196
197\constfunc{bool}{IsCheckable}{\void}
198
cc81d32f 199Returns true if the item is checkable.
a660d684 200
1892d641 201
a660d684
KB
202\membersection{wxMenuItem::IsChecked}\label{wxmenuitemischecked}
203
204\constfunc{bool}{IsChecked}{\void}
205
cc81d32f 206Returns true if the item is checked.
a660d684 207
1892d641 208
a660d684
KB
209\membersection{wxMenuItem::IsEnabled}\label{wxmenuitemisenabled}
210
211\constfunc{bool}{IsEnabled}{\void}
212
cc81d32f 213Returns true if the item is enabled.
a660d684 214
1892d641 215
a660d684
KB
216\membersection{wxMenuItem::IsSeparator}\label{wxmenuitemisseparator}
217
218\constfunc{bool}{IsSeparator}{\void}
219
cc81d32f 220Returns true if the item is a separator.
a660d684 221
1892d641 222
c87957c2
WS
223\membersection{wxMenuItem::IsSubMenu}\label{wxmenuitemissubmenu}
224
225\constfunc{bool}{IsSubMenu}{\void}
226
227Returns true if the item is a submenu.
228
229
a660d684
KB
230\membersection{wxMenuItem::SetBackgroundColour}\label{wxmenuitemsetbackgroundcolour}
231
e14dccff 232\constfunc{void}{SetBackgroundColour}{\param{const wxColour\& }{colour}}
a660d684
KB
233
234Sets the background colour associated with the menu item (Windows only).
235
1892d641 236
0996d32a
VS
237\membersection{wxMenuItem::SetBitmap}\label{wxmenuitemsetbitmap}
238
239\constfunc{void}{SetBitmap}{\param{const wxBitmap\& }{bmp}}
240
241Sets the bitmap for the menu item (Windows and GTK+ only). It is
242equivalent to \helpref{SetBitmaps}{wxmenuitemsetbitmaps}(bmp, wxNullBitmap).
243
1892d641 244
a660d684
KB
245\membersection{wxMenuItem::SetBitmaps}\label{wxmenuitemsetbitmaps}
246
e14dccff
KB
247\constfunc{void}{SetBitmaps}{\param{const wxBitmap\& }{checked},
248 \param{const wxBitmap\& }{unchecked = wxNullBitmap}}
a660d684
KB
249
250Sets the checked/unchecked bitmaps for the menu item (Windows only). The first bitmap
251is also used as the single bitmap for uncheckable menu items.
252
1892d641 253
a660d684
KB
254\membersection{wxMenuItem::SetFont}\label{wxmenuitemsetfont}
255
e14dccff 256\constfunc{void}{SetFont}{\param{const wxFont\& }{font}}
a660d684
KB
257
258Sets the font associated with the menu item (Windows only).
259
1892d641 260
a660d684
KB
261\membersection{wxMenuItem::SetHelp}\label{wxmenuitemsethelp}
262
e14dccff 263\constfunc{void}{SetHelp}{\param{const wxString\& }{helpString}}
a660d684
KB
264
265Sets the help string.
266
1892d641 267
a660d684
KB
268\membersection{wxMenuItem::SetMarginWidth}\label{wxmenuitemsetmarginwidth}
269
270\constfunc{void}{SetMarginWidth}{\param{int}{ width}}
271
272Sets the width of the menu item checkmark bitmap (Windows only).
273
1892d641 274
4e6978c3 275\membersection{wxMenuItem::SetText}\label{wxmenuitemsettext}
a660d684 276
4e6978c3 277\constfunc{void}{SetText}{\param{const wxString\& }{text}}
a660d684
KB
278
279Sets the text associated with the menu item.
280
1892d641 281
a660d684
KB
282\membersection{wxMenuItem::SetTextColour}\label{wxmenuitemsettextcolour}
283
e14dccff 284\constfunc{void}{SetTextColour}{\param{const wxColour\& }{colour}}
a660d684
KB
285
286Sets the text colour associated with the menu item (Windows only).
287