]> git.saurik.com Git - wxWidgets.git/blobdiff - src/propgrid/property.cpp
Set event object correctly for the generated wxSizeEvents.
[wxWidgets.git] / src / propgrid / property.cpp
index 4a90d9ab3b4e6e05627a65b0dd0cdb3906646c65..f878d4ddda066e5c3895b3e8afd8a518e3734bdd 100644 (file)
@@ -35,6 +35,8 @@
     #include "wx/intl.h"
 #endif
 
+#include "wx/image.h"
+
 #include "wx/propgrid/propgrid.h"
 
 
@@ -2097,19 +2099,23 @@ void wxPGProperty::SetValueImage( wxBitmap& bmp )
 
         if ( imSz.y != maxSz.y )
         {
-            // Create a memory DC
+        #if wxUSE_IMAGE
+            // Here we use high-quality wxImage scaling functions available
+            wxImage img = bmp.ConvertToImage();
+            double scaleY = (double)maxSz.y / (double)imSz.y;
+            img.Rescale(((double)bmp.GetWidth())*scaleY,
+                        ((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);
-
-            // Scale
-            // FIXME: This is ugly - use image or wait for scaling patch.
             double scaleY = (double)maxSz.y / (double)imSz.y;
-
             dc.SetUserScale(scaleY, scaleY);
-
             dc.DrawBitmap(bmp, 0, 0);
+        #endif
 
             m_valueBitmap = bmpNew;
         }
@@ -2326,9 +2332,9 @@ void wxPGProperty::AdaptListToValue( wxVariant& list, wxVariant* value ) const
     else
         allChildrenSpecified = true;
 
-    wxVariant childValue = list[0];
     unsigned int i;
     unsigned int n = 0;
+    wxVariant childValue = list[n];
 
     //wxLogDebug(wxT(">> %s.AdaptListToValue()"),GetBaseName().c_str());