]> git.saurik.com Git - wxWidgets.git/blobdiff - src/propgrid/property.cpp
Add new sample project files.
[wxWidgets.git] / src / propgrid / property.cpp
index 3ec89352ebdd7b2b9539c7fad7cf718e407ff179..1e4f0cdfacf536eaa6c2a6f4beb564535189abce 100644 (file)
@@ -24,6 +24,7 @@
     #include "wx/hash.h"
     #include "wx/string.h"
     #include "wx/log.h"
+    #include "wx/math.h"
     #include "wx/event.h"
     #include "wx/window.h"
     #include "wx/panel.h"
@@ -2103,8 +2104,8 @@ void wxPGProperty::SetValueImage( wxBitmap& bmp )
             // 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,
+            img.Rescale(wxRound(bmp.GetWidth()*scaleY),
+                        wxRound(bmp.GetHeight()*scaleY),
                         wxIMAGE_QUALITY_HIGH);
             wxBitmap* bmpNew = new wxBitmap(img, 32);
         #else
@@ -2569,12 +2570,19 @@ void wxPGProperty::DeleteChildren()
     }
 }
 
-bool wxPGProperty::IsChildSelected() const
+bool wxPGProperty::IsChildSelected( bool recursive ) const
 {
     size_t i;
     for ( i = 0; i < GetChildCount(); i++ )
     {
-        if ( m_parentState->DoIsPropertySelected( Item(i) ) )
+        wxPGProperty* child = Item(i);
+
+        // Test child
+        if ( m_parentState->DoIsPropertySelected( child ) )
+            return true;
+
+        // Test sub-childs
+        if ( recursive && child->IsChildSelected( recursive ) )
             return true;
     }