A menu is a popup (or pull down) list of items, one of which may be selected before the menu goes away (clicking elsewhere dismisses the menu). Menus may be used to construct either menu bars or popup menus.
A menu item has an integer ID associated with it which can be used to identify the selection, or to change the menu item in some way.
See also wxFrame::OnMenuCommand and wxWindow::PopupMenu.
wxMenu::wxMenu
wxMenu::~wxMenu
wxMenu::Append
wxMenu::AppendSeparator
wxMenu::Break
wxMenu::Check
wxMenu::Checked
wxMenu::Enable
wxMenu::FindItem
wxMenu::FindItemForId
wxMenu::GetHelpString
wxMenu::GetLabel
wxMenu::GetTitle
wxMenu::SetHelpString
wxMenu::SetLabel
wxMenu::SetTitle
void wxMenu(char *title = NULL, wxFunction func = NULL)
The first argument is presently ignored. The second argument is a callback function if the menu is used as a popup using wxWindow::PopupMenu.
void ~wxMenu(void)
Destructor, destroying the menu.
void Append(int id, char * item, char *helpString = NULL, Bool checkable = FALSE)
void Append(int id, char * item, wxMenu *submenu, char *helpString = NULL)
Adds the item to the end of the menu. item must be deallocated by the calling program. If the second form is used, the given menu will be a pullright submenu (must be created already). From version 1.50k, this can be used dynamically, i.e. after initial creation of a menu or menubar.
Each form can take an optional help string, which can be accessed using wxMenu::GetHelpString. The default wxFrame::OnMenuSelect member uses this help string to give help on the menu item currently under the cursor.
See the hello.cpp demo for an example of using Append dynamically to implement a file history facility. See also wxMenu::SetLabel.
void AppendSeparator(void)
Adds a separator to the end of the menu. Under XView, this appears as a space.
void Break(void)
Inserts a break in a menu, causing the next appended item to appear in a new column.
void Check(int id, Bool flag)
If flag is TRUE, checks the given menu item, else unchecks it.
Bool Checked(int id)
Returns TRUE if the given menu item is currently checked, FALSE otherwise.
void Enable(int id, Bool flag)
If flag is TRUE, enables the given menu item, else disables it (greys it). MS Windows, Motif, XView.
int FindItem(char *itemString)
Finds the menu item id for a menu item string, or -1 if none found. Any special menu codes are stripped out of source and target strings before matching.
wxMenuItem * FindItemForId(int itemId)
Finds the menu item object associated with the given menu item identifier, returning NULL if not found.
char * GetHelpString(int itemId)
Gets a temporary pointer to the help string associated with the menu item identifer (or NULL if there is no help string or the item was not found).
char * GetLabel(int id)
Gets a temporary pointer to the label of the given menu item; copy this for long-term use. id is the identifier given to wxMenu::Append.
char * GetTitle(void)
Gets a temporary pointer to the title of the menu.
void SetHelpString(int itemId, char *helpString)
Sets the help string associated with the menu item identifer.
void SetLabel(int id, char *label)
Sets the label of the given menu item (using the identifier used to append the item to the menu).
See the hello.cpp demo for an example of using this command to implement a file history facility. See also wxMenu::Append.
void SetTitle(char *title)
Sets the title of the menu.