]> git.saurik.com Git - wxWidgets.git/commitdiff
Also fixed Clear() in the generic control
authorRobert Roebling <robert@roebling.de>
Thu, 18 Jun 2009 18:22:10 +0000 (18:22 +0000)
committerRobert Roebling <robert@roebling.de>
Thu, 18 Jun 2009 18:22:10 +0000 (18:22 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61120 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/datavgen.cpp

index aba7354e03c7c3996e508bc661f67b6bb1517617..9980dc7ab3a3aca8cb38dec097a9d9f4792d78c1 100644 (file)
@@ -2030,7 +2030,9 @@ bool wxDataViewMainWindow::ItemAdded(const wxDataViewItem & parent, const wxData
 {
     if (IsVirtualList())
     {
-        m_count++;
+        wxDataViewVirtualListModel *list_model =
+            (wxDataViewVirtualListModel*) GetOwner()->GetModel();
+        m_count = list_model->GetCount();
         UpdateDisplay();
         return true;
     }
@@ -2070,7 +2072,10 @@ bool wxDataViewMainWindow::ItemDeleted(const wxDataViewItem& parent,
 {
     if (IsVirtualList())
     {
-        m_count--;
+        wxDataViewVirtualListModel *list_model =
+            (wxDataViewVirtualListModel*) GetOwner()->GetModel();
+        m_count = list_model->GetCount();
+        
         if( m_currentRow > GetRowCount() )
             m_currentRow = m_count - 1;
 
@@ -2786,9 +2791,7 @@ wxDataViewItem wxDataViewMainWindow::GetItemByRow(unsigned int row) const
     {
         RowToItemJob job( row, -2 );
         Walker( m_root , job );
-        wxDataViewItem res = job.GetResult();
-//        wxPrintf( "row %d, item %d\n", row, (int) res.GetID() );
-        return res;
+        return job.GetResult();
     }
 }
 
@@ -3206,6 +3209,7 @@ int wxDataViewMainWindow::RecalculateCount()
     {
         wxDataViewVirtualListModel *list_model =
             (wxDataViewVirtualListModel*) GetOwner()->GetModel();
+            
         return list_model->GetCount();
     }
     else