X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/58751a8685259e02cb71d193654e2afa1112fda1..16fd964239d70597b0c072d4f3909b3e93460423:/src/mac/menu.cpp diff --git a/src/mac/menu.cpp b/src/mac/menu.cpp index bffd5b416d..83d1d2420a 100644 --- a/src/mac/menu.cpp +++ b/src/mac/menu.cpp @@ -145,10 +145,14 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) } else { + // MacOS counts menu items from 1 and inserts after, therefore having the + // same effect as wx 0 based and inserting before, we must correct pos + // after however for updates to be correct UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), wxT("a") , pos); + pos += 1 ; } - SetMenuItemCommandID( MAC_WXHMENU(m_hMenu) , pos+1 , pItem->GetId() ) ; + SetMenuItemCommandID( MAC_WXHMENU(m_hMenu) , pos , pItem->GetId() ) ; pItem->UpdateItemText() ; pItem->UpdateItemBitmap() ; pItem->UpdateItemStatus() ; @@ -445,6 +449,7 @@ auto-merge for MDI in case this will be necessary */ wxMenuBar* wxMenuBar::s_macInstalledMenuBar = NULL ; +wxMenuBar* wxMenuBar::s_macCommonMenuBar = NULL ; void wxMenuBar::Init() { @@ -481,6 +486,8 @@ wxMenuBar::wxMenuBar(int count, wxMenu *menus[], const wxString titles[]) wxMenuBar::~wxMenuBar() { + if (s_macCommonMenuBar == this) + s_macCommonMenuBar = NULL; if (s_macInstalledMenuBar == this) { ::ClearMenuBar(); @@ -748,7 +755,7 @@ wxMenu *wxMenuBar::Remove(size_t pos) Refresh(); } - m_titles.Remove(pos); + m_titles.RemoveAt(pos); return menu; }