Added wxDataViewListIndexModel::RowsDeleted() and various related corrections

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50764 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2007-12-17 11:28:02 +00:00
parent ea3a345f1c
commit 8b6cf9bf10
5 changed files with 130 additions and 8 deletions

View File

@@ -385,6 +385,8 @@ void wxDataViewIndexListModel::RowDeleted( unsigned int row )
{
if (m_useHash)
{
m_ordered = false;
wxDataViewItem item( m_hash[row] );
wxDataViewModel::ItemDeleted( wxDataViewItem(0), item );
m_hash.RemoveAt( row );
@@ -397,6 +399,47 @@ void wxDataViewIndexListModel::RowDeleted( unsigned int row )
}
}
static int my_sort( int *v1, int *v2 )
{
return *v2-*v1;
}
void wxDataViewIndexListModel::RowsDeleted( const wxArrayInt &rows )
{
wxArrayInt sorted = rows;
sorted.Sort( my_sort );
if (m_useHash)
{
m_ordered = false;
wxDataViewItemArray array;
unsigned int i;
for (i = 0; i < rows.GetCount(); i++)
{
wxDataViewItem item( m_hash[rows[i]] );
array.Add( item );
}
wxDataViewModel::ItemsDeleted( wxDataViewItem(0), array );
for (i = 0; i < sorted.GetCount(); i++)
m_hash.RemoveAt( sorted[i] );
}
else
{
wxDataViewItemArray array;
unsigned int i;
for (i = 0; i < sorted.GetCount(); i++)
{
wxDataViewItem item( (void*) sorted[i] );
array.Add( item );
}
wxDataViewModel::ItemsDeleted( wxDataViewItem(0), array );
m_lastIndex -= rows.GetCount();
}
}
void wxDataViewIndexListModel::RowChanged( unsigned int row )
{
wxDataViewModel::ItemChanged( GetItem(row) );