]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/menu.cpp
Avoid an assert if no alignment style is specified
[wxWidgets.git] / src / mac / carbon / menu.cpp
index b65b04b6fcf28575455dbbf628898c9d70b7f532..e59bb00f778929f145bdd9533c17d97ae8135c14 100644 (file)
@@ -1,12 +1,12 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        menu.cpp
+// Name:        src/mac/carbon/menu.cpp
 // Purpose:     wxMenu, wxMenuBar, wxMenuItem
 // Author:      Stefan Csomor
 // Modified by:
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:       wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // ============================================================================
 
 #include "wx/wxprec.h"
 
-#include "wx/app.h"
 #include "wx/menu.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+    #include "wx/app.h"
+    #include "wx/utils.h"
+    #include "wx/window.h"
+    #include "wx/frame.h"
+#endif
+
 #include "wx/menuitem.h"
-#include "wx/window.h"
 #include "wx/log.h"
-#include "wx/utils.h"
-#include "wx/frame.h"
 
 #include "wx/mac/uma.h"
 
@@ -176,9 +181,9 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
                 pSubMenu->MacBeforeDisplay( true ) ;
 
             if ( pos == (size_t)-1 )
-                UMAAppendSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText(), wxFont::GetDefaultEncoding(), pSubMenu->m_macMenuId);
+                UMAAppendSubMenuItem(MAC_WXHMENU(m_hMenu), wxStripMenuCodes(pItem->GetText()), wxFont::GetDefaultEncoding(), pSubMenu->m_macMenuId);
             else
-                UMAInsertSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText(), wxFont::GetDefaultEncoding(), pos, pSubMenu->m_macMenuId);
+                UMAInsertSubMenuItem(MAC_WXHMENU(m_hMenu), wxStripMenuCodes(pItem->GetText()), wxFont::GetDefaultEncoding(), pos, pSubMenu->m_macMenuId);
 
             pItem->UpdateItemBitmap() ;
             pItem->UpdateItemStatus() ;
@@ -198,7 +203,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
                 UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), wxT("a"), wxFont::GetDefaultEncoding(), pos);
                 pos += 1 ;
             }
-            
+
             SetMenuItemCommandID( MAC_WXHMENU(m_hMenu) , pos , wxIdToMacCommand ( pItem->GetId() ) ) ;
             SetMenuItemRefCon( MAC_WXHMENU(m_hMenu) , pos , (UInt32) pItem ) ;
             pItem->UpdateItemText() ;
@@ -705,7 +710,7 @@ void wxMenuBar::MacInstallMenuBar()
                         {
                             if ( mh )
                             {
-                                UMAAppendMenuItem(mh, item->GetText() , wxFont::GetDefaultEncoding(), entry);
+                                UMAAppendMenuItem(mh, wxStripMenuCodes(item->GetText()) , wxFont::GetDefaultEncoding(), entry);
                                 SetMenuItemCommandID( mh , CountMenuItems(mh) , wxIdToMacCommand ( item->GetId() ) ) ;
                                 SetMenuItemRefCon( mh , CountMenuItems(mh) , (UInt32)item ) ;
                             }
@@ -731,7 +736,7 @@ void wxMenuBar::MacInstallMenuBar()
         if ( aboutMenuItem )
         {
             wxAcceleratorEntry* entry = wxGetAccelFromString( aboutMenuItem->GetText() ) ;
-            UMASetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , aboutMenuItem->GetText() , wxFont::GetDefaultEncoding() );
+            UMASetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , wxStripMenuCodes ( aboutMenuItem->GetText() ) , wxFont::GetDefaultEncoding() );
             UMAEnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 , true );
             SetMenuItemCommandID( GetMenuHandle( kwxMacAppleMenuId ) , 1 , kHICommandAbout ) ;
             SetMenuItemRefCon(GetMenuHandle( kwxMacAppleMenuId ) , 1 , (UInt32)aboutMenuItem ) ;
@@ -819,7 +824,7 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
 {
     wxMenu *menuOld = wxMenuBarBase::Replace(pos, menu, title);
     if ( !menuOld )
-        return false;
+        return NULL;
 
     m_titles[pos] = title;