]> git.saurik.com Git - wxWidgets.git/commitdiff
Allow wxPGProperty::IsChildSelected() to work recursively
authorJaakko Salli <jaakko.salli@dnainternet.net>
Fri, 20 May 2011 14:26:17 +0000 (14:26 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Fri, 20 May 2011 14:26:17 +0000 (14:26 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67768 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/propgrid/property.h
src/propgrid/property.cpp
src/propgrid/propgrid.cpp

index 101cb91e6025ae132b7f2d75ccb81761678adc07..cc5e30fe14089a860104379420c39abffb392df3 100644 (file)
@@ -2390,7 +2390,7 @@ protected:
     /**
         Returns true if child property is selected.
     */
-    bool IsChildSelected() const;
+    bool IsChildSelected( bool recursive = false ) const;
 
     // Removes child property with given pointer. Does not delete it.
     void RemoveChild( wxPGProperty* p );
index 3ec89352ebdd7b2b9539c7fad7cf718e407ff179..d0f4aa31fecfb4051900b74a7aac3616b0911b75 100644 (file)
@@ -2569,12 +2569,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;
     }
 
index 71a918aef1740d0ddac18ff50a7c9f967a3bc4d3..5af8805a19e74fb1fd874ec80a12c311c25f15da 100644 (file)
@@ -2600,7 +2600,7 @@ void wxPropertyGrid::DrawItems( const wxPGProperty* p1, const wxPGProperty* p2 )
 
 void wxPropertyGrid::RefreshProperty( wxPGProperty* p )
 {
-    if ( m_pState->DoIsPropertySelected(p) || p->IsChildSelected() )
+    if ( m_pState->DoIsPropertySelected(p) || p->IsChildSelected(true) )
     {
         // NB: We must copy the selection.
         wxArrayPGProperty selection = m_pState->m_selection;