+//-----------------------------------------------------------------------------
+// wxDataViewListStore
+//-----------------------------------------------------------------------------
+
+wxDataViewListStore::wxDataViewListStore()
+{
+}
+
+wxDataViewListStore::~wxDataViewListStore()
+{
+ wxVector<wxDataViewListStoreLine*>::iterator it;
+ for (it = m_data.begin(); it != m_data.end(); ++it)
+ {
+ wxDataViewListStoreLine* line = *it;
+ delete line;
+ }
+}
+
+void wxDataViewListStore::PrependColumn( const wxString &varianttype )
+{
+ m_cols.Insert( varianttype, 0 );
+}
+
+void wxDataViewListStore::InsertColumn( unsigned int pos, const wxString &varianttype )
+{
+ m_cols.Insert( varianttype, pos );
+}
+
+void wxDataViewListStore::AppendColumn( const wxString &varianttype )
+{
+ m_cols.Add( varianttype );
+}
+
+unsigned int wxDataViewListStore::GetColumnCount() const
+{
+ return m_cols.GetCount();
+}
+
+wxString wxDataViewListStore::GetColumnType( unsigned int pos ) const
+{
+ return m_cols[pos];
+}
+
+void wxDataViewListStore::AppendItem( const wxVector<wxVariant> &values, wxClientData *data )
+{
+ wxDataViewListStoreLine *line = new wxDataViewListStoreLine( data );
+ line->m_values = values;
+ m_data.push_back( line );
+
+ RowAppended();
+}
+
+void wxDataViewListStore::PrependItem( const wxVector<wxVariant> &values, wxClientData *data )
+{
+ wxDataViewListStoreLine *line = new wxDataViewListStoreLine( data );
+ line->m_values = values;
+ m_data.insert( m_data.begin(), line );
+
+ RowPrepended();
+}
+
+void wxDataViewListStore::InsertItem( unsigned int row, const wxVector<wxVariant> &values,
+ wxClientData *data )
+{
+ wxDataViewListStoreLine *line = new wxDataViewListStoreLine( data );
+ line->m_values = values;
+ m_data.insert( m_data.begin()+row, line );
+
+ RowInserted( row );
+}
+
+void wxDataViewListStore::DeleteItem( unsigned int row )
+{
+ wxVector<wxDataViewListStoreLine*>::iterator it = m_data.begin() + row;
+ delete *it;
+ m_data.erase( it );
+
+ RowDeleted( row );
+}
+
+void wxDataViewListStore::DeleteAllItems()
+{
+ wxVector<wxDataViewListStoreLine*>::iterator it;
+ for (it = m_data.begin(); it != m_data.end(); ++it)
+ {
+ wxDataViewListStoreLine* line = *it;
+ delete line;
+ }
+
+ m_data.clear();
+
+ Reset( 0 );
+}
+
+void wxDataViewListStore::GetValueByRow( wxVariant &value, unsigned int row, unsigned int col ) const
+{
+ wxDataViewListStoreLine *line = m_data[row];
+ value = line->m_values[col];
+}
+
+bool wxDataViewListStore::SetValueByRow( const wxVariant &value, unsigned int row, unsigned int col )
+{
+ wxDataViewListStoreLine *line = m_data[row];
+ line->m_values[col] = value;
+
+ return true;
+}
+
+//-----------------------------------------------------------------------------
+// wxDataViewListCtrl
+//-----------------------------------------------------------------------------
+
+IMPLEMENT_DYNAMIC_CLASS(wxDataViewListCtrl,wxDataViewCtrl)
+
+BEGIN_EVENT_TABLE(wxDataViewListCtrl,wxDataViewCtrl)
+ EVT_SIZE( wxDataViewListCtrl::OnSize )
+END_EVENT_TABLE()
+
+wxDataViewListCtrl::wxDataViewListCtrl()
+{
+}
+
+wxDataViewListCtrl::wxDataViewListCtrl( wxWindow *parent, wxWindowID id,
+ const wxPoint& pos, const wxSize& size, long style,
+ const wxValidator& validator )
+{
+ Create( parent, id, pos, size, style, validator );
+
+ wxDataViewListStore *store = new wxDataViewListStore;
+ AssociateModel( store );
+ store->DecRef();
+}
+
+wxDataViewListCtrl::~wxDataViewListCtrl()
+{
+}
+
+
+bool wxDataViewListCtrl::Create( wxWindow *parent, wxWindowID id,
+ const wxPoint& pos, const wxSize& size, long style,
+ const wxValidator& validator )
+{
+ return wxDataViewCtrl::Create( parent, id, pos, size, style, validator );
+}
+
+bool wxDataViewListCtrl::AppendColumn( wxDataViewColumn *column, const wxString &varianttype )
+{
+ GetStore()->AppendColumn( varianttype );
+ return wxDataViewCtrl::AppendColumn( column );
+}
+
+bool wxDataViewListCtrl::PrependColumn( wxDataViewColumn *column, const wxString &varianttype )
+{
+ GetStore()->PrependColumn( varianttype );
+ return wxDataViewCtrl::PrependColumn( column );
+}
+
+bool wxDataViewListCtrl::InsertColumn( unsigned int pos, wxDataViewColumn *column, const wxString &varianttype )
+{
+ GetStore()->InsertColumn( pos, varianttype );
+ return wxDataViewCtrl::InsertColumn( pos, column );
+}
+
+bool wxDataViewListCtrl::PrependColumn( wxDataViewColumn *col )
+{
+ return PrependColumn( col, "string" );
+}
+
+bool wxDataViewListCtrl::InsertColumn( unsigned int pos, wxDataViewColumn *col )
+{
+ return InsertColumn( pos, col, "string" );
+}
+
+bool wxDataViewListCtrl::AppendColumn( wxDataViewColumn *col )
+{
+ return AppendColumn( col, "string" );
+}
+
+wxDataViewColumn *wxDataViewListCtrl::AppendTextColumn( const wxString &label,
+ wxDataViewCellMode mode, int width, wxAlignment align, int flags )
+{
+ GetStore()->AppendColumn( wxT("string") );
+
+ wxDataViewColumn *ret = new wxDataViewColumn( label,
+ new wxDataViewTextRenderer( wxT("string"), mode ),
+ GetStore()->GetColumnCount()-1, width, align, flags );
+
+ wxDataViewCtrl::AppendColumn( ret );
+
+ return ret;
+}
+
+wxDataViewColumn *wxDataViewListCtrl::AppendToggleColumn( const wxString &label,
+ wxDataViewCellMode mode, int width, wxAlignment align, int flags )
+{
+ GetStore()->AppendColumn( wxT("bool") );
+
+ wxDataViewColumn *ret = new wxDataViewColumn( label,
+ new wxDataViewToggleRenderer( wxT("bool"), mode ),
+ GetStore()->GetColumnCount()-1, width, align, flags );
+
+ wxDataViewCtrl::AppendColumn( ret );
+
+ return ret;
+}
+
+wxDataViewColumn *wxDataViewListCtrl::AppendProgressColumn( const wxString &label,
+ wxDataViewCellMode mode, int width, wxAlignment align, int flags )
+{
+ GetStore()->AppendColumn( wxT("long") );
+
+ wxDataViewColumn *ret = new wxDataViewColumn( label,
+ new wxDataViewProgressRenderer( wxEmptyString, wxT("long"), mode ),
+ GetStore()->GetColumnCount()-1, width, align, flags );
+
+ wxDataViewCtrl::AppendColumn( ret );
+
+ return ret;
+}
+
+wxDataViewColumn *wxDataViewListCtrl::AppendIconTextColumn( const wxString &label,
+ wxDataViewCellMode mode, int width, wxAlignment align, int flags )
+{
+ GetStore()->AppendColumn( wxT("wxDataViewIconText") );
+
+ wxDataViewColumn *ret = new wxDataViewColumn( label,
+ new wxDataViewIconTextRenderer( wxT("wxDataViewIconText"), mode ),
+ GetStore()->GetColumnCount()-1, width, align, flags );
+
+ wxDataViewCtrl::AppendColumn( ret );
+
+ return ret;
+}
+
+void wxDataViewListCtrl::OnSize( wxSizeEvent &event )
+{
+ event.Skip( true );
+}
+