]> git.saurik.com Git - wxWidgets.git/commitdiff
Clear grid selection more consistently prior clear operations; improved Clear() tests...
authorJaakko Salli <jaakko.salli@dnainternet.net>
Tue, 17 Feb 2009 18:01:06 +0000 (18:01 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Tue, 17 Feb 2009 18:01:06 +0000 (18:01 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58971 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/propgrid/tests.cpp
src/propgrid/manager.cpp
src/propgrid/propgrid.cpp
src/propgrid/propgridpagestate.cpp

index 7a8cc656f34b0b8d32e608d013f229972d07ac48..d12a7bb22acc49e3c6535c9f5ab3d44c84fef6f0 100644 (file)
@@ -1005,12 +1005,29 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
     }
 
     {
-        RT_START_TEST(ManagerClear)
+        RT_START_TEST(Clear)
+
+        // Manager clear
+        pgman->SelectProperty("Label");
         pgman->Clear();
 
         if ( pgman->GetPageCount() )
             RT_FAILURE();
 
+        if ( pgman->GetGrid()->GetRoot()->GetChildCount() )
+            RT_FAILURE();
+
+        // Recreate the original grid
+        CreateGrid( -1, -1 );
+        pgman = m_pPropGridManager;
+
+        // Grid clear
+        pgman->SelectProperty("Label");
+        pgman->GetGrid()->Clear();
+
+        if ( pgman->GetGrid()->GetRoot()->GetChildCount() )
+            RT_FAILURE();
+
         // Recreate the original grid
         CreateGrid( -1, -1 );
         pgman = m_pPropGridManager;
index f4052c044f1d7042253e3e174a507c3ad6e4d7b3..096228ac5481a64c1e9fe29d7062bcc79040f45c 100644 (file)
@@ -657,6 +657,8 @@ wxPropertyGridPageState* wxPropertyGridManager::GetPageState( int page ) const
 
 void wxPropertyGridManager::Clear()
 {
+    m_pPropGrid->ClearSelection(false);
+
     m_pPropGrid->Freeze();
 
     int i;
index 8a3606fda4460821791e88f0b6bfe01f9c2be30e..dde158f95b99ae12ff64f41b8d24440013f588de 100644 (file)
@@ -2114,8 +2114,6 @@ void wxPropertyGrid::Refresh( bool WXUNUSED(eraseBackground),
 
 void wxPropertyGrid::Clear()
 {
-    ClearSelection(false);
-
     m_pState->DoClear();
 
     m_propHover = NULL;
index ed24230a420326a44af619ae57c970f81e885396..a0aeef77886171bd0ae252ae53e47d19de825566 100644 (file)
@@ -268,6 +268,15 @@ void wxPropertyGridPageState::InitNonCatMode()
 
 void wxPropertyGridPageState::DoClear()
 {
+    if ( m_pPropGrid->GetState() == this  )
+    {
+        m_pPropGrid->ClearSelection(false);
+    }
+    else
+    {
+        m_selected = NULL;
+    }
+
     m_regularArray.Empty();
     if ( m_abcArray )
         m_abcArray->Empty();
@@ -280,8 +289,6 @@ void wxPropertyGridPageState::DoClear()
 
     m_virtualHeight = 0;
     m_vhCalcPending = 0;
-
-    m_selected = NULL;
 }
 
 // -----------------------------------------------------------------------