- CreateStatusBar();
-
-
- // Left wxDataViewCtrl
- dataview_left = new wxDataViewCtrl( this, -1 );
-
- MyTextModel *model = new MyTextModel;
- dataview_left->AssociateModel( model );
-
- dataview_left->AppendTextColumn( wxT("first"), 0 );
- dataview_left->AppendTextColumn( wxT("second"), 1 );
-
- wxDataViewTextCell *text_cell = new wxDataViewTextCell( wxT("string"), wxDATAVIEW_CELL_EDITABLE );
- wxDataViewColumn *column = new wxDataViewColumn( wxT("editable"), text_cell, 2 );
- dataview_left->AppendColumn( column );
-
- dataview_left->AppendToggleColumn( wxT("fourth"), 3 );
-
- MyCustomCell *custom_cell = new MyCustomCell;
- column = new wxDataViewColumn( wxT("custom"), custom_cell, 4 );
- dataview_left->AppendColumn( column );
-
- // Right wxDataViewCtrl using the same model
- dataview_right = new wxDataViewCtrl( this, -1 );
- dataview_right->AssociateModel( model );
-
- text_cell = new wxDataViewTextCell( wxT("string"), wxDATAVIEW_CELL_EDITABLE );
- column = new wxDataViewColumn( wxT("editable"), text_cell, 2 );
- dataview_right->AppendColumn( column );
- dataview_right->AppendTextColumn( wxT("first"), 0 );
- dataview_right->AppendTextColumn( wxT("second"), 1 );
- wxDataViewToggleCell *toggle_cell = new wxDataViewToggleCell( wxT("bool"), wxDATAVIEW_CELL_EDITABLE );
- column = new wxDataViewColumn( wxT("bool"), toggle_cell, 3 );
- dataview_right->AppendColumn( column );
-
- wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL );
- sizer->Add( dataview_left, 1, wxGROW );
- sizer->Add(10,10);
- sizer->Add( dataview_right, 1, wxGROW );
- SetSizer( sizer );
+ wxObjectDataPtr<MyMusicModel> model(new MyMusicModel);
+ m_dataview->AssociateModel( model.get() );
+
+ m_dataview->AppendTextColumn( "Title", 0, wxDATAVIEW_CELL_INERT, 200,
+ DEFAULT_ALIGN );
+ m_dataview->AppendTextColumn( "Artist", 1, wxDATAVIEW_CELL_INERT, 200,
+ DEFAULT_ALIGN );
+ m_dataview->AppendTextColumn( "Year", 2, wxDATAVIEW_CELL_INERT, 50,
+ DEFAULT_ALIGN );