+
+ wxPanel *panel = new wxPanel( this, wxID_ANY );
+
+
+ // Left wxDataViewCtrl
+ dataview_left = new wxDataViewCtrl( panel, wxID_ANY );
+
+ MyTextModel *model = new MyTextModel;
+ dataview_left->AssociateModel( model );
+
+ dataview_left->AppendTextColumn( wxT("first"), 0 );
+ dataview_left->AppendTextColumn( wxT("second"), 1 );
+
+ wxDataViewTextRenderer *text_renderer = new wxDataViewTextRenderer( wxT("string"), wxDATAVIEW_CELL_EDITABLE );
+ wxDataViewColumn *column = new wxDataViewColumn( wxT("editable"), text_renderer, 2 );
+ dataview_left->AppendColumn( column );
+
+ dataview_left->AppendToggleColumn( wxT("fourth"), 3 );
+
+ MyCustomRenderer *custom_renderer = new MyCustomRenderer;
+ column = new wxDataViewColumn( wxT("custom"), custom_renderer, 4 );
+ dataview_left->AppendColumn( column );
+
+ dataview_left->AppendProgressColumn( wxT("progress"), 5 );
+
+ dataview_left->AppendDateColumn( wxT("date"), 6 );
+
+ // Right wxDataViewCtrl using the same model
+ dataview_right = new wxDataViewCtrl( panel, wxID_ANY );
+ dataview_right->AssociateModel( model );
+
+ text_renderer = new wxDataViewTextRenderer( wxT("string"), wxDATAVIEW_CELL_EDITABLE );
+ column = new wxDataViewColumn( wxT("editable"), text_renderer, 2 );
+ dataview_right->AppendColumn( column );
+ dataview_right->AppendTextColumn( wxT("first"), 0 );
+ dataview_right->AppendTextColumn( wxT("second"), 1 );
+ wxDataViewToggleRenderer *toggle_renderer = new wxDataViewToggleRenderer( wxT("bool"), wxDATAVIEW_CELL_ACTIVATABLE );
+ column = new wxDataViewColumn( wxT("bool"), toggle_renderer, 3, 30 );
+ dataview_right->AppendColumn( column );
+
+ dataview_right->AppendDateColumn( wxT("date"), 6 );
+
+ // layout dataview controls.
+
+ wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL );
+ sizer->Add( dataview_left, 3, wxGROW );
+ sizer->Add(10,10);
+ sizer->Add( dataview_right, 2, wxGROW );
+ panel->SetSizer( sizer );
+}
+
+void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event) )
+{
+ Close(true);
+}
+
+void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
+{
+ wxMessageDialog dialog(this, _T("This demonstrates the dataview control handling"),
+ _T("About DataView"), wxOK);
+
+ dialog.ShowModal();
+}
+
+// -------------------------------------
+// MySortingFrame
+// -------------------------------------
+
+BEGIN_EVENT_TABLE(MySortingFrame,wxFrame)
+ EVT_BUTTON( ID_APPEND_ROW_LEFT, MySortingFrame::OnAppendRowLeft )
+ EVT_BUTTON( ID_PREPEND_ROW_LEFT, MySortingFrame::OnPrependRowLeft )
+ EVT_BUTTON( ID_INSERT_ROW_LEFT, MySortingFrame::OnInsertRowLeft )
+ EVT_BUTTON( ID_DELETE_ROW_LEFT, MySortingFrame::OnDeleteRowLeft )
+ EVT_BUTTON( ID_SELECT, MySortingFrame::OnSelect )
+ EVT_BUTTON( ID_UNSELECT_ALL, MySortingFrame::OnUnselectAll )
+ EVT_DATAVIEW_ROW_SELECTED( ID_SORTED, MySortingFrame::OnSelectedSorted )
+ EVT_DATAVIEW_ROW_SELECTED( ID_UNSORTED, MySortingFrame::OnSelectedUnsorted )
+ EVT_DATAVIEW_ROW_ACTIVATED( ID_UNSORTED, MySortingFrame::OnActivatedUnsorted )
+ EVT_DATAVIEW_COLUMN_HEADER_CLICK( ID_SORTED, MySortingFrame::OnHeaderClickSorted )
+ EVT_DATAVIEW_COLUMN_HEADER_CLICK( ID_UNSORTED, MySortingFrame::OnHeaderClickUnsorted )
+END_EVENT_TABLE()
+
+MySortingFrame::MySortingFrame(wxFrame *frame, wxChar *title, int x, int y, int w, int h):
+ wxFrame(frame, wxID_ANY, title, wxPoint(x, y), wxSize(w, h))
+{
+ m_logOld = NULL;