X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ba1d7a6cec8d9569ce2e380d4a39ddcd4450c9b5..9d33840bab4e10d701dd36f9b8660f6a13f05afe:/interface/wx/menuitem.h diff --git a/interface/wx/menuitem.h b/interface/wx/menuitem.h index eb25e171da..532bfdb565 100644 --- a/interface/wx/menuitem.h +++ b/interface/wx/menuitem.h @@ -15,7 +15,30 @@ usually construct an object of this class for you. Also please note that the methods related to fonts and bitmaps are currently - only implemented for Windows and GTK+. + only implemented for Windows, Mac and GTK+. + + @beginEventTable{wxCommandEvent,wxMenuEvent} + @event{EVT_MENU(id, func)} + Process a @c wxEVT_COMMAND_MENU_SELECTED command, which is generated by a menu item. + This type of event is sent as wxCommandEvent. + @event{EVT_MENU_RANGE(id1, id2, func)} + Process a @c wxEVT_COMMAND_MENU_RANGE command, which is generated by a range of menu items. + This type of event is sent as wxCommandEvent. + @event{EVT_MENU_OPEN(func)} + A menu is about to be opened. On Windows, this is only sent once for each + navigation of the menubar (up until all menus have closed). + This type of event is sent as wxMenuEvent. + @event{EVT_MENU_CLOSE(func)} + A menu has been just closed. + This type of event is sent as wxMenuEvent. + @event{EVT_MENU_HIGHLIGHT(id, func)} + The menu item with the specified id has been highlighted: used to show + help prompts in the status bar by wxFrame + This type of event is sent as wxMenuEvent. + @event{EVT_MENU_HIGHLIGHT_ALL(func)} + A menu item has been highlighted, i.e. the currently selected menu item has changed. + This type of event is sent as wxMenuEvent. + @endEventTable @library{wxcore} @category{menus} @@ -69,19 +92,19 @@ public: instead. @param text Text for the menu item, as shown on the menu. An accelerator key can - be specified using the ampersand " character. In order to embed an + be specified using the ampersand @c & character. In order to embed an ampersand character in the menu item text, the ampersand must be doubled. @param helpString Optional help string that will be shown on the status bar. @param kind May be @c wxITEM_SEPARATOR, @c wxITEM_NORMAL, @c wxITEM_CHECK or - @c wxITEM_RADIO + @c wxITEM_RADIO. @param subMenu If non-@NULL, indicates that the menu item is a submenu. */ wxMenuItem(wxMenu* parentMenu = NULL, int id = wxID_SEPARATOR, - const wxString& text = "", - const wxString& helpString = "", + const wxString& text = wxEmptyString, + const wxString& helpString = wxEmptyString, wxItemKind kind = wxITEM_NORMAL, wxMenu* subMenu = NULL); @@ -109,7 +132,7 @@ public: /** Returns the checked or unchecked bitmap (Windows only). */ - wxBitmap GetBitmap(bool checked = true) const; + virtual const wxBitmap& GetBitmap() const; /** Returns the font associated with the menu item (Windows only). @@ -119,7 +142,7 @@ public: /** Returns the help string associated with the menu item. */ - wxString GetHelp() const; + const wxString& GetHelp() const; /** Returns the menu item identifier. @@ -212,7 +235,7 @@ public: @see GetLabel(), GetLabelFromText() */ - wxString GetText() const; + const wxString& GetText() const; /** Returns the text colour associated with the menu item (Windows only). @@ -250,14 +273,18 @@ public: void SetBackgroundColour(const wxColour& colour) const; /** - Sets the bitmap for the menu item (Windows and GTK+ only). + Sets the bitmap for the menu item. It is equivalent to wxMenuItem::SetBitmaps(bmp, wxNullBitmap). + + @onlyfor{wxmsw,wxmac,wxgtk} */ virtual void SetBitmap(const wxBitmap& bmp); /** - Sets the checked/unchecked bitmaps for the menu item (Windows only). + Sets the checked/unchecked bitmaps for the menu item. The first bitmap is also used as the single bitmap for uncheckable menu items. + + @onlyfor{wxmsw} */ void SetBitmaps(const wxBitmap& checked, const wxBitmap& unchecked = wxNullBitmap); @@ -285,12 +312,12 @@ public: /** Sets the parent menu which will contain this menu item. */ - void SetMenu(const wxMenu* menu); + void SetMenu(wxMenu* menu); /** Sets the submenu of this menu item. */ - void SetSubMenu(const wxMenu* menu); + void SetSubMenu(wxMenu* menu); /** Sets the text associated with the menu item.