wxMenuBarA menu bar is a series of menus accessible from the top of a frame. Derived from
wxWindow Include files <wx/menu.h> Event handling To respond to a menu selection, provide a handler for EVT_MENU, in the frame that contains the menu bar. If you have a toolbar which uses the same identifiers as your EVT_MENU entries, events from the toolbar will also be processed by your EVT_MENU event handlers. Tip: under Windows, if you discover that menu shortcuts (for example, Alt-F to show the file menu) are not working, check any EVT_CHAR events you are handling in child windows. If you are not calling event.Skip() for events that you don't process in these event handlers, menu shortcuts may cease to work. See also wxMenu, Event handling overview Members
wxMenuBar::wxMenuBar
wxMenuBar::wxMenuBarwxMenuBar(long style = 0) Default constructor. wxMenuBar(size_t n, wxMenu* menus[], const wxString titles[], long style = 0) Construct a menu bar from arrays of menus and titles. Parameters n
menus
titles
style
wxPython note: Only the default constructor is supported in wxPython. Use wxMenuBar::Append instead. wxPerl note: wxPerl only supports the first constructor: use wxMenuBar::Append instead.
wxMenuBar::~wxMenuBarvoid ~wxMenuBar() Destructor, destroying the menu bar and removing it from the parent frame (if any).
wxMenuBar::Appendbool Append(wxMenu *menu, const wxString& title) Adds the item to the end of the menu bar. Parameters menu
title
Return value true on success, false if an error occurred. See also
wxMenuBar::Checkvoid Check(int id, const bool check) Checks or unchecks a menu item. Parameters id
check
Remarks Only use this when the menu bar has been associated with a frame; otherwise, use the wxMenu equivalent call.
wxMenuBar::Enablevoid Enable(int id, const bool enable) Enables or disables (greys out) a menu item. Parameters id
enable
Remarks Only use this when the menu bar has been associated with a frame; otherwise, use the wxMenu equivalent call.
wxMenuBar::EnableTopvoid EnableTop(int pos, const bool enable) Enables or disables a whole menu. Parameters pos
enable
Remarks Only use this when the menu bar has been associated with a frame.
wxMenuBar::FindMenuint FindMenu(const wxString& title) const Returns the index of the menu with the given title or wxNOT_FOUND if no such menu exists in this menubar. The title parameter may specify either the menu title (with accelerator characters, i.e. "&File") or just the menu label ("File") indifferently.
wxMenuBar::FindMenuItemint FindMenuItem(const wxString& menuString, const wxString& itemString) const Finds the menu item id for a menu name/menu item string pair. Parameters menuString
itemString
Return value The menu item identifier, or wxNOT_FOUND if none was found. Remarks Any special menu codes are stripped out of source and target strings before matching.
wxMenuBar::FindItemwxMenuItem * FindItem(int id, wxMenu **menu = NULL) const Finds the menu item object associated with the given menu item identifier. Parameters id
menu
Return value The found menu item object, or NULL if one was not found.
wxMenuBar::GetHelpStringwxString GetHelpString(int id) const Gets the help string associated with the menu item identifier. Parameters id
Return value The help string, or the empty string if there was no help string or the menu item was not found. See also
wxMenuBar::GetLabelwxString GetLabel(int id) const Gets the label associated with a menu item. Parameters id
Return value The menu item label, or the empty string if the item was not found. Remarks Use only after the menubar has been associated with a frame.
wxMenuBar::GetLabelTopwxString GetLabelTop(int pos) const Returns the label of a top-level menu. Note that the returned string does not include the accelerator characters which could have been specified in the menu title string during its construction. Parameters pos
Return value The menu label, or the empty string if the menu was not found. Remarks Use only after the menubar has been associated with a frame. This function is deprecated in favour of GetMenuLabel and GetMenuLabelText. See also
wxMenuBar::GetMenuwxMenu* GetMenu(int menuIndex) const Returns the menu at menuIndex (zero-based).
wxMenuBar::GetMenuCountint GetMenuCount() const Returns the number of menus in this menubar.
wxMenuBar::GetMenuLabelwxString GetMenuLabel(int pos) const Returns the label of a top-level menu. Note that the returned string includes the accelerator characters that have been specified in the menu title string during its construction. Parameters pos
Return value The menu label, or the empty string if the menu was not found. Remarks Use only after the menubar has been associated with a frame. See also wxMenuBar::GetMenuLabelText, wxMenuBar::SetMenuLabel
wxMenuBar::GetMenuLabelTextwxString GetMenuLabelText(int pos) const Returns the label of a top-level menu. Note that the returned string does not include any accelerator characters that may have been specified in the menu title string during its construction. Parameters pos
Return value The menu label, or the empty string if the menu was not found. Remarks Use only after the menubar has been associated with a frame. See also wxMenuBar::GetMenuLabel, wxMenuBar::SetMenuLabel
wxMenuBar::Insertbool Insert(size_t pos, wxMenu *menu, const wxString& title) Inserts the menu at the given position into the menu bar. Inserting menu at position 0 will insert it in the very beginning of it, inserting at position GetMenuCount() is the same as calling Append(). Parameters pos
menu
title
Return value true on success, false if an error occurred. See also
wxMenuBar::IsCheckedbool IsChecked(int id) const Determines whether an item is checked. Parameters id
Return value true if the item was found and is checked, false otherwise.
wxMenuBar::IsEnabledbool IsEnabled(int id) const Determines whether an item is enabled. Parameters id
Return value true if the item was found and is enabled, false otherwise.
wxMenuBar::Refreshvoid Refresh() Redraw the menu bar
wxMenuBar::RemovewxMenu * Remove(size_t pos) Removes the menu from the menu bar and returns the menu object - the caller is responsible for deleting it. This function may be used together with wxMenuBar::Insert to change the menubar dynamically. See also
wxMenuBar::ReplacewxMenu * Replace(size_t pos, wxMenu *menu, const wxString& title) Replaces the menu at the given position with another one. Parameters pos
menu
title
Return value The menu which was previously at position pos. The caller is responsible for deleting it. See also wxMenuBar::Insert, wxMenuBar::Remove
wxMenuBar::SetHelpStringvoid SetHelpString(int id, const wxString& helpString) Sets the help string associated with a menu item. Parameters id
helpString
See also
wxMenuBar::SetLabelvoid SetLabel(int id, const wxString& label) Sets the label of a menu item. Parameters id
label
Remarks Use only after the menubar has been associated with a frame. See also
wxMenuBar::SetLabelTopvoid SetLabelTop(int pos, const wxString& label) Sets the label of a top-level menu. Parameters pos
label
Remarks Use only after the menubar has been associated with a frame. This function has been deprecated in favour of SetMenuLabel. See also
wxMenuBar::SetMenuLabelvoid SetMenuLabel(int pos, const wxString& label) Sets the label of a top-level menu. Parameters pos
label
Remarks Use only after the menubar has been associated with a frame. See also wxMenuBar::GetMenuLabel, wxMenuBar::GetMenuLabelText
|