X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3b3dc8019a520ce5e166c8ae9098ba020f8b3f94..eba91e51e8d7cce2c5c9a99d8ddcad5b29a114a8:/src/mac/classic/menuitem.cpp diff --git a/src/mac/classic/menuitem.cpp b/src/mac/classic/menuitem.cpp index 615f4c0c29..51a8a3ca5a 100644 --- a/src/mac/classic/menuitem.cpp +++ b/src/mac/classic/menuitem.cpp @@ -16,6 +16,7 @@ #include "wx/wxprec.h" #include "wx/menuitem.h" +#include "wx/stockitem.h" #ifndef WX_PRECOMP #include "wx/app.h" @@ -134,7 +135,7 @@ void wxMenuItem::UpdateItemStatus() ::SetItemMark( mhandle , index , 0 ) ; // no mark UMASetMenuItemText( mhandle , index , m_text , wxFont::GetDefaultEncoding() ) ; - wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ; + wxAcceleratorEntry *entry = wxAcceleratorEntry::Create( m_text ) ; UMASetMenuItemShortcut( mhandle , index , entry ) ; delete entry ; } @@ -150,8 +151,15 @@ void wxMenuItem::UpdateItemText() if( mhandle == NULL || index == 0) return ; - UMASetMenuItemText( mhandle , index , 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 , text , wxFont::GetDefaultEncoding() ) ; + wxAcceleratorEntry *entry = wxAcceleratorEntry::Create( text ) ; UMASetMenuItemShortcut( mhandle , index , entry ) ; delete entry ; }