X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/52130557bfa9d969c7c274bebbf7afc2e496321d..882fc8a922b52668732e0427131e66dae33a86d6:/src/common/menucmn.cpp diff --git a/src/common/menucmn.cpp b/src/common/menucmn.cpp index 5fa6e0723b..d003b79a66 100644 --- a/src/common/menucmn.cpp +++ b/src/common/menucmn.cpp @@ -212,7 +212,7 @@ wxMenuItem *wxMenuBase::DoRemove(wxMenuItem *item) bool wxMenuBase::Delete(wxMenuItem *item) { - wxCHECK_MSG( item, NULL, wxT("invalid item in wxMenu::Delete") ); + wxCHECK_MSG( item, FALSE, wxT("invalid item in wxMenu::Delete") ); return DoDelete(item); } @@ -232,7 +232,7 @@ bool wxMenuBase::DoDelete(wxMenuItem *item) bool wxMenuBase::Destroy(wxMenuItem *item) { - wxCHECK_MSG( item, NULL, wxT("invalid item in wxMenu::Destroy") ); + wxCHECK_MSG( item, FALSE, wxT("invalid item in wxMenu::Destroy") ); return DoDestroy(item); } @@ -266,7 +266,10 @@ int wxMenuBase::FindItem(const wxString& text) const if ( rc != wxNOT_FOUND ) return rc; } - else if ( !item->IsSeparator() ) + + // we execute this code for submenus as well to alllow finding them by + // name just like the ordinary items + if ( !item->IsSeparator() ) { if ( item->GetLabel() == label ) return item->GetId(); @@ -501,7 +504,7 @@ bool wxMenuBarBase::Insert(size_t pos, wxMenu *menu, { if ( pos == m_menus.GetCount() ) { - return Append(menu, title); + return wxMenuBarBase::Append(menu, title); } else { @@ -544,7 +547,7 @@ wxMenu *wxMenuBarBase::Remove(size_t pos) return menu; } -int wxMenuBarBase::FindMenu(const wxString& title) +int wxMenuBarBase::FindMenu(const wxString& title) const { wxString label = wxMenuItem::GetLabelFromText(title);