X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1ff3e9aae5dfdf2cfeba4d8ec44c0640626f98ad..9ba371fa05c50f65e887ca894518f293b4f88c25:/src/common/framecmn.cpp?ds=sidebyside diff --git a/src/common/framecmn.cpp b/src/common/framecmn.cpp index fc61d4e9ae..b303b53a36 100644 --- a/src/common/framecmn.cpp +++ b/src/common/framecmn.cpp @@ -119,8 +119,10 @@ wxPROPERTY( Title,wxString, SetTitle, GetTitle, wxString(), 0 /*flags*/, \ wxPROPERTY_FLAGS( WindowStyle, wxFrameStyle, long, SetWindowStyleFlag, \ GetWindowStyleFlag, wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \ wxT("Helpstring"), wxT("group")) // style +#if wxUSE_MENUS wxPROPERTY( MenuBar, wxMenuBar *, SetMenuBar, GetMenuBar, wxEMPTY_PARAMETER_VALUE, \ 0 /*flags*/, wxT("Helpstring"), wxT("group")) +#endif wxEND_PROPERTIES_TABLE() wxEMPTY_HANDLERS_TABLE(wxFrame) @@ -251,8 +253,7 @@ bool wxFrameBase::ProcessCommand(int id) bool wxFrameBase::ProcessCommand(wxMenuItem *item) { - wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, item->GetId()); - commandEvent.SetEventObject(this); + wxCHECK_MSG( item, false, wxS("Menu item can't be NULL") ); if (!item->IsEnabled()) return true; @@ -260,19 +261,23 @@ bool wxFrameBase::ProcessCommand(wxMenuItem *item) if ((item->GetKind() == wxITEM_RADIO) && item->IsChecked() ) return true; + int checked; if (item->IsCheckable()) { item->Toggle(); // use the new value - commandEvent.SetInt(item->IsChecked()); + checked = item->IsChecked(); } else // Uncheckable item. { - commandEvent.SetInt(-1); + checked = -1; } - return HandleWindowEvent(commandEvent); + wxMenu* const menu = item->GetMenu(); + wxCHECK_MSG( menu, false, wxS("Menu item should be attached to a menu") ); + + return menu->SendEvent(item->GetId(), checked); } #endif // wxUSE_MENUS