]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/menuitem.tex
Reversed the meaning of black and white in wxRegion::ConvertToBitmap
[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
25\membersection{wxMenuItem::wxMenuItem}\label{wxmenuitemconstr}
26
27\func{}{wxMenuItem}{\param{wxMenu*}{ parentMenu = NULL}, \param{int}{ id = ID\_SEPARATOR},
28 \param{const wxString\& }{text = ""}, \param{const wxString\& }{helpString = ""},
8def689d 29 \param{wxItemKind }{kind = wxITEM\_NORMAL}, \param{wxMenu*}{ subMenu = NULL}, }
a660d684
KB
30
31Constructs a wxMenuItem object.
32
33\wxheading{Parameters}
34
35\docparam{parentMenu}{Menu that the menu item belongs to.}
36
37\docparam{id}{Identifier for this menu item, or ID\_SEPARATOR to indicate a separator.}
38
2b5f62a0
VZ
39\docparam{text}{Text for the menu item, as shown on the menu. An accelerator
40key can be specified using the ampersand '\&' character. In order to embed an
41ampersand character in the menu item text, the ampersand must be doubled.}
a660d684
KB
42
43\docparam{helpString}{Optional help string that will be shown on the status bar.}
44
8def689d
VZ
45\docparam{kind}{May be {\tt wxITEM\_SEPARATOR}, {\tt wxITEM\_NORMAL},
46{\tt wxITEM\_CHECK} or {\tt wxITEM\_RADIO}}
a660d684
KB
47
48\docparam{subMenu}{If non-NULL, indicates that the menu item is a submenu.}
49
50\membersection{wxMenuItem::\destruct{wxMenuItem}}
51
52\func{}{\destruct{wxMenuItem}}{\void}
53
54Destructor.
55
56\membersection{wxMenuItem::Check}\label{wxmenuitemcheck}
57
58\func{void}{Check}{\param{bool}{ check}}
59
60Checks or unchecks the menu item.
61
62\membersection{wxMenuItem::DeleteSubMenu}\label{wxmenuitemdeletesubmenu}
63
64\func{void}{DeleteSubMenu}{\void}
65
66Deletes the submenu, if any.
67
68\membersection{wxMenuItem::Enable}\label{wxmenuitemenable}
69
70\func{void}{Enable}{\param{bool}{ enable}}
71
72Enables or disables the menu item.
73
74\membersection{wxMenuItem::GetBackgroundColour}\label{wxmenuitemgetbackgroundcolour}
75
76\constfunc{wxColour\&}{GetBackgroundColour}{\void}
77
78Returns the background colour associated with the menu item (Windows only).
79
80\membersection{wxMenuItem::GetBitmap}\label{wxmenuitemgetbitmap}
81
cc81d32f 82\constfunc{wxBitmap\&}{GetBitmap}{\param{bool}{ checked = true}}
a660d684
KB
83
84Returns the checked or unchecked bitmap (Windows only).
85
86\membersection{wxMenuItem::GetFont}\label{wxmenuitemgetfont}
87
88\constfunc{wxFont\&}{GetFont}{\void}
89
90Returns the font associated with the menu item (Windows only).
91
92\membersection{wxMenuItem::GetHelp}\label{wxmenuitemgethelp}
93
94\constfunc{wxString}{GetHelp}{\void}
95
96Returns the help string associated with the menu item.
97
98\membersection{wxMenuItem::GetId}\label{wxmenuitemgetid}
99
100\constfunc{int}{GetId}{\void}
101
102Returns the menu item identifier.
103
d65c269b
VZ
104\membersection{wxMenuItem::GetKind}\label{wxmenuitemgetkind}
105
106\constfunc{wxItemKind}{GetKind}{\void}
107
8def689d
VZ
108Returns the item kind, one of {\tt wxITEM\_SEPARATOR}, {\tt wxITEM\_NORMAL},
109{\tt wxITEM\_CHECK} or {\tt wxITEM\_RADIO}.
d65c269b 110
64a89766
VZ
111\membersection{wxMenuItem::GetLabel}\label{wxmenuitemgetlabel}
112
113\constfunc{wxString}{GetLabel}{\void}
114
115Returns the text associated with the menu item without any accelerator
2edb0bde 116characters it might contain.
64a89766
VZ
117
118\wxheading{See also}
119
fa482912 120\helpref{GetText}{wxmenuitemgettext},
3b59cdbf
VZ
121\helpref{GetLabelFromText}{wxmenuitemgetlabelfromtext}
122
123\membersection{wxMenuItem::GetLabelFromText}\label{wxmenuitemgetlabelfromtext}
124
125\func{static wxString}{GetLabelFromText}{\param{const wxString\& }{text}}
126
2edb0bde 127Strips all accelerator characters and mnemonics from the given {\it text}.
3b59cdbf
VZ
128For example,
129
130\begin{verbatim}
131wxMenuItem::GetLabelFromText("&Hello\tCtrl-H");
132\end{verbatim}
133
134will return just {\tt "Hello"}.
135
136\wxheading{See also}
137
fa482912 138\helpref{GetText}{wxmenuitemgettext},
3b59cdbf 139\helpref{GetLabel}{wxmenuitemgetlabel}
64a89766 140
a660d684
KB
141\membersection{wxMenuItem::GetMarginWidth}\label{wxmenuitemgetmarginwidth}
142
143\constfunc{int}{GetMarginWidth}{\void}
144
145Gets the width of the menu item checkmark bitmap (Windows only).
146
147\membersection{wxMenuItem::GetName}\label{wxmenuitemgetname}
148
149\constfunc{wxString}{GetName}{\void}
150
151Returns the text associated with the menu item.
152
64a89766
VZ
153{\bf NB:} this function is deprecated, please use
154\helpref{GetText}{wxmenuitemgettext} or \helpref{GetLabel}{wxmenuitemgetlabel}
155instead.
156
157\membersection{wxMenuItem::GetText}\label{wxmenuitemgettext}
158
159\constfunc{wxString}{GetText}{\void}
160
161Returns the text associated with the menu item, such as it was passed to the
162wxMenuItem constructor, i.e. with any accelerator characters it may contain.
163
164\wxheading{See also}
165
fa482912 166\helpref{GetLabel}{wxmenuitemgetlabel},
3b59cdbf 167\helpref{GetLabelFromText}{wxmenuitemgetlabelfromtext}
64a89766 168
a660d684
KB
169\membersection{wxMenuItem::GetSubMenu}\label{wxmenuitemgetsubmenu}
170
171\constfunc{wxMenu*}{GetSubMenu}{\void}
172
173Returns the submenu associated with the menu item, or NULL if there isn't one.
174
175\membersection{wxMenuItem::GetTextColour}\label{wxmenuitemgettextcolour}
176
177\constfunc{wxColour\&}{GetTextColour}{\void}
178
179Returns the text colour associated with the menu item (Windows only).
180
181\membersection{wxMenuItem::IsCheckable}\label{wxmenuitemischeckable}
182
183\constfunc{bool}{IsCheckable}{\void}
184
cc81d32f 185Returns true if the item is checkable.
a660d684
KB
186
187\membersection{wxMenuItem::IsChecked}\label{wxmenuitemischecked}
188
189\constfunc{bool}{IsChecked}{\void}
190
cc81d32f 191Returns true if the item is checked.
a660d684
KB
192
193\membersection{wxMenuItem::IsEnabled}\label{wxmenuitemisenabled}
194
195\constfunc{bool}{IsEnabled}{\void}
196
cc81d32f 197Returns true if the item is enabled.
a660d684
KB
198
199\membersection{wxMenuItem::IsSeparator}\label{wxmenuitemisseparator}
200
201\constfunc{bool}{IsSeparator}{\void}
202
cc81d32f 203Returns true if the item is a separator.
a660d684
KB
204
205\membersection{wxMenuItem::SetBackgroundColour}\label{wxmenuitemsetbackgroundcolour}
206
e14dccff 207\constfunc{void}{SetBackgroundColour}{\param{const wxColour\& }{colour}}
a660d684
KB
208
209Sets the background colour associated with the menu item (Windows only).
210
0996d32a
VS
211\membersection{wxMenuItem::SetBitmap}\label{wxmenuitemsetbitmap}
212
213\constfunc{void}{SetBitmap}{\param{const wxBitmap\& }{bmp}}
214
215Sets the bitmap for the menu item (Windows and GTK+ only). It is
216equivalent to \helpref{SetBitmaps}{wxmenuitemsetbitmaps}(bmp, wxNullBitmap).
217
a660d684
KB
218\membersection{wxMenuItem::SetBitmaps}\label{wxmenuitemsetbitmaps}
219
e14dccff
KB
220\constfunc{void}{SetBitmaps}{\param{const wxBitmap\& }{checked},
221 \param{const wxBitmap\& }{unchecked = wxNullBitmap}}
a660d684
KB
222
223Sets the checked/unchecked bitmaps for the menu item (Windows only). The first bitmap
224is also used as the single bitmap for uncheckable menu items.
225
226\membersection{wxMenuItem::SetFont}\label{wxmenuitemsetfont}
227
e14dccff 228\constfunc{void}{SetFont}{\param{const wxFont\& }{font}}
a660d684
KB
229
230Sets the font associated with the menu item (Windows only).
231
232\membersection{wxMenuItem::SetHelp}\label{wxmenuitemsethelp}
233
e14dccff 234\constfunc{void}{SetHelp}{\param{const wxString\& }{helpString}}
a660d684
KB
235
236Sets the help string.
237
238\membersection{wxMenuItem::SetMarginWidth}\label{wxmenuitemsetmarginwidth}
239
240\constfunc{void}{SetMarginWidth}{\param{int}{ width}}
241
242Sets the width of the menu item checkmark bitmap (Windows only).
243
4e6978c3 244\membersection{wxMenuItem::SetText}\label{wxmenuitemsettext}
a660d684 245
4e6978c3 246\constfunc{void}{SetText}{\param{const wxString\& }{text}}
a660d684
KB
247
248Sets the text associated with the menu item.
249
250\membersection{wxMenuItem::SetTextColour}\label{wxmenuitemsettextcolour}
251
e14dccff 252\constfunc{void}{SetTextColour}{\param{const wxColour\& }{colour}}
a660d684
KB
253
254Sets the text colour associated with the menu item (Windows only).
255