1 \section{\class{wxMenuItem
}}\label{wxmenuitem
}
3 A menu item represents an item in a popup menu. Note that the majority of this
4 class is only implemented under Windows so far, but everything except fonts, colours and
5 bitmaps can be achieved via wxMenu on all platforms.
7 \wxheading{Derived from
}
9 wxOwnerDrawn (Windows only)\\
10 \helpref{wxObject
}{wxobject
}
12 \wxheading{Include files
}
18 \helpref{wxMenuBar
}{wxmenubar
},
\helpref{wxMenu
}{wxmenu
}
20 \latexignore{\rtfignore{\wxheading{Members
}}}
22 \membersection{wxMenuItem::wxMenuItem
}\label{wxmenuitemconstr
}
24 \func{}{wxMenuItem
}{\param{wxMenu*
}{ parentMenu = NULL
},
\param{int
}{ id = ID
\_SEPARATOR},
25 \param{const wxString\&
}{text = ""
},
\param{const wxString\&
}{helpString = ""
},
26 \param{bool
}{checkable = FALSE
},
\param{wxMenu*
}{ subMenu = NULL
},
}
28 Constructs a wxMenuItem object.
30 \wxheading{Parameters
}
32 \docparam{parentMenu
}{Menu that the menu item belongs to.
}
34 \docparam{id
}{Identifier for this menu item, or ID
\_SEPARATOR to indicate a separator.
}
36 \docparam{text
}{Text for the menu item, as shown on the menu.
}
38 \docparam{helpString
}{Optional help string that will be shown on the status bar.
}
40 \docparam{checkable
}{TRUE if this menu item is checkable.
}
42 \docparam{subMenu
}{If non-NULL, indicates that the menu item is a submenu.
}
44 \membersection{wxMenuItem::
\destruct{wxMenuItem
}}
46 \func{}{\destruct{wxMenuItem
}}{\void}
50 \membersection{wxMenuItem::Check
}\label{wxmenuitemcheck
}
52 \func{void
}{Check
}{\param{bool
}{ check
}}
54 Checks or unchecks the menu item.
56 \membersection{wxMenuItem::DeleteSubMenu
}\label{wxmenuitemdeletesubmenu
}
58 \func{void
}{DeleteSubMenu
}{\void}
60 Deletes the submenu, if any.
62 \membersection{wxMenuItem::Enable
}\label{wxmenuitemenable
}
64 \func{void
}{Enable
}{\param{bool
}{ enable
}}
66 Enables or disables the menu item.
68 \membersection{wxMenuItem::GetBackgroundColour
}\label{wxmenuitemgetbackgroundcolour
}
70 \constfunc{wxColour\&
}{GetBackgroundColour
}{\void}
72 Returns the background colour associated with the menu item (Windows only).
74 \membersection{wxMenuItem::GetBitmap
}\label{wxmenuitemgetbitmap
}
76 \constfunc{wxBitmap\&
}{GetBitmap
}{\param{bool
}{ checked = TRUE
}}
78 Returns the checked or unchecked bitmap (Windows only).
80 \membersection{wxMenuItem::GetFont
}\label{wxmenuitemgetfont
}
82 \constfunc{wxFont\&
}{GetFont
}{\void}
84 Returns the font associated with the menu item (Windows only).
86 \membersection{wxMenuItem::GetHelp
}\label{wxmenuitemgethelp
}
88 \constfunc{wxString
}{GetHelp
}{\void}
90 Returns the help string associated with the menu item.
92 \membersection{wxMenuItem::GetId
}\label{wxmenuitemgetid
}
94 \constfunc{int
}{GetId
}{\void}
96 Returns the menu item identifier.
98 \membersection{wxMenuItem::GetLabel
}\label{wxmenuitemgetlabel
}
100 \constfunc{wxString
}{GetLabel
}{\void}
102 Returns the text associated with the menu item without any accelerator
103 characaters it might contain.
107 \helpref{GetText
}{wxmenuitemgettext
},
108 \helpref{GetLabelFromText
}{wxmenuitemgetlabelfromtext
}
110 \membersection{wxMenuItem::GetLabelFromText
}\label{wxmenuitemgetlabelfromtext
}
112 \func{static wxString
}{GetLabelFromText
}{\param{const wxString\&
}{text
}}
114 Strips all accelerator characeters and mnemonics from the given
{\it text
}.
118 wxMenuItem::GetLabelFromText("&Hello
\tCtrl-H");
121 will return just
{\tt "Hello"
}.
125 \helpref{GetText
}{wxmenuitemgettext
},
126 \helpref{GetLabel
}{wxmenuitemgetlabel
}
128 \membersection{wxMenuItem::GetMarginWidth
}\label{wxmenuitemgetmarginwidth
}
130 \constfunc{int
}{GetMarginWidth
}{\void}
132 Gets the width of the menu item checkmark bitmap (Windows only).
134 \membersection{wxMenuItem::GetName
}\label{wxmenuitemgetname
}
136 \constfunc{wxString
}{GetName
}{\void}
138 Returns the text associated with the menu item.
140 {\bf NB:
} this function is deprecated, please use
141 \helpref{GetText
}{wxmenuitemgettext
} or
\helpref{GetLabel
}{wxmenuitemgetlabel
}
144 \membersection{wxMenuItem::GetText
}\label{wxmenuitemgettext
}
146 \constfunc{wxString
}{GetText
}{\void}
148 Returns the text associated with the menu item, such as it was passed to the
149 wxMenuItem constructor, i.e. with any accelerator characters it may contain.
153 \helpref{GetLabel
}{wxmenuitemgetlabel
},
154 \helpref{GetLabelFromText
}{wxmenuitemgetlabelfromtext
}
156 \membersection{wxMenuItem::GetSubMenu
}\label{wxmenuitemgetsubmenu
}
158 \constfunc{wxMenu*
}{GetSubMenu
}{\void}
160 Returns the submenu associated with the menu item, or NULL if there isn't one.
162 \membersection{wxMenuItem::GetTextColour
}\label{wxmenuitemgettextcolour
}
164 \constfunc{wxColour\&
}{GetTextColour
}{\void}
166 Returns the text colour associated with the menu item (Windows only).
168 \membersection{wxMenuItem::IsCheckable
}\label{wxmenuitemischeckable
}
170 \constfunc{bool
}{IsCheckable
}{\void}
172 Returns TRUE if the item is checkable.
174 \membersection{wxMenuItem::IsChecked
}\label{wxmenuitemischecked
}
176 \constfunc{bool
}{IsChecked
}{\void}
178 Returns TRUE if the item is checked.
180 \membersection{wxMenuItem::IsEnabled
}\label{wxmenuitemisenabled
}
182 \constfunc{bool
}{IsEnabled
}{\void}
184 Returns TRUE if the item is enabled.
186 \membersection{wxMenuItem::IsSeparator
}\label{wxmenuitemisseparator
}
188 \constfunc{bool
}{IsSeparator
}{\void}
190 Returns TRUE if the item is a separator.
192 \membersection{wxMenuItem::SetBackgroundColour
}\label{wxmenuitemsetbackgroundcolour
}
194 \constfunc{void
}{SetBackgroundColour
}{\param{const wxColour\&
}{colour
}}
196 Sets the background colour associated with the menu item (Windows only).
198 \membersection{wxMenuItem::SetBitmap
}\label{wxmenuitemsetbitmap
}
200 \constfunc{void
}{SetBitmap
}{\param{const wxBitmap\&
}{bmp
}}
202 Sets the bitmap for the menu item (Windows and GTK+ only). It is
203 equivalent to
\helpref{SetBitmaps
}{wxmenuitemsetbitmaps
}(bmp, wxNullBitmap).
205 \membersection{wxMenuItem::SetBitmaps
}\label{wxmenuitemsetbitmaps
}
207 \constfunc{void
}{SetBitmaps
}{\param{const wxBitmap\&
}{checked
},
208 \param{const wxBitmap\&
}{unchecked = wxNullBitmap
}}
210 Sets the checked/unchecked bitmaps for the menu item (Windows only). The first bitmap
211 is also used as the single bitmap for uncheckable menu items.
213 \membersection{wxMenuItem::SetFont
}\label{wxmenuitemsetfont
}
215 \constfunc{void
}{SetFont
}{\param{const wxFont\&
}{font
}}
217 Sets the font associated with the menu item (Windows only).
219 \membersection{wxMenuItem::SetHelp
}\label{wxmenuitemsethelp
}
221 \constfunc{void
}{SetHelp
}{\param{const wxString\&
}{helpString
}}
223 Sets the help string.
225 \membersection{wxMenuItem::SetMarginWidth
}\label{wxmenuitemsetmarginwidth
}
227 \constfunc{void
}{SetMarginWidth
}{\param{int
}{ width
}}
229 Sets the width of the menu item checkmark bitmap (Windows only).
231 \membersection{wxMenuItem::SetName
}\label{wxmenuitemsetname
}
233 \constfunc{void
}{SetName
}{\param{const wxString\&
}{text
}}
235 Sets the text associated with the menu item.
237 \membersection{wxMenuItem::SetTextColour
}\label{wxmenuitemsettextcolour
}
239 \constfunc{void
}{SetTextColour
}{\param{const wxColour\&
}{colour
}}
241 Sets the text colour associated with the menu item (Windows only).