+ wxDataViewListStoreLine( wxClientData *data = NULL )
+ {
+ m_data = data;
+ }
+ virtual ~wxDataViewListStoreLine()
+ {
+ delete m_data;
+ }
+
+ void SetData( wxClientData *data )
+ { if (m_data) delete m_data; m_data = data; }
+ wxClientData *GetData() const
+ { return m_data; }
+
+ wxVector<wxVariant> m_values;
+
+private:
+ wxClientData *m_data;
+};
+
+
+class WXDLLIMPEXP_ADV wxDataViewListStore: public wxDataViewIndexListModel
+{
+public:
+ wxDataViewListStore();
+ ~wxDataViewListStore();
+
+ void PrependColumn( const wxString &varianttype );
+ void InsertColumn( unsigned int pos, const wxString &varianttype );
+ void AppendColumn( const wxString &varianttype );
+
+ void AppendItem( const wxVector<wxVariant> &values, wxClientData *data = NULL );
+ void PrependItem( const wxVector<wxVariant> &values, wxClientData *data = NULL );
+ void InsertItem( unsigned int row, const wxVector<wxVariant> &values, wxClientData *data = NULL );
+ void DeleteItem( unsigned int pos );
+ void DeleteAllItems();
+
+ // override base virtuals
+
+ virtual unsigned int GetColumnCount() const;
+
+ virtual wxString GetColumnType( unsigned int col ) const;
+
+ virtual void GetValueByRow( wxVariant &value,
+ unsigned int row, unsigned int col ) const;
+
+ virtual bool SetValueByRow( const wxVariant &value,
+ unsigned int row, unsigned int col );
+
+
+public:
+ wxVector<wxDataViewListStoreLine*> m_data;
+ wxArrayString m_cols;
+};
+
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewListCtrl: public wxDataViewCtrl
+{
+public:
+ wxDataViewListCtrl();
+ wxDataViewListCtrl( wxWindow *parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = wxDV_ROW_LINES,
+ const wxValidator& validator = wxDefaultValidator );
+ ~wxDataViewListCtrl();
+
+ bool Create( wxWindow *parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = wxDV_ROW_LINES,
+ const wxValidator& validator = wxDefaultValidator );
+
+ wxDataViewListStore *GetStore()
+ { return (wxDataViewListStore*) GetModel(); }
+ const wxDataViewListStore *GetStore() const
+ { return (const wxDataViewListStore*) GetModel(); }
+
+ int ItemToRow(const wxDataViewItem &item) const
+ { return item.IsOk() ? (int)GetStore()->GetRow(item) : wxNOT_FOUND; }
+ wxDataViewItem RowToItem(int row) const
+ { return row == wxNOT_FOUND ? wxDataViewItem() : GetStore()->GetItem(row); }
+
+ int GetSelectedRow() const
+ { return ItemToRow(GetSelection()); }
+ void SelectRow(unsigned row)
+ { Select(RowToItem(row)); }
+ void UnselectRow(unsigned row)
+ { Unselect(RowToItem(row)); }
+ bool IsRowSelected(unsigned row) const
+ { return IsSelected(RowToItem(row)); }
+
+ bool AppendColumn( wxDataViewColumn *column, const wxString &varianttype );
+ bool PrependColumn( wxDataViewColumn *column, const wxString &varianttype );
+ bool InsertColumn( unsigned int pos, wxDataViewColumn *column, const wxString &varianttype );
+
+ // overridden from base class
+ virtual bool PrependColumn( wxDataViewColumn *col );
+ virtual bool InsertColumn( unsigned int pos, wxDataViewColumn *col );
+ virtual bool AppendColumn( wxDataViewColumn *col );
+
+ wxDataViewColumn *AppendTextColumn( const wxString &label,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumn *AppendToggleColumn( const wxString &label,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
+ int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumn *AppendProgressColumn( const wxString &label,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumn *AppendIconTextColumn( const wxString &label,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE );
+
+ void AppendItem( const wxVector<wxVariant> &values, wxClientData *data = NULL )
+ { GetStore()->AppendItem( values, data ); }
+ void PrependItem( const wxVector<wxVariant> &values, wxClientData *data = NULL )
+ { GetStore()->PrependItem( values, data ); }
+ void InsertItem( unsigned int row, const wxVector<wxVariant> &values, wxClientData *data = NULL )
+ { GetStore()->InsertItem( row, values, data ); }
+ void DeleteItem( unsigned row )
+ { GetStore()->DeleteItem( row ); }
+ void DeleteAllItems()
+ { GetStore()->DeleteAllItems(); }
+
+ void SetValue( const wxVariant &value, unsigned int row, unsigned int col )
+ { GetStore()->SetValueByRow( value, row, col );
+ GetStore()->RowValueChanged( row, col); }
+ void GetValue( wxVariant &value, unsigned int row, unsigned int col )
+ { GetStore()->GetValueByRow( value, row, col ); }
+
+ void SetTextValue( const wxString &value, unsigned int row, unsigned int col )
+ { GetStore()->SetValueByRow( value, row, col );
+ GetStore()->RowValueChanged( row, col); }
+ wxString GetTextValue( unsigned int row, unsigned int col ) const
+ { wxVariant value; GetStore()->GetValueByRow( value, row, col ); return value.GetString(); }
+
+ void SetToggleValue( bool value, unsigned int row, unsigned int col )
+ { GetStore()->SetValueByRow( value, row, col );
+ GetStore()->RowValueChanged( row, col); }
+ bool GetToggleValue( unsigned int row, unsigned int col ) const
+ { wxVariant value; GetStore()->GetValueByRow( value, row, col ); return value.GetBool(); }
+
+ void OnSize( wxSizeEvent &event );