]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/bmpbuttn.cpp
Query value from the model column given by col->GetModelColumn()
[wxWidgets.git] / src / mac / carbon / bmpbuttn.cpp
index 2c688e59e417beb2971db701965095f5b9d00937..5757f50b845b2d53d27771ddaa4418e4039af97d 100644 (file)
@@ -14,6 +14,7 @@
 #if wxUSE_BMPBUTTON
 
 #include "wx/bmpbuttn.h"
+#include "wx/image.h"
 
 #ifndef WX_PRECOMP
     #include "wx/dcmemory.h"
@@ -63,14 +64,12 @@ static wxBitmap wxMakeStdSizeBitmap(const wxBitmap& bitmap)
             wxASSERT_MSG( width <= sizeStd && height <= sizeStd,
                           _T("bitmap shouldn't be cropped") );
 
-            newBmp.Create(sizeStd, sizeStd);
-            wxMemoryDC dcMem;
-            dcMem.SelectObject(newBmp);
-            dcMem.Clear();
-
-            dcMem.DrawBitmap(bitmap,
-                             (sizeStd - width)/2, (sizeStd-height)/2,
-                             true);
+            wxImage square_image = bitmap.ConvertToImage();
+            newBmp = square_image.Size
+                     (
+                         wxSize(sizeStd, sizeStd),
+                         wxPoint((sizeStd - width)/2, (sizeStd-height)/2)
+                     );
         }
     }
     //else: let the system rescale the bitmap
@@ -118,7 +117,6 @@ bool wxBitmapButton::Create( wxWindow *parent,
         m_bmpNormal = bitmap;
 
 
-#ifdef __WXMAC_OSX__
     if ( HasFlag( wxBORDER_NONE ) )
     {
                // contrary to the docs this control only works with iconrefs
@@ -128,7 +126,6 @@ bool wxBitmapButton::Create( wxWindow *parent,
                 &bounds, &info, false, m_peer->GetControlRefAddr() );
     }
     else
-#endif
     {
         wxMacCreateBitmapButton( &info, m_bmpNormal );
         err = CreateBevelButtonControl(
@@ -158,7 +155,6 @@ void wxBitmapButton::SetBitmapLabel( const wxBitmap& bitmap )
 
     ControlButtonContentInfo info;
 
-#ifdef __WXMAC_OSX__
     if ( HasFlag( wxBORDER_NONE ) )
     {        
         wxMacCreateBitmapButton( &info, m_bmpNormal, kControlContentIconRef );
@@ -166,7 +162,6 @@ void wxBitmapButton::SetBitmapLabel( const wxBitmap& bitmap )
             m_peer->SetData( kControlIconPart, kControlIconContentTag, info );
     }
     else
-#endif
     {
         wxMacCreateBitmapButton( &info, m_bmpNormal );
         if ( info.contentType != kControlNoContent )