]> git.saurik.com Git - wxWidgets.git/blobdiff - src/propgrid/property.cpp
Make wxSpinCtrlGeneric usable as wxDVC editor control.
[wxWidgets.git] / src / propgrid / property.cpp
index 0d0826386eca91a0fac09c4198ccde26916d9532..fa81f9e898478167938b47cf38e7a4084e5664f2 100644 (file)
@@ -35,6 +35,8 @@
     #include "wx/intl.h"
 #endif
 
+#include "wx/image.h"
+
 #include "wx/propgrid/propgrid.h"
 
 
@@ -274,7 +276,7 @@ bool wxPGDefaultRenderer::Render( wxDC& dc, const wxRect& rect,
                     propertyGrid->GetCellDisabledTextColour();
                 dc.SetTextForeground(hCol);
 
-                // Must make the editor NULL to override it's own rendering
+                // Must make the editor NULL to override its own rendering
                 // code.
                 editor = NULL;
             }
@@ -2097,6 +2099,7 @@ void wxPGProperty::SetValueImage( wxBitmap& bmp )
 
         if ( imSz.y != maxSz.y )
         {
+        #if wxUSE_IMAGE
             // Here we use high-quality wxImage scaling functions available
             wxImage img = bmp.ConvertToImage();
             double scaleY = (double)maxSz.y / (double)imSz.y;
@@ -2104,6 +2107,15 @@ void wxPGProperty::SetValueImage( wxBitmap& bmp )
                         ((double)bmp.GetHeight())*scaleY,
                         wxIMAGE_QUALITY_HIGH);
             wxBitmap* bmpNew = new wxBitmap(img, 32);
+        #else
+            // This is the old, deprecated method of scaling the image
+            wxBitmap* bmpNew = new wxBitmap(maxSz.x,maxSz.y,bmp.GetDepth());
+            wxMemoryDC dc;
+            dc.SelectObject(*bmpNew);
+            double scaleY = (double)maxSz.y / (double)imSz.y;
+            dc.SetUserScale(scaleY, scaleY);
+            dc.DrawBitmap(bmp, 0, 0);
+        #endif
 
             m_valueBitmap = bmpNew;
         }