+// ---------------------------------------------------------
+// wxDataViewVirtualListModel
+// ---------------------------------------------------------
+
+#ifndef __WXMAC__
+
+wxDataViewVirtualListModel::wxDataViewVirtualListModel( unsigned int initial_size )
+{
+ m_lastIndex = initial_size-1;
+}
+
+wxDataViewVirtualListModel::~wxDataViewVirtualListModel()
+{
+}
+
+void wxDataViewVirtualListModel::Reset( unsigned int new_size )
+{
+ m_lastIndex = new_size-1;
+
+ wxDataViewModel::Cleared();
+}
+
+void wxDataViewVirtualListModel::RowPrepended()
+{
+ m_lastIndex++;
+ wxDataViewItem item( NULL );
+ ItemAdded( wxDataViewItem(0), item );
+}
+
+void wxDataViewVirtualListModel::RowInserted( unsigned int before )
+{
+ m_lastIndex++;
+ wxDataViewItem item( wxUIntToPtr(before) );
+ ItemAdded( wxDataViewItem(0), item );
+}
+
+void wxDataViewVirtualListModel::RowAppended()
+{
+ m_lastIndex++;
+ wxDataViewItem item( wxUIntToPtr(m_lastIndex) );
+ ItemAdded( wxDataViewItem(0), item );
+}
+
+void wxDataViewVirtualListModel::RowDeleted( unsigned int row )
+{
+ wxDataViewItem item( wxUIntToPtr(row) );
+ wxDataViewModel::ItemDeleted( wxDataViewItem(0), item );
+ m_lastIndex++;
+}
+
+void wxDataViewVirtualListModel::RowsDeleted( const wxArrayInt &rows )
+{
+ wxArrayInt sorted = rows;
+ sorted.Sort( my_sort );
+
+ wxDataViewItemArray array;
+ unsigned int i;
+ for (i = 0; i < sorted.GetCount(); i++)
+ {
+ wxDataViewItem item( wxUIntToPtr(sorted[i]) );
+ array.Add( item );
+ }
+ wxDataViewModel::ItemsDeleted( wxDataViewItem(0), array );
+
+ m_lastIndex -= rows.GetCount();
+}
+
+void wxDataViewVirtualListModel::RowChanged( unsigned int row )
+{
+ wxDataViewModel::ItemChanged( GetItem(row) );
+}
+
+void wxDataViewVirtualListModel::RowValueChanged( unsigned int row, unsigned int col )
+{
+ wxDataViewModel::ValueChanged( GetItem(row), col );
+}
+
+unsigned int wxDataViewVirtualListModel::GetRow( const wxDataViewItem &item ) const
+{
+ return wxPtrToUInt( item.GetID() );
+}
+
+wxDataViewItem wxDataViewVirtualListModel::GetItem( unsigned int row ) const
+{
+ return wxDataViewItem( wxUIntToPtr(row) );
+}
+
+bool wxDataViewVirtualListModel::HasDefaultCompare() const
+{
+ return true;
+}
+
+int wxDataViewVirtualListModel::Compare(const wxDataViewItem& item1,
+ const wxDataViewItem& item2,
+ unsigned int WXUNUSED(column),
+ bool ascending)
+{
+ unsigned int pos1 = wxPtrToUInt(item1.GetID());
+ unsigned int pos2 = wxPtrToUInt(item2.GetID());
+
+ if (ascending)
+ return pos1 - pos2;
+ else
+ return pos2 - pos1;
+}
+
+void wxDataViewVirtualListModel::GetValue( wxVariant &variant,
+ const wxDataViewItem &item, unsigned int col ) const
+{
+ GetValue( variant, GetRow(item), col );
+}
+
+bool wxDataViewVirtualListModel::SetValue( const wxVariant &variant,
+ const wxDataViewItem &item, unsigned int col )
+{
+ return SetValue( variant, GetRow(item), col );
+}
+
+bool wxDataViewVirtualListModel::GetAttr( const wxDataViewItem &item, unsigned int col, wxDataViewItemAttr &attr )
+{
+ return GetAttr( GetRow(item), col, attr );
+}
+
+wxDataViewItem wxDataViewVirtualListModel::GetParent( const wxDataViewItem & WXUNUSED(item) ) const
+{
+ return wxDataViewItem(0);
+}
+
+bool wxDataViewVirtualListModel::IsContainer( const wxDataViewItem &item ) const
+{
+ // only the invisible root item has children
+ if (!item.IsOk())
+ return true;
+
+ return false;
+}
+
+unsigned int wxDataViewVirtualListModel::GetChildren( const wxDataViewItem &WXUNUSED(item), wxDataViewItemArray &WXUNUSED(children) ) const
+{
+ return 0; // should we report an error ?
+}
+
+#endif // __WXMAC__
+