#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)
::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 ;
}
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 ;
}