1 \section{\class{wxMenuItem
}}\label{wxmenuitem
}
3 A menu item represents an item in a menu. Note that you usually don't have to
4 deal with it directly as
\helpref{wxMenu
}{wxmenu
} methods usually construct an
5 object of this class for you.
7 Also please note that the methods related to fonts and bitmaps are currently
8 only implemented for Windows.
10 \wxheading{Derived from
}
12 wxOwnerDrawn (Windows only)\\
13 \helpref{wxObject
}{wxobject
}
15 \wxheading{Include files
}
21 \helpref{wxMenuBar
}{wxmenubar
},
\helpref{wxMenu
}{wxmenu
}
23 \latexignore{\rtfignore{\wxheading{Members
}}}
25 \membersection{wxMenuItem::wxMenuItem
}\label{wxmenuitemconstr
}
27 \func{}{wxMenuItem
}{\param{wxMenu*
}{ parentMenu = NULL
},
\param{int
}{ id = ID
\_SEPARATOR},
28 \param{const wxString\&
}{text = ""
},
\param{const wxString\&
}{helpString = ""
},
29 \param{wxItemKind
}{kind = wxItem
\_Normal},
\param{wxMenu*
}{ subMenu = NULL
},
}
31 Constructs a wxMenuItem object.
33 \wxheading{Parameters
}
35 \docparam{parentMenu
}{Menu that the menu item belongs to.
}
37 \docparam{id
}{Identifier for this menu item, or ID
\_SEPARATOR to indicate a separator.
}
39 \docparam{text
}{Text for the menu item, as shown on the menu.
}
41 \docparam{helpString
}{Optional help string that will be shown on the status bar.
}
43 \docparam{kind
}{May be
{\tt wxItem
\_Separator},
{\tt wxItem
\_Normal},
44 {\tt wxItem
\_Check} or
{\tt wxItem
\_Radio}}
46 \docparam{subMenu
}{If non-NULL, indicates that the menu item is a submenu.
}
48 \membersection{wxMenuItem::
\destruct{wxMenuItem
}}
50 \func{}{\destruct{wxMenuItem
}}{\void}
54 \membersection{wxMenuItem::Check
}\label{wxmenuitemcheck
}
56 \func{void
}{Check
}{\param{bool
}{ check
}}
58 Checks or unchecks the menu item.
60 \membersection{wxMenuItem::DeleteSubMenu
}\label{wxmenuitemdeletesubmenu
}
62 \func{void
}{DeleteSubMenu
}{\void}
64 Deletes the submenu, if any.
66 \membersection{wxMenuItem::Enable
}\label{wxmenuitemenable
}
68 \func{void
}{Enable
}{\param{bool
}{ enable
}}
70 Enables or disables the menu item.
72 \membersection{wxMenuItem::GetBackgroundColour
}\label{wxmenuitemgetbackgroundcolour
}
74 \constfunc{wxColour\&
}{GetBackgroundColour
}{\void}
76 Returns the background colour associated with the menu item (Windows only).
78 \membersection{wxMenuItem::GetBitmap
}\label{wxmenuitemgetbitmap
}
80 \constfunc{wxBitmap\&
}{GetBitmap
}{\param{bool
}{ checked = TRUE
}}
82 Returns the checked or unchecked bitmap (Windows only).
84 \membersection{wxMenuItem::GetFont
}\label{wxmenuitemgetfont
}
86 \constfunc{wxFont\&
}{GetFont
}{\void}
88 Returns the font associated with the menu item (Windows only).
90 \membersection{wxMenuItem::GetHelp
}\label{wxmenuitemgethelp
}
92 \constfunc{wxString
}{GetHelp
}{\void}
94 Returns the help string associated with the menu item.
96 \membersection{wxMenuItem::GetId
}\label{wxmenuitemgetid
}
98 \constfunc{int
}{GetId
}{\void}
100 Returns the menu item identifier.
102 \membersection{wxMenuItem::GetKind
}\label{wxmenuitemgetkind
}
104 \constfunc{wxItemKind
}{GetKind
}{\void}
106 Returns the item kind, one of
{\tt wxItem
\_Separator},
{\tt wxItem
\_Normal},
107 {\tt wxItem
\_Check} or
{\tt wxItem
\_Radio}.
109 \membersection{wxMenuItem::GetLabel
}\label{wxmenuitemgetlabel
}
111 \constfunc{wxString
}{GetLabel
}{\void}
113 Returns the text associated with the menu item without any accelerator
114 characaters it might contain.
118 \helpref{GetText
}{wxmenuitemgettext
},
119 \helpref{GetLabelFromText
}{wxmenuitemgetlabelfromtext
}
121 \membersection{wxMenuItem::GetLabelFromText
}\label{wxmenuitemgetlabelfromtext
}
123 \func{static wxString
}{GetLabelFromText
}{\param{const wxString\&
}{text
}}
125 Strips all accelerator characeters and mnemonics from the given
{\it text
}.
129 wxMenuItem::GetLabelFromText("&Hello
\tCtrl-H");
132 will return just
{\tt "Hello"
}.
136 \helpref{GetText
}{wxmenuitemgettext
},
137 \helpref{GetLabel
}{wxmenuitemgetlabel
}
139 \membersection{wxMenuItem::GetMarginWidth
}\label{wxmenuitemgetmarginwidth
}
141 \constfunc{int
}{GetMarginWidth
}{\void}
143 Gets the width of the menu item checkmark bitmap (Windows only).
145 \membersection{wxMenuItem::GetName
}\label{wxmenuitemgetname
}
147 \constfunc{wxString
}{GetName
}{\void}
149 Returns the text associated with the menu item.
151 {\bf NB:
} this function is deprecated, please use
152 \helpref{GetText
}{wxmenuitemgettext
} or
\helpref{GetLabel
}{wxmenuitemgetlabel
}
155 \membersection{wxMenuItem::GetText
}\label{wxmenuitemgettext
}
157 \constfunc{wxString
}{GetText
}{\void}
159 Returns the text associated with the menu item, such as it was passed to the
160 wxMenuItem constructor, i.e. with any accelerator characters it may contain.
164 \helpref{GetLabel
}{wxmenuitemgetlabel
},
165 \helpref{GetLabelFromText
}{wxmenuitemgetlabelfromtext
}
167 \membersection{wxMenuItem::GetSubMenu
}\label{wxmenuitemgetsubmenu
}
169 \constfunc{wxMenu*
}{GetSubMenu
}{\void}
171 Returns the submenu associated with the menu item, or NULL if there isn't one.
173 \membersection{wxMenuItem::GetTextColour
}\label{wxmenuitemgettextcolour
}
175 \constfunc{wxColour\&
}{GetTextColour
}{\void}
177 Returns the text colour associated with the menu item (Windows only).
179 \membersection{wxMenuItem::IsCheckable
}\label{wxmenuitemischeckable
}
181 \constfunc{bool
}{IsCheckable
}{\void}
183 Returns TRUE if the item is checkable.
185 \membersection{wxMenuItem::IsChecked
}\label{wxmenuitemischecked
}
187 \constfunc{bool
}{IsChecked
}{\void}
189 Returns TRUE if the item is checked.
191 \membersection{wxMenuItem::IsEnabled
}\label{wxmenuitemisenabled
}
193 \constfunc{bool
}{IsEnabled
}{\void}
195 Returns TRUE if the item is enabled.
197 \membersection{wxMenuItem::IsSeparator
}\label{wxmenuitemisseparator
}
199 \constfunc{bool
}{IsSeparator
}{\void}
201 Returns TRUE if the item is a separator.
203 \membersection{wxMenuItem::SetBackgroundColour
}\label{wxmenuitemsetbackgroundcolour
}
205 \constfunc{void
}{SetBackgroundColour
}{\param{const wxColour\&
}{colour
}}
207 Sets the background colour associated with the menu item (Windows only).
209 \membersection{wxMenuItem::SetBitmap
}\label{wxmenuitemsetbitmap
}
211 \constfunc{void
}{SetBitmap
}{\param{const wxBitmap\&
}{bmp
}}
213 Sets the bitmap for the menu item (Windows and GTK+ only). It is
214 equivalent to
\helpref{SetBitmaps
}{wxmenuitemsetbitmaps
}(bmp, wxNullBitmap).
216 \membersection{wxMenuItem::SetBitmaps
}\label{wxmenuitemsetbitmaps
}
218 \constfunc{void
}{SetBitmaps
}{\param{const wxBitmap\&
}{checked
},
219 \param{const wxBitmap\&
}{unchecked = wxNullBitmap
}}
221 Sets the checked/unchecked bitmaps for the menu item (Windows only). The first bitmap
222 is also used as the single bitmap for uncheckable menu items.
224 \membersection{wxMenuItem::SetFont
}\label{wxmenuitemsetfont
}
226 \constfunc{void
}{SetFont
}{\param{const wxFont\&
}{font
}}
228 Sets the font associated with the menu item (Windows only).
230 \membersection{wxMenuItem::SetHelp
}\label{wxmenuitemsethelp
}
232 \constfunc{void
}{SetHelp
}{\param{const wxString\&
}{helpString
}}
234 Sets the help string.
236 \membersection{wxMenuItem::SetMarginWidth
}\label{wxmenuitemsetmarginwidth
}
238 \constfunc{void
}{SetMarginWidth
}{\param{int
}{ width
}}
240 Sets the width of the menu item checkmark bitmap (Windows only).
242 \membersection{wxMenuItem::SetName
}\label{wxmenuitemsetname
}
244 \constfunc{void
}{SetName
}{\param{const wxString\&
}{text
}}
246 Sets the text associated with the menu item.
248 \membersection{wxMenuItem::SetTextColour
}\label{wxmenuitemsettextcolour
}
250 \constfunc{void
}{SetTextColour
}{\param{const wxColour\&
}{colour
}}
252 Sets the text colour associated with the menu item (Windows only).