1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311
|
<HTML>
<head><title>wxMenuBar</title></head>
<BODY BGCOLOR=#FFFFFF>
<A NAME="wxmenubar"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx22.htm#classref"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx140.htm#wxmenu"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx142.htm#wxmenuitem"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>
<H2>wxMenuBar</H2>
<P>
A menu bar is a series of menus accessible from the top of a frame.<P>
<B><FONT COLOR="#FF0000">Derived from</FONT></B><P>
<A HREF="wx85.htm#wxevthandler">wxEvtHandler</A><BR>
<A HREF="wx158.htm#wxobject">wxObject</A><P>
<B><FONT COLOR="#FF0000">Include files</FONT></B><P>
<wx/menu.h><P>
<B><FONT COLOR="#FF0000">Event handling</FONT></B><P>
To respond to a menu selection, provide a handler for EVT_MENU, in the frame
that contains the menu bar.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx140.htm#wxmenu">wxMenu</A>, <A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P>
<B><FONT COLOR="#FF0000">Members</FONT></B><P>
<A HREF="#wxmenubarconstr">wxMenuBar::wxMenuBar</A><BR>
<A HREF="#topic560">wxMenuBar::~wxMenuBar</A><BR>
<A HREF="#wxmenubarappend">wxMenuBar::Append</A><BR>
<A HREF="#wxmenubarcheck">wxMenuBar::Check</A><BR>
<A HREF="#wxmenubarenable">wxMenuBar::Enable</A><BR>
<A HREF="#wxmenubarenabletop">wxMenuBar::EnableTop</A><BR>
<A HREF="#wxmenubarfindmenuitem">wxMenuBar::FindMenuItem</A><BR>
<A HREF="#wxmenubarfinditembyid">wxMenuBar::FindItemById</A><BR>
<A HREF="#wxmenubargethelpstring">wxMenuBar::GetHelpString</A><BR>
<A HREF="#wxmenubargetlabel">wxMenuBar::GetLabel</A><BR>
<A HREF="#wxmenubargetlabeltop">wxMenuBar::GetLabelTop</A><BR>
<A HREF="#wxmenubargetmenu">wxMenuBar::GetMenu</A><BR>
<A HREF="#wxmenubargetmenucount">wxMenuBar::GetMenuCount</A><BR>
<A HREF="#wxmenubarischecked">wxMenuBar::IsChecked</A><BR>
<A HREF="#wxmenubarisenabled">wxMenuBar::IsEnabled</A><BR>
<A HREF="#wxmenubarsethelpstring">wxMenuBar::SetHelpString</A><BR>
<A HREF="#wxmenubarsetlabel">wxMenuBar::SetLabel</A><BR>
<A HREF="#wxmenubarsetlabeltop">wxMenuBar::SetLabelTop</A><BR>
<P>
<HR>
<A NAME="wxmenubarconstr"></A>
<H3>wxMenuBar::wxMenuBar</H3>
<P>
<B>void</B> <B>wxMenuBar</B>()<P>
Default constructor.<P>
<B>void</B> <B>wxMenuBar</B>(<B>int</B><I> n</I>, <B>wxMenu*</B><I> menus[]</I>, <B>const wxString </B><I>titles[]</I>)<P>
Construct a menu bar from arrays of menus and titles.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>n</I><UL><UL>
The number of menus.</UL></UL>
<P>
<I>menus</I><UL><UL>
An array of menus. Do not use this array again - it now belongs to the
menu bar.</UL></UL>
<P>
<I>titles</I><UL><UL>
An array of title strings. Deallocate this array after creating the menu bar.</UL></UL>
<P>
<B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR>
Only the default constructor is supported in wxPython.
Use wxMenuBar.Append instead.<P>
<HR>
<A NAME="topic560"></A>
<H3>wxMenuBar::~wxMenuBar</H3>
<P>
<B>void</B> <B>~wxMenuBar</B>()<P>
Destructor, destroying the menu bar and removing it from the parent frame (if any).<P>
<HR>
<A NAME="wxmenubarappend"></A>
<H3>wxMenuBar::Append</H3>
<P>
<B>void</B> <B>Append</B>(<B>wxMenu *</B><I>menu</I>, <B>const wxString& </B><I>title</I>)<P>
Adds the item to the end of the menu bar.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>menu</I><UL><UL>
The menu to add. Do not deallocate this menu after calling <B>Append</B>.</UL></UL>
<P>
<I>title</I><UL><UL>
The title of the menu.</UL></UL>
<P>
<HR>
<A NAME="wxmenubarcheck"></A>
<H3>wxMenuBar::Check</H3>
<P>
<B>void</B> <B>Check</B>(<B>int</B><I> id</I>, <B>const bool</B><I> check</I>)<P>
Checks or unchecks a menu item.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>id</I><UL><UL>
The menu item identifier.</UL></UL>
<P>
<I>check</I><UL><UL>
If TRUE, checks the menu item, otherwise the item is unchecked.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
Only use this when the menu bar has been associated
with a frame; otherwise, use the wxMenu equivalent call.<P>
<HR>
<A NAME="wxmenubarenable"></A>
<H3>wxMenuBar::Enable</H3>
<P>
<B>void</B> <B>Enable</B>(<B>int</B><I> id</I>, <B>const bool</B><I> enable</I>)<P>
Enables or disables (greys out) a menu item.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>id</I><UL><UL>
The menu item identifier.</UL></UL>
<P>
<I>enable</I><UL><UL>
TRUE to enable the item, FALSE to disable it.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
Only use this when the menu bar has been
associated with a frame; otherwise, use the wxMenu equivalent call.<P>
<HR>
<A NAME="wxmenubarenabletop"></A>
<H3>wxMenuBar::EnableTop</H3>
<P>
<B>void</B> <B>EnableTop</B>(<B>int</B><I> pos</I>, <B>const bool</B><I> enable</I>)<P>
Enables or disables a whole menu.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>pos</I><UL><UL>
The position of the menu, starting from zero.</UL></UL>
<P>
<I>enable</I><UL><UL>
TRUE to enable the menu, FALSE to disable it.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
Only use this when the menu bar has been
associated with a frame.<P>
<HR>
<A NAME="wxmenubarfindmenuitem"></A>
<H3>wxMenuBar::FindMenuItem</H3>
<P>
<B>int</B> <B>FindMenuItem</B>(<B>const wxString& </B><I>menuString</I>, <B>const wxString& </B><I>itemString</I>) <B>const</B><P>
Finds the menu item id for a menu name/menu item string pair.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>menuString</I><UL><UL>
Menu title to find.</UL></UL>
<P>
<I>itemString</I><UL><UL>
Item to find.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
The menu item identifier, or -1 if none was found.<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
Any special menu codes are stripped out of source and target strings
before matching.<P>
<HR>
<A NAME="wxmenubarfinditembyid"></A>
<H3>wxMenuBar::FindItemById</H3>
<P>
<B>wxMenuItem *</B> <B>FindItemById</B>(<B>int</B><I> id</I>) <B>const</B><P>
Finds the menu item object associated with the given menu item identifier,<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>id</I><UL><UL>
Menu item identifier.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
The found menu item object, or NULL if one was not found.<P>
<HR>
<A NAME="wxmenubargethelpstring"></A>
<H3>wxMenuBar::GetHelpString</H3>
<P>
<B>wxString</B> <B>GetHelpString</B>(<B>int</B><I> id</I>) <B>const</B><P>
Gets the help string associated with the menu item identifer.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>id</I><UL><UL>
The menu item identifier.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
The help string, or the empty string if there was no help string or the menu item
was not found.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx141.htm#wxmenubarsethelpstring">wxMenuBar::SetHelpString</A><P>
<HR>
<A NAME="wxmenubargetlabel"></A>
<H3>wxMenuBar::GetLabel</H3>
<P>
<B>wxString</B> <B>GetLabel</B>(<B>int</B><I> id</I>) <B>const</B><P>
Gets the label associated with a menu item.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>id</I><UL><UL>
The menu item identifier.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
The menu item label, or the empty string if the item was not found.<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
Use only after the menubar has been associated with a frame.<P>
<HR>
<A NAME="wxmenubargetlabeltop"></A>
<H3>wxMenuBar::GetLabelTop</H3>
<P>
<B>wxString</B> <B>GetLabelTop</B>(<B>int</B><I> pos</I>) <B>const</B><P>
Returns the label of a top-level menu.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>pos</I><UL><UL>
Position of the menu on the menu bar, starting from zero.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
The menu label, or the empty string if the menu was not found.<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
Use only after the menubar has been associated with a frame.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx141.htm#wxmenubarsetlabeltop">wxMenuBar::SetLabelTop</A><P>
<HR>
<A NAME="wxmenubargetmenu"></A>
<H3>wxMenuBar::GetMenu</H3>
<P>
<B>wxMenu*</B> <B>GetMenu</B>(<B>int</B><I> menuIndex</I>) <B>const</B><P>
Returns the menu at <I>menuIndex</I> (zero-based).<P>
<HR>
<A NAME="wxmenubargetmenucount"></A>
<H3>wxMenuBar::GetMenuCount</H3>
<P>
<B>int</B> <B>GetMenuCount</B>() <B>const</B><P>
Returns the number of menus in this menubar.<P>
<HR>
<A NAME="wxmenubarischecked"></A>
<H3>wxMenuBar::IsChecked</H3>
<P>
<B>bool</B> <B>IsChecked</B>(<B>int</B><I> id</I>) <B>const</B><P>
Determines whether an item is checked.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>id</I><UL><UL>
The menu item identifier.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
TRUE if the item was found and is checked, FALSE otherwise.<P>
<HR>
<A NAME="wxmenubarisenabled"></A>
<H3>wxMenuBar::IsEnabled</H3>
<P>
<B>bool</B> <B>IsEnabled</B>(<B>int</B><I> id</I>) <B>const</B><P>
Determines whether an item is enabled.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>id</I><UL><UL>
The menu item identifier.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
TRUE if the item was found and is enabled, FALSE otherwise.<P>
<HR>
<A NAME="wxmenubarsethelpstring"></A>
<H3>wxMenuBar::SetHelpString</H3>
<P>
<B>void</B> <B>SetHelpString</B>(<B>int</B><I> id</I>, <B>const wxString& </B><I>helpString</I>)<P>
Sets the help string associated with a menu item.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>id</I><UL><UL>
Menu item identifier.</UL></UL>
<P>
<I>helpString</I><UL><UL>
Help string to associate with the menu item.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx141.htm#wxmenubargethelpstring">wxMenuBar::GetHelpString</A><P>
<HR>
<A NAME="wxmenubarsetlabel"></A>
<H3>wxMenuBar::SetLabel</H3>
<P>
<B>void</B> <B>SetLabel</B>(<B>int</B><I> id</I>, <B>const wxString& </B><I>label</I>)<P>
Sets the label of a menu item.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>id</I><UL><UL>
Menu item identifier.</UL></UL>
<P>
<I>label</I><UL><UL>
Menu item label.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
Use only after the menubar has been associated with a frame.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx141.htm#wxmenubargetlabel">wxMenuBar::GetLabel</A><P>
<HR>
<A NAME="wxmenubarsetlabeltop"></A>
<H3>wxMenuBar::SetLabelTop</H3>
<P>
<B>void</B> <B>SetLabelTop</B>(<B>int</B><I> pos</I>, <B>const wxString& </B><I>label</I>)<P>
Sets the label of a top-level menu.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>pos</I><UL><UL>
The position of a menu on the menu bar, starting from zero.</UL></UL>
<P>
<I>label</I><UL><UL>
The menu label.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
Use only after the menubar has been associated with a frame.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx141.htm#wxmenubargetlabeltop">wxMenuBar::GetLabelTop</A><P>
</BODY></HTML>
|