-// Pullright item
-void wxMenu::Append(int Id, const wxString& label, wxMenu *SubMenu,
- const wxString& helpString)
-{
- Append(new wxMenuItem(this, Id, label, helpString, FALSE, SubMenu));
+ if ( pItem->IsSeparator() )
+ {
+ if ( pos == (size_t)-1 )
+ MacAppendMenu(MAC_WXHMENU(m_hMenu), "\p-");
+ else
+ MacInsertMenuItem(MAC_WXHMENU(m_hMenu), "\p-" , pos);
+ }
+ else
+ {
+ wxMenu *pSubMenu = pItem->GetSubMenu() ;
+ if ( pSubMenu != NULL )
+ {
+ wxASSERT_MSG( pSubMenu->m_hMenu != NULL , wxT("invalid submenu added"));
+ pSubMenu->m_menuParent = this ;
+
+ if (wxMenuBar::MacGetInstalledMenuBar() == m_menuBar)
+ {
+ pSubMenu->MacBeforeDisplay( true ) ;
+ }
+
+ if ( pos == (size_t)-1 )
+ UMAAppendSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText(), pSubMenu->m_macMenuId);
+ else
+ UMAInsertSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText() , pos, pSubMenu->m_macMenuId);
+ pItem->UpdateItemBitmap() ;
+ pItem->UpdateItemStatus() ;
+ }
+ else
+ {
+ if ( pos == (size_t)-1 )
+ {
+ UMAAppendMenuItem(MAC_WXHMENU(m_hMenu), wxT("a") );
+ pos = CountMenuItems(MAC_WXHMENU(m_hMenu)) ;
+ }
+ 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 , pItem->GetId() ) ;
+ pItem->UpdateItemText() ;
+ pItem->UpdateItemBitmap() ;
+ pItem->UpdateItemStatus() ;
+
+ if ( pItem->GetId() == idMenuTitle )
+ {
+ UMAEnableMenuItem(MAC_WXHMENU(m_hMenu) , pos , false ) ;
+ }
+ }
+ }
+ // if we're already attached to the menubar, we must update it
+ if ( IsAttached() )
+ {
+ m_menuBar->Refresh();
+ }
+ return TRUE ;