Also fixed Clear() in the generic control

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61120 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 2009-06-18 18:22:10 +00:00
parent 5366ff46b8
commit 49d2b75d53

View File

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