]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/toolbar.cpp
bitmap button size was too small when uxtheme functions were used to get the margins
[wxWidgets.git] / src / mac / carbon / toolbar.cpp
index f8fb57ce62501c18cb61c66654f4b3846d6d7b92..b4702c6dafb929bed83eaafd37a7fa80a9375b3f 100644 (file)
 
 #if wxUSE_TOOLBAR
 
-#include "wx/wx.h"
-#include "wx/bitmap.h"
 #include "wx/toolbar.h"
 
+#ifndef WX_PRECOMP
+    #include "wx/wx.h"
+#endif
+
 #include "wx/mac/uma.h"
 #include "wx/geometry.h"
 
@@ -80,8 +82,6 @@ public:
     ~wxToolBarTool()
     {
         ClearControl();
-        if ( m_controlHandle )
-            DisposeControl( m_controlHandle );
 
 #if wxMAC_USE_NATIVE_TOOLBAR
         if ( m_toolbarItemRef )
@@ -104,6 +104,11 @@ public:
     void ClearControl()
     {
         m_control = NULL;
+        if ( m_controlHandle )
+        {
+            DisposeControl( m_controlHandle );
+            m_controlHandle = NULL ;
+        }
 
 #if wxMAC_USE_NATIVE_TOOLBAR
         m_toolbarItemRef = NULL;
@@ -904,7 +909,7 @@ bool wxToolBar::Realize()
                         if (err != noErr)
                         {
                             wxString errMsg = wxString::Format( wxT("HIToolbarRemoveItemAtIndex failed [%ld]"), (long)err );
-                            wxASSERT_MSG( 0, errMsg.c_str() );
+                            wxFAIL_MSG( errMsg.c_str() );
                         }
                     }
 
@@ -912,7 +917,7 @@ bool wxToolBar::Realize()
                     if (err != noErr)
                     {
                         wxString errMsg = wxString::Format( wxT("HIToolbarInsertItemAtIndex failed [%ld]"), (long)err );
-                        wxASSERT_MSG( 0, errMsg.c_str() );
+                        wxFAIL_MSG( errMsg.c_str() );
                     }
 
                     tool->SetIndex( currentPosition );
@@ -1262,7 +1267,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase)
     else
     {
         wxString errMsg = wxString::Format( wxT("wxToolBar::DoInsertTool - failure [%ld]"), (long)err );
-        wxASSERT_MSG( false, errMsg.c_str() );
+        wxFAIL_MSG( errMsg.c_str() );
     }
 
     return (err == noErr);
@@ -1310,8 +1315,6 @@ bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolbase)
         case wxTOOL_STYLE_SEPARATOR:
             if ( tool->GetControlHandle() )
             {
-                DisposeControl( (ControlRef) tool->GetControlHandle() );
-
 #if wxMAC_USE_NATIVE_TOOLBAR
                 if ( removeIndex != -1 && m_macHIToolbarRef )
                 {