X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3ca6a5f04692678cd2d9f3ea0843fc3f5a0b254f..015e69f36dfbc469eef59456f973d0567e865d70:/samples/menu/menu.cpp?ds=sidebyside diff --git a/samples/menu/menu.cpp b/samples/menu/menu.cpp index cee944b197..bb2e4de3b6 100644 --- a/samples/menu/menu.cpp +++ b/samples/menu/menu.cpp @@ -26,10 +26,11 @@ #ifndef WX_PRECOMP #include - #include #endif +#include "copy.xpm" + // ---------------------------------------------------------------------------- // classes // ---------------------------------------------------------------------------- @@ -232,6 +233,10 @@ MyFrame::MyFrame() // create the menubar wxMenu *fileMenu = new wxMenu; fileMenu->Append(Menu_File_Quit, "E&xit\tAlt-X", "Quit toolbar sample" ); + + wxMenuItem *bitmap_menu_item = new wxMenuItem( fileMenu, Menu_File_Quit, "Quit with &bitmap\tAlt-Q" ); + bitmap_menu_item->SetBitmap( wxBitmap( copy_xpm ) ); + fileMenu->Append( bitmap_menu_item ); wxMenu *menubarMenu = new wxMenu; menubarMenu->Append(Menu_MenuBar_Append, "&Append menu\tCtrl-A", @@ -341,6 +346,8 @@ wxMenuItem *MyFrame::GetLastMenuItem() const void MyFrame::LogMenuEvent(const wxCommandEvent& event) { int id = event.GetId(); + if (!GetMenuBar()->FindItem(id)) + return; wxString msg = wxString::Format("Menu command %d", id); if ( GetMenuBar()->FindItem(id)->IsCheckable() ) {