X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/68bc148cac0232c0f0aed3ab2f27dfe074869e45..4b5e178a4c22caac92952131632641c63821fc0c:/src/common/menucmn.cpp diff --git a/src/common/menucmn.cpp b/src/common/menucmn.cpp index fa0bfec3d7..37c0c127f1 100644 --- a/src/common/menucmn.cpp +++ b/src/common/menucmn.cpp @@ -58,7 +58,8 @@ wxMenuItemBase::wxMenuItemBase(wxMenu *parentMenu, wxItemKind kind, wxMenu *subMenu) { - wxASSERT_MSG( parentMenu != NULL, wxT("menuitem should have a menu") ); + // notice that parentMenu can be NULL: the item can be attached to the menu + // later with SetMenu() m_parentMenu = parentMenu; m_subMenu = subMenu; @@ -67,7 +68,7 @@ wxMenuItemBase::wxMenuItemBase(wxMenu *parentMenu, m_id = id; m_kind = kind; if (m_id == wxID_ANY) - m_id = wxNewId(); + m_id = wxWindow::NewControlId(); if (m_id == wxID_SEPARATOR) m_kind = wxITEM_SEPARATOR; @@ -125,6 +126,13 @@ void wxMenuItemBase::SetHelp(const wxString& str) } } +#ifndef __WXPM__ +wxString wxMenuItemBase::GetLabelText(const wxString& text) +{ + return wxStripMenuCodes(text); +} +#endif + #if WXWIN_COMPATIBILITY_2_8 wxString wxMenuItemBase::GetLabelFromText(const wxString& text) { @@ -152,8 +160,6 @@ void wxMenuBase::Init(long style) wxMenuBase::~wxMenuBase() { WX_CLEAR_LIST(wxMenuItemList, m_items); - - // Actually, in GTK, the submenus have to get deleted first. } // ---------------------------------------------------------------------------- @@ -452,7 +458,7 @@ bool wxMenuBase::SendEvent(int id, int checked) { wxEvtHandler *handler = GetEventHandler(); if ( handler ) - processed = handler->ProcessEvent(event); + processed = handler->SafelyProcessEvent(event); } // Try the window the menu was popped up from (and up through the @@ -465,7 +471,7 @@ bool wxMenuBase::SendEvent(int id, int checked) wxWindow *win = menu->GetInvokingWindow(); if ( win ) { - processed = win->GetEventHandler()->ProcessEvent(event); + processed = win->HandleWindowEvent(event); break; } @@ -822,7 +828,7 @@ wxString wxMenuBarBase::GetHelpString(int id) const return item->GetHelp(); } -void wxMenuBarBase::UpdateMenus( void ) +void wxMenuBarBase::UpdateMenus() { wxEvtHandler* source; wxMenu* menu; @@ -848,9 +854,8 @@ void wxMenuBarBase::SetLabelTop(size_t pos, const wxString& label) wxString wxMenuBarBase::GetLabelTop(size_t pos) const { - return GetMenuLabel(pos); + return GetMenuLabelText(pos); } #endif - #endif // wxUSE_MENUS