]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/menu.cpp
Fixup Blit so it can be used with a source that is a wxBufferedDC,
[wxWidgets.git] / src / mac / carbon / menu.cpp
index 931f25c3fd544a16f00454e77c44100e048c3522..75b60c03bf83afe3592cb642db60c11129926ba5 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"
-#include "wx/menuitem.h"
-#include "wx/window.h"
-#include "wx/log.h"
-#include "wx/utils.h"
-#include "wx/frame.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+    #include "wx/app.h"
+    #include "wx/utils.h"
+    #include "wx/frame.h"
+    #include "wx/menuitem.h"
+#endif
 
 #include "wx/mac/uma.h"
 
@@ -38,8 +40,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxEvtHandler)
 // the (popup) menu title has this special id
 static const int idMenuTitle = -3;
 
-const short kwxMacMenuBarResource = 1 ;
-const short kwxMacAppleMenuId = 1 ;
+static const short kwxMacAppleMenuId = 1 ;
 
 
 // Find an item given the Macintosh Menu Reference
@@ -198,7 +199,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() ;
@@ -485,12 +486,10 @@ void wxMenu::MacAfterDisplay( bool isSubMenu )
     if ( isSubMenu )
         ::DeleteMenu(MacGetMenuId());
 
-    wxMenuItem* previousItem = NULL ;
     wxMenuItemList::compatibility_iterator node;
     wxMenuItem *item;
-    int pos ;
 
-    for (pos = 0, node = GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++)
+    for (node = GetMenuItems().GetFirst(); node; node = node->GetNext())
     {
         item = (wxMenuItem *)node->GetData();
         wxMenu* subMenu = item->GetSubMenu() ;
@@ -502,8 +501,6 @@ void wxMenu::MacAfterDisplay( bool isSubMenu )
         {
             // no need to undo hidings
         }
-
-        previousItem = item ;
     }
 }
 
@@ -660,12 +657,11 @@ void wxMenuBar::MacInstallMenuBar()
     {
         wxMenuItemList::compatibility_iterator node;
         wxMenuItem *item;
-        int pos ;
         wxMenu* menu = menuIter->GetData() , *subMenu = NULL ;
 
         if ( m_titles[i] == wxT("?") || m_titles[i] == wxT("&?")  || m_titles[i] == wxApp::s_macHelpMenuTitleName )
         {
-            for (pos = 0 , node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++)
+            for (node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext())
             {
                 item = (wxMenuItem *)node->GetData();
                 subMenu = item->GetSubMenu() ;
@@ -695,7 +691,8 @@ void wxMenuBar::MacInstallMenuBar()
                     }
                     else
                     {
-                        wxAcceleratorEntry* entry = wxGetAccelFromString( item->GetText() ) ;
+                        wxAcceleratorEntry*
+                            entry = wxAcceleratorEntry::Create( item->GetText() ) ;
 
                         if ( item->GetId() == wxApp::s_macAboutMenuItemId )
                         {
@@ -730,7 +727,8 @@ void wxMenuBar::MacInstallMenuBar()
         wxMenuItem *aboutMenuItem = FindItem(wxApp::s_macAboutMenuItemId , &aboutMenu) ;
         if ( aboutMenuItem )
         {
-            wxAcceleratorEntry* entry = wxGetAccelFromString( aboutMenuItem->GetText() ) ;
+            wxAcceleratorEntry*
+                entry = wxAcceleratorEntry::Create( aboutMenuItem->GetText() ) ;
             UMASetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , wxStripMenuCodes ( aboutMenuItem->GetText() ) , wxFont::GetDefaultEncoding() );
             UMAEnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 , true );
             SetMenuItemCommandID( GetMenuHandle( kwxMacAppleMenuId ) , 1 , kHICommandAbout ) ;