Clean up wxDataViewMainWindow::ItemDeleted() a bit.
Reuse shared code instead of duplicating it. No real changes. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68582 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2006,17 +2006,11 @@ bool wxDataViewMainWindow::ItemDeleted(const wxDataViewItem& parent,
|
||||
(wxDataViewVirtualListModel*) GetOwner()->GetModel();
|
||||
m_count = list_model->GetCount();
|
||||
|
||||
if( m_currentRow > GetRowCount() )
|
||||
m_currentRow = m_count - 1;
|
||||
|
||||
// TODO: why empty the entire selection?
|
||||
m_selection.Empty();
|
||||
|
||||
UpdateDisplay();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
else // general case
|
||||
{
|
||||
wxDataViewTreeNode * node = FindNode(parent);
|
||||
|
||||
// Notice that it is possible that the item being deleted is not in the
|
||||
@@ -2066,6 +2060,7 @@ bool wxDataViewMainWindow::ItemDeleted(const wxDataViewItem& parent,
|
||||
// Make the row number invalid and get a new valid one when user call GetRowCount
|
||||
m_count = -1;
|
||||
node->ChangeSubTreeCount(sub);
|
||||
}
|
||||
|
||||
// Change the current row to the last row if the current exceed the max row number
|
||||
if( m_currentRow > GetRowCount() )
|
||||
|
Reference in New Issue
Block a user