X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/83eabba429ab076322fbdddd1d011c73af814fe2..2ee322d90c0c0f39d4a3c5f0c942bbda4c7baa1a:/src/mac/carbon/menuitem.cpp diff --git a/src/mac/carbon/menuitem.cpp b/src/mac/carbon/menuitem.cpp index 0eb888060b..7d6dc48db1 100644 --- a/src/mac/carbon/menuitem.cpp +++ b/src/mac/carbon/menuitem.cpp @@ -12,12 +12,13 @@ #include "wx/wxprec.h" #include "wx/menuitem.h" +#include "wx/stockitem.h" #ifndef WX_PRECOMP #include "wx/app.h" + #include "wx/menu.h" #endif // WX_PRECOMP -#include "wx/menu.h" #include "wx/mac/uma.h" IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject) @@ -120,7 +121,7 @@ void wxMenuItem::UpdateItemStatus() ::SetItemMark( mhandle , index , 0 ) ; // no mark UMASetMenuItemText( mhandle , index , wxStripMenuCodes(m_text) , wxFont::GetDefaultEncoding() ) ; - wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ; + wxAcceleratorEntry *entry = wxAcceleratorEntry::Create( m_text ) ; UMASetMenuItemShortcut( mhandle , index , entry ) ; delete entry ; } @@ -136,8 +137,15 @@ void wxMenuItem::UpdateItemText() if (mhandle == NULL || index == 0) return ; - UMASetMenuItemText( mhandle , index , wxStripMenuCodes(m_text) , wxFont::GetDefaultEncoding() ) ; - wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ; + wxString text = m_text; + if (text.IsEmpty() && !IsSeparator()) + { + wxASSERT_MSG(wxIsStockID(GetId()), wxT("A non-stock menu item with an empty label?")); + text = wxGetStockLabel(GetId(), wxSTOCK_WITH_ACCELERATOR|wxSTOCK_WITH_MNEMONIC); + } + + UMASetMenuItemText( mhandle , index , wxStripMenuCodes(text) , wxFont::GetDefaultEncoding() ) ; + wxAcceleratorEntry *entry = wxAcceleratorEntry::Create( text ) ; UMASetMenuItemShortcut( mhandle , index , entry ) ; delete entry ; }