]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/menu.cpp
corrected warnings
[wxWidgets.git] / src / mac / carbon / menu.cpp
index 1159391d370a49db7487481e0d4fee8cc0805f56..caadf18ce3b69cddef6565e5583ba2c757fa3d97 100644 (file)
@@ -70,7 +70,6 @@ void wxMenu::Init()
        Str255  label;
        wxMenuItem::MacBuildMenuString( label, NULL , NULL , m_title , false );
        m_macMenuId = s_macNextMenuId++; 
-    wxCHECK_RET( s_macNextMenuId < 236 , "menu ids > 235 cannot be used for submenus on mac" );
        m_hMenu = ::NewMenu(m_macMenuId, label);
 
     if ( !m_hMenu )
@@ -210,10 +209,34 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
                        if ( pos == (size_t)-1 )
                        {
                                UMAAppendMenuItem(MAC_WXHMENU(m_hMenu), label,key,modifiers);
+                               if ( pItem->GetBitmap().Ok() )
+                               {
+                                       ControlButtonContentInfo info ;
+                                       wxMacCreateBitmapButton( &info , pItem->GetBitmap() , true ) ;
+                                       if ( info.contentType != kControlNoContent )
+                                       {
+                                               if ( info.contentType == kControlContentCIconHandle )
+                                                       SetMenuItemIconHandle( MAC_WXHMENU(m_hMenu) , CountMenuItems(MAC_WXHMENU(m_hMenu) ) ,
+                                                               kMenuColorIconType , (Handle) info.u.cIconHandle ) ;
+                                   }
+                                               
+                               }
                        }
                        else
                        {
                                UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), label , pos,key,modifiers);
+                               if ( pItem->GetBitmap().Ok() )
+                               {
+                                       ControlButtonContentInfo info ;
+                                       wxMacCreateBitmapButton( &info , pItem->GetBitmap() , true ) ;
+                                       if ( info.contentType != kControlNoContent )
+                                       {
+                                               if ( info.contentType == kControlContentCIconHandle )
+                                                       SetMenuItemIconHandle( MAC_WXHMENU(m_hMenu) , pos ,
+                                                               kMenuColorIconType , (Handle) info.u.cIconHandle ) ;
+                                   }
+                                               
+                               }
                        }
                        if ( pItem->GetId() == idMenuTitle ) 
                        {
@@ -577,7 +600,7 @@ wxMenuBar::~wxMenuBar()
 
 }
 
-void wxMenuBar::Refresh()
+void wxMenuBar::Refresh(bool WXUNUSED(eraseBackground), const wxRect *WXUNUSED(rect))
 {
     wxCHECK_RET( IsAttached(), wxT("can't refresh unatteched menubar") );
 
@@ -613,40 +636,38 @@ void wxMenuBar::RebuildAccelTable()
 }
 
 #endif // wxUSE_ACCEL
-#ifdef WXMAKINGDLL
-extern short gCurrentResource ;
-#endif
+
 void wxMenuBar::MacInstallMenuBar() 
 {
-       if ( s_macInstalledMenuBar == this )
-               return ;
+    if ( s_macInstalledMenuBar == this )
+        return ;
                
     wxStAppResource resload ;
                
-       Handle menubar = ::GetNewMBar( kwxMacMenuBarResource ) ;
-       wxString message ;
-       wxCHECK_RET( menubar != NULL, "can't read MBAR resource" );
-       ::SetMenuBar( menubar ) ;
+    Handle menubar = ::GetNewMBar( kwxMacMenuBarResource ) ;
+    wxString message ;
+    wxCHECK_RET( menubar != NULL, "can't read MBAR resource" );
+    ::SetMenuBar( menubar ) ;
 #if TARGET_API_MAC_CARBON
     ::DisposeMenuBar( menubar ) ;
 #else
-       ::DisposeHandle( menubar ) ;
+    ::DisposeHandle( menubar ) ;
 #endif
 
-               MenuHandle menu = ::GetMenuHandle( kwxMacAppleMenuId ) ;
 #if TARGET_API_MAC_OS8
+    MenuHandle menu = ::GetMenuHandle( kwxMacAppleMenuId ) ;
     if ( CountMenuItems( menu ) == 2 )
     {
-                 ::AppendResMenu(menu, 'DRVR');
-               }
+        ::AppendResMenu(menu, 'DRVR');
+    }
 #endif
  
-       for (int i = 0; i < m_menus.GetCount(); i++)
+       for (size_t i = 0; i < m_menus.GetCount(); i++)
        {
-                       Str255  label;
-       wxNode *node;
-       wxMenuItem *item;
-       int pos ;
+            Str255     label;
+            wxNode *node;
+            wxMenuItem *item;
+            int pos ;
                        wxMenu* menu = m_menus[i] , *subMenu = NULL ;
                
                        if( m_titles[i] == "?" || m_titles[i] == "&?"  || m_titles[i] == wxApp::s_macHelpMenuTitleName )
@@ -719,7 +740,7 @@ void wxMenuBar::MacInstallMenuBar()
                                        }
                                }
                                ::InsertMenu(MAC_WXHMENU(m_menus[i]->GetHMenu()), 0);
-                               for ( int i = 0 ; i < submenus.GetCount() ; ++i )
+                               for ( size_t i = 0 ; i < submenus.GetCount() ; ++i )
                                {
                                  wxMenu* submenu = (wxMenu*) submenus[i] ;
                wxNode *subnode;
@@ -893,7 +914,7 @@ void wxMenuBar::MacMenuSelect(wxEvtHandler* handler, long when , int macMenuId,
     }
     else
     {          
-        for (int i = 0; i < m_menus.GetCount() ; i++)
+        for (size_t i = 0; i < m_menus.GetCount() ; i++)
         {
             if ( m_menus[i]->MacGetMenuId() == macMenuId || ( macMenuId == kHMHelpMenuID && ( m_titles[i] == "?" || m_titles[i] == "&?"  || m_titles[i] == wxApp::s_macHelpMenuTitleName ) ) )
             {
@@ -907,7 +928,7 @@ void wxMenuBar::MacMenuSelect(wxEvtHandler* handler, long when , int macMenuId,
             }
         }
        
-         for (int i = 0; i < m_menus.GetCount(); i++)
+         for (size_t i = 0; i < m_menus.GetCount(); i++)
          {
                if ( m_menus[i]->MacMenuSelect( handler , when , macMenuId , macMenuItemNum ) )
                {