]> git.saurik.com Git - wxWidgets.git/blame - samples/dataview/dataview.cpp
wxSpinCtrl values are always integral, they don't need to be rounded
[wxWidgets.git] / samples / dataview / dataview.cpp
CommitLineData
bd6169a6
RR
1/////////////////////////////////////////////////////////////////////////////
2// Name: dataview.cpp
9861f022 3// Purpose: wxDataViewCtrl wxWidgets sample
bd6169a6 4// Author: Robert Roebling
b7e9f8b1 5// Modified by: Francesco Montorsi, Bo Yang
bd6169a6
RR
6// Created: 06/01/06
7// RCS-ID: $Id$
8// Copyright: (c) Robert Roebling
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
bf19b714
FM
12// ============================================================================
13// declarations
14// ============================================================================
15
bd6169a6
RR
16// For compilers that support precompilation, includes "wx/wx.h".
17#include "wx/wxprec.h"
18
19#ifdef __BORLANDC__
20#pragma hdrstop
21#endif
22
23#ifndef WX_PRECOMP
0bcd4039 24 #include "wx/wx.h"
bd6169a6
RR
25#endif
26
8c2654ce 27#include "wx/dataview.h"
b910a8ad 28#include "wx/datetime.h"
87f0efe2
RR
29#include "wx/splitter.h"
30#include "wx/aboutdlg.h"
bb58fa37 31#include "wx/colordlg.h"
9861f022
RR
32#include "wx/choicdlg.h"
33#include "wx/numdlg.h"
1e510b1e 34#include "wx/spinctrl.h"
8c2654ce 35#include "wx/imaglist.h"
bf19b714
FM
36#include "wx/notebook.h"
37
38#include "mymodels.h"
39
40// ----------------------------------------------------------------------------
41// resources
42// ----------------------------------------------------------------------------
ad386793 43
bd6169a6 44#ifndef __WXMSW__
0bcd4039 45 #include "../sample.xpm"
bd6169a6
RR
46#endif
47
bf19b714 48#include "wx_small.xpm"
1e08ad10 49
bf19b714
FM
50// ----------------------------------------------------------------------------
51// MyApp
52// ----------------------------------------------------------------------------
1e08ad10 53
bf19b714 54class MyApp: public wxApp
1e08ad10
RR
55{
56public:
bf19b714 57 virtual bool OnInit();
1e08ad10
RR
58};
59
bf19b714
FM
60// ----------------------------------------------------------------------------
61// MyFrame
62// ----------------------------------------------------------------------------
1c3e52af 63
bf19b714 64class MyFrame : public wxFrame
bd6169a6
RR
65{
66public:
bf19b714
FM
67 MyFrame(wxFrame *frame, const wxString &title, int x, int y, int w, int h);
68 ~MyFrame();
e63807a8 69
ecad59d8
FM
70 void BuildDataViewCtrl(wxPanel* parent,
71 unsigned int nPanel,
81c3f0fc
FM
72 unsigned long style = 0);
73
74public: // event handlers
75
76 void OnStyleChange(wxCommandEvent& event);
bb58fa37
VZ
77 void OnSetBackgroundColour(wxCommandEvent& event);
78 void OnSetForegroundColour(wxCommandEvent& event);
bf19b714
FM
79 void OnQuit(wxCommandEvent& event);
80 void OnAbout(wxCommandEvent& event);
1c3e52af 81
ecad59d8 82 void OnClearLog(wxCommandEvent& event);
81c3f0fc
FM
83 void OnPageChanged(wxBookCtrlEvent& event);
84
bf19b714
FM
85 void OnAddMozart(wxCommandEvent& event);
86 void OnDeleteMusic(wxCommandEvent& event);
87 void OnDeleteYear(wxCommandEvent& event);
88 void OnSelectNinth(wxCommandEvent& event);
d2ee27fe
RR
89 void OnCollapse(wxCommandEvent& event);
90 void OnExpand(wxCommandEvent& event);
cf283a47 91
bf19b714
FM
92 void OnPrependList(wxCommandEvent& event);
93 void OnDeleteList(wxCommandEvent& event);
1c3e52af 94
bf19b714 95 void OnValueChanged( wxDataViewEvent &event );
cf283a47 96
bf19b714
FM
97 void OnActivated( wxDataViewEvent &event );
98 void OnExpanding( wxDataViewEvent &event );
99 void OnExpanded( wxDataViewEvent &event );
100 void OnCollapsing( wxDataViewEvent &event );
101 void OnCollapsed( wxDataViewEvent &event );
102 void OnSelectionChanged( wxDataViewEvent &event );
1c3e52af 103
ecc32226 104 void OnStartEditing( wxDataViewEvent &event );
bf19b714
FM
105 void OnEditingStarted( wxDataViewEvent &event );
106 void OnEditingDone( wxDataViewEvent &event );
b910a8ad 107
bf19b714
FM
108 void OnHeaderClick( wxDataViewEvent &event );
109 void OnHeaderRightClick( wxDataViewEvent &event );
110 void OnSorted( wxDataViewEvent &event );
1c3e52af 111
bf19b714 112 void OnContextMenu( wxDataViewEvent &event );
b910a8ad 113
bf19b714
FM
114 void OnRightClick( wxMouseEvent &event );
115 void OnGoto( wxCommandEvent &event);
116 void OnAddMany( wxCommandEvent &event);
9861f022 117
bf19b714
FM
118 void OnBeginDrag( wxDataViewEvent &event );
119 void OnDropPossible( wxDataViewEvent &event );
120 void OnDrop( wxDataViewEvent &event );
9861f022 121
bf19b714
FM
122private:
123 wxNotebook* m_notebook;
1c3e52af 124
bf19b714 125 // the controls stored in the various tabs of the main notebook:
1c3e52af 126
81c3f0fc 127 wxDataViewCtrl* m_ctrl[4];
1c3e52af 128
81c3f0fc 129 // the models associated with the first two DVC:
ed903e42 130
81c3f0fc
FM
131 wxObjectDataPtr<MyMusicTreeModel> m_music_model;
132 wxObjectDataPtr<MyListModel> m_list_model;
1c3e52af 133
bf19b714 134 // other data:
1c3e52af 135
bf19b714 136 wxDataViewColumn* m_col;
1c3e52af 137
bf19b714
FM
138 wxTextCtrl* m_log;
139 wxLog *m_logOld;
1c3e52af 140
1e08ad10 141private:
bf19b714 142 DECLARE_EVENT_TABLE()
241cb04b
RR
143};
144
8b6cf9bf 145
bf19b714 146// ----------------------------------------------------------------------------
0bdfa388 147// MyCustomRenderer
bf19b714 148// ----------------------------------------------------------------------------
0bdfa388
RR
149
150class MyCustomRenderer: public wxDataViewCustomRenderer
151{
152public:
f593b0b9 153 MyCustomRenderer( wxDataViewCellMode mode, int alignment ) :
a7a27e86
RR
154 wxDataViewCustomRenderer( wxString("long"), mode, alignment )
155 { m_height = 25; }
1c3e52af 156
0bdfa388
RR
157 virtual bool Render( wxRect rect, wxDC *dc, int WXUNUSED(state) )
158 {
159 dc->SetBrush( *wxRED_BRUSH );
160 dc->SetPen( *wxTRANSPARENT_PEN );
81c3f0fc 161 dc->DrawRectangle( rect.Deflate(2) );
0bdfa388
RR
162 return true;
163 }
164
0bdfa388 165 virtual bool Activate( wxRect WXUNUSED(cell),
ecad59d8
FM
166 wxDataViewModel *WXUNUSED(model),
167 const wxDataViewItem &WXUNUSED(item),
bf19b714 168 unsigned int WXUNUSED(col) )
1c3e52af 169 {
81c3f0fc 170 wxLogMessage( "MyCustomRenderer Activate()" );
0bdfa388
RR
171 return false;
172 }
173
1c3e52af 174 virtual bool LeftClick( wxPoint cursor, wxRect WXUNUSED(cell),
ecad59d8
FM
175 wxDataViewModel *WXUNUSED(model),
176 const wxDataViewItem &WXUNUSED(item),
bf19b714 177 unsigned int WXUNUSED(col) )
1c3e52af 178 {
81c3f0fc 179 wxLogMessage( "MyCustomRenderer LeftClick( %d, %d )", cursor.x, cursor.y );
0bdfa388
RR
180 return false;
181 }
1c3e52af 182
0bdfa388 183 virtual wxSize GetSize() const
1c3e52af 184 {
7448d67c
RR
185 //return wxSize(60,m_height);
186 return wxSize(60,20);
a7a27e86 187 }
1c3e52af
VZ
188
189 virtual bool SetValue( const wxVariant &value )
190 {
a7a27e86
RR
191 m_height = value;
192 return true;
0bdfa388 193 }
1c3e52af 194
0bdfa388 195 virtual bool GetValue( wxVariant &WXUNUSED(value) ) const { return true; }
1c3e52af 196
a7a27e86
RR
197private:
198 long m_height;
0bdfa388
RR
199};
200
1c3e52af 201
bf19b714
FM
202// ============================================================================
203// implementation
204// ============================================================================
8c2654ce 205
bf19b714 206// ----------------------------------------------------------------------------
362d7fb9 207// MyApp
bf19b714 208// ----------------------------------------------------------------------------
362d7fb9 209
87f0efe2 210IMPLEMENT_APP(MyApp)
bd6169a6 211
bf19b714 212bool MyApp::OnInit()
bd6169a6 213{
45e6e6f8
VZ
214 if ( !wxApp::OnInit() )
215 return false;
216
1c3e52af 217 MyFrame *frame =
ecad59d8 218 new MyFrame(NULL, "wxDataViewCtrl sample", 40, 40, 1000, 540);
bd6169a6 219 SetTopWindow(frame);
bd6169a6 220
bf19b714
FM
221 frame->Show(true);
222 return true;
87f0efe2
RR
223}
224
225
bf19b714 226// ----------------------------------------------------------------------------
bd6169a6 227// MyFrame
bf19b714 228// ----------------------------------------------------------------------------
bd6169a6 229
87f0efe2
RR
230enum
231{
ecad59d8 232 ID_CLEARLOG = wxID_HIGHEST+1,
bb58fa37
VZ
233 ID_BACKGROUND_COLOUR,
234 ID_FOREGROUND_COLOUR,
ecad59d8 235 ID_STYLE_MENU,
81c3f0fc 236
87f0efe2 237 // file menu
81c3f0fc
FM
238 //ID_SINGLE, wxDV_SINGLE==0 so it's always present
239 ID_MULTIPLE,
240 ID_ROW_LINES,
241 ID_HORIZ_RULES,
242 ID_VERT_RULES,
243
87f0efe2 244 ID_EXIT = wxID_EXIT,
1c3e52af 245
81c3f0fc
FM
246 // about menu
247 ID_ABOUT = wxID_ABOUT,
248
249
250 // control IDs
251
d8331a01 252 ID_MUSIC_CTRL = 50,
1c3e52af 253
c534e696
RR
254 ID_ADD_MOZART = 100,
255 ID_DELETE_MUSIC = 101,
736fe67c 256 ID_DELETE_YEAR = 102,
a400d56b 257 ID_SELECT_NINTH = 103,
d2ee27fe
RR
258 ID_COLLAPSE = 104,
259 ID_EXPAND = 105,
1c3e52af 260
c534e696 261 ID_PREPEND_LIST = 200,
b7e9f8b1 262 ID_DELETE_LIST = 201,
8b6cf9bf
RR
263 ID_GOTO = 202,
264 ID_ADD_MANY = 203
87f0efe2
RR
265};
266
267BEGIN_EVENT_TABLE(MyFrame, wxFrame)
81c3f0fc 268 EVT_MENU_RANGE( ID_MULTIPLE, ID_VERT_RULES, MyFrame::OnStyleChange )
87f0efe2 269 EVT_MENU( ID_EXIT, MyFrame::OnQuit )
81c3f0fc 270 EVT_MENU( ID_ABOUT, MyFrame::OnAbout )
ecad59d8 271 EVT_MENU( ID_CLEARLOG, MyFrame::OnClearLog )
81c3f0fc 272
bb58fa37
VZ
273 EVT_MENU( ID_FOREGROUND_COLOUR, MyFrame::OnSetForegroundColour )
274 EVT_MENU( ID_BACKGROUND_COLOUR, MyFrame::OnSetBackgroundColour )
275
81c3f0fc
FM
276 EVT_NOTEBOOK_PAGE_CHANGED( wxID_ANY, MyFrame::OnPageChanged )
277
c534e696
RR
278 EVT_BUTTON( ID_ADD_MOZART, MyFrame::OnAddMozart )
279 EVT_BUTTON( ID_DELETE_MUSIC, MyFrame::OnDeleteMusic )
736fe67c 280 EVT_BUTTON( ID_DELETE_YEAR, MyFrame::OnDeleteYear )
a400d56b 281 EVT_BUTTON( ID_SELECT_NINTH, MyFrame::OnSelectNinth )
d2ee27fe
RR
282 EVT_BUTTON( ID_COLLAPSE, MyFrame::OnCollapse )
283 EVT_BUTTON( ID_EXPAND, MyFrame::OnExpand )
ecad59d8 284
c534e696
RR
285 EVT_BUTTON( ID_PREPEND_LIST, MyFrame::OnPrependList )
286 EVT_BUTTON( ID_DELETE_LIST, MyFrame::OnDeleteList )
b7e9f8b1 287 EVT_BUTTON( ID_GOTO, MyFrame::OnGoto)
8b6cf9bf 288 EVT_BUTTON( ID_ADD_MANY, MyFrame::OnAddMany)
1c3e52af 289
0376cc52 290 EVT_DATAVIEW_ITEM_VALUE_CHANGED( ID_MUSIC_CTRL, MyFrame::OnValueChanged )
1c3e52af 291
b7e9f8b1 292 EVT_DATAVIEW_ITEM_ACTIVATED(ID_MUSIC_CTRL, MyFrame::OnActivated )
718fd180
RR
293 EVT_DATAVIEW_ITEM_EXPANDING(ID_MUSIC_CTRL, MyFrame::OnExpanding)
294 EVT_DATAVIEW_ITEM_EXPANDED(ID_MUSIC_CTRL, MyFrame::OnExpanded)
295 EVT_DATAVIEW_ITEM_COLLAPSING(ID_MUSIC_CTRL, MyFrame::OnCollapsing)
296 EVT_DATAVIEW_ITEM_COLLAPSED(ID_MUSIC_CTRL, MyFrame::OnCollapsed)
aed836f3 297 EVT_DATAVIEW_SELECTION_CHANGED(ID_MUSIC_CTRL, MyFrame::OnSelectionChanged)
1c3e52af 298
ecc32226 299 EVT_DATAVIEW_ITEM_START_EDITING(ID_MUSIC_CTRL, MyFrame::OnStartEditing)
d14e1c3a
RR
300 EVT_DATAVIEW_ITEM_EDITING_STARTED(ID_MUSIC_CTRL, MyFrame::OnEditingStarted)
301 EVT_DATAVIEW_ITEM_EDITING_DONE(ID_MUSIC_CTRL, MyFrame::OnEditingDone)
1c3e52af 302
b7e9f8b1
RR
303 EVT_DATAVIEW_COLUMN_HEADER_CLICK(ID_MUSIC_CTRL, MyFrame::OnHeaderClick)
304 EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED(ID_MUSIC_CTRL, MyFrame::OnHeaderRightClick)
305 EVT_DATAVIEW_COLUMN_SORTED(ID_MUSIC_CTRL, MyFrame::OnSorted)
74dea0de
RR
306
307 EVT_DATAVIEW_ITEM_CONTEXT_MENU(ID_MUSIC_CTRL, MyFrame::OnContextMenu)
8c2654ce 308
591cc82d 309 EVT_DATAVIEW_ITEM_BEGIN_DRAG( ID_MUSIC_CTRL, MyFrame::OnBeginDrag )
e4de825e
RR
310 EVT_DATAVIEW_ITEM_DROP_POSSIBLE( ID_MUSIC_CTRL, MyFrame::OnDropPossible )
311 EVT_DATAVIEW_ITEM_DROP( ID_MUSIC_CTRL, MyFrame::OnDrop )
1c3e52af 312
b7e9f8b1 313 EVT_RIGHT_UP(MyFrame::OnRightClick)
87f0efe2
RR
314END_EVENT_TABLE()
315
e94d0c1e 316MyFrame::MyFrame(wxFrame *frame, const wxString &title, int x, int y, int w, int h):
bd6169a6
RR
317 wxFrame(frame, wxID_ANY, title, wxPoint(x, y), wxSize(w, h))
318{
d8331a01 319 m_log = NULL;
fbda518c 320 m_col = NULL;
d8331a01 321
81c3f0fc
FM
322 m_ctrl[0] = NULL;
323 m_ctrl[1] = NULL;
324 m_ctrl[2] = NULL;
325 m_ctrl[3] = NULL;
326
0bcd4039 327 SetIcon(wxICON(sample));
bd6169a6 328
bf19b714
FM
329
330 // build the menus
331 // ----------------
87f0efe2 332
81c3f0fc 333 wxMenu *style_menu = new wxMenu;
ecad59d8
FM
334 //style_menu->AppendCheckItem(ID_SINGLE, "Single selection"));
335 style_menu->AppendCheckItem(ID_MULTIPLE, "Multiple selection");
336 style_menu->AppendCheckItem(ID_ROW_LINES, "Alternating colours");
337 style_menu->AppendCheckItem(ID_HORIZ_RULES, "Display horizontal rules");
338 style_menu->AppendCheckItem(ID_VERT_RULES, "Display vertical rules");
81c3f0fc 339
bd6169a6 340 wxMenu *file_menu = new wxMenu;
bb58fa37
VZ
341 file_menu->Append(ID_CLEARLOG, "&Clear log\tCtrl-L");
342 file_menu->Append(ID_FOREGROUND_COLOUR, "Set &foreground colour...\tCtrl-F");
343 file_menu->Append(ID_BACKGROUND_COLOUR, "Set &background colour...\tCtrl-B");
ecad59d8 344 file_menu->Append(ID_STYLE_MENU, "&Style", style_menu);
87f0efe2 345 file_menu->AppendSeparator();
ecad59d8 346 file_menu->Append(ID_EXIT, "E&xit");
bd6169a6 347
81c3f0fc 348 wxMenu *about_menu = new wxMenu;
ecad59d8 349 about_menu->Append(ID_ABOUT, "&About");
81c3f0fc 350
bd6169a6 351 wxMenuBar *menu_bar = new wxMenuBar;
ecad59d8
FM
352 menu_bar->Append(file_menu, "&File");
353 menu_bar->Append(about_menu, "&About");
87f0efe2 354
bd6169a6 355 SetMenuBar(menu_bar);
87f0efe2 356 CreateStatusBar();
8c2654ce 357
1e08ad10 358
bf19b714
FM
359 // first page of the notebook
360 // --------------------------
ecad59d8 361
bf19b714 362 m_notebook = new wxNotebook( this, wxID_ANY );
bd6169a6 363
bf19b714 364 wxPanel *firstPanel = new wxPanel( m_notebook, wxID_ANY );
bf19b714 365
81c3f0fc 366 BuildDataViewCtrl(firstPanel, 0); // sets m_ctrl[0]
1c3e52af 367
bf19b714 368 wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
ecad59d8
FM
369 button_sizer->Add( new wxButton( firstPanel, ID_ADD_MOZART, "Add Mozart"), 0, wxALL, 10 );
370 button_sizer->Add( new wxButton( firstPanel, ID_DELETE_MUSIC,"Delete selected"), 0, wxALL, 10 );
371 button_sizer->Add( new wxButton( firstPanel, ID_DELETE_YEAR, "Delete \"Year\" column"), 0, wxALL, 10 );
372 button_sizer->Add( new wxButton( firstPanel, ID_SELECT_NINTH,"Select ninth symphony"), 0, wxALL, 10 );
373 button_sizer->Add( new wxButton( firstPanel, ID_COLLAPSE, "Collapse"), 0, wxALL, 10 );
374 button_sizer->Add( new wxButton( firstPanel, ID_EXPAND, "Expand"), 0, wxALL, 10 );
1c3e52af 375
bf19b714 376 wxSizer *firstPanelSz = new wxBoxSizer( wxVERTICAL );
81c3f0fc
FM
377 m_ctrl[0]->SetMinSize(wxSize(-1, 200));
378 firstPanelSz->Add(m_ctrl[0], 1, wxGROW|wxALL, 5);
379 firstPanelSz->Add(
ecad59d8 380 new wxStaticText(firstPanel, wxID_ANY, "Most of the cells above are editable!"),
81c3f0fc 381 0, wxGROW|wxALL, 5);
bf19b714
FM
382 firstPanelSz->Add(button_sizer);
383 firstPanel->SetSizerAndFit(firstPanelSz);
1c3e52af 384
83087c60 385
bf19b714
FM
386 // second page of the notebook
387 // ---------------------------
83087c60 388
bf19b714 389 wxPanel *secondPanel = new wxPanel( m_notebook, wxID_ANY );
1c3e52af 390
81c3f0fc 391 BuildDataViewCtrl(secondPanel, 1); // sets m_ctrl[1]
1c3e52af 392
bf19b714 393 wxBoxSizer *button_sizer2 = new wxBoxSizer( wxHORIZONTAL );
ecad59d8
FM
394 button_sizer2->Add( new wxButton( secondPanel, ID_PREPEND_LIST,"Prepend"), 0, wxALL, 10 );
395 button_sizer2->Add( new wxButton( secondPanel, ID_DELETE_LIST, "Delete selected"), 0, wxALL, 10 );
396 button_sizer2->Add( new wxButton( secondPanel, ID_GOTO, "Goto 50"), 0, wxALL, 10 );
397 button_sizer2->Add( new wxButton( secondPanel, ID_ADD_MANY, "Add 1000"), 0, wxALL, 10 );
a75124d0 398
bf19b714 399 wxSizer *secondPanelSz = new wxBoxSizer( wxVERTICAL );
81c3f0fc 400 secondPanelSz->Add(m_ctrl[1], 1, wxGROW|wxALL, 5);
bf19b714
FM
401 secondPanelSz->Add(button_sizer2);
402 secondPanel->SetSizerAndFit(secondPanelSz);
1c3e52af 403
b7e9f8b1 404
bf19b714
FM
405 // third page of the notebook
406 // ---------------------------
8c2654ce 407
bf19b714 408 wxPanel *thirdPanel = new wxPanel( m_notebook, wxID_ANY );
8c2654ce 409
81c3f0fc 410 BuildDataViewCtrl(thirdPanel, 2); // sets m_ctrl[2]
8c2654ce 411
bf19b714 412 wxSizer *thirdPanelSz = new wxBoxSizer( wxVERTICAL );
81c3f0fc 413 thirdPanelSz->Add(m_ctrl[2], 1, wxGROW|wxALL, 5);
bf19b714 414 thirdPanel->SetSizerAndFit(thirdPanelSz);
8c2654ce 415
672e58d9 416
bf19b714
FM
417 // fourth page of the notebook
418 // ---------------------------
ecad59d8 419
bf19b714 420 wxPanel *fourthPanel = new wxPanel( m_notebook, wxID_ANY );
a75124d0 421
81c3f0fc 422 BuildDataViewCtrl(fourthPanel, 3); // sets m_ctrl[3]
1c3e52af 423
bf19b714 424 wxSizer *fourthPanelSz = new wxBoxSizer( wxVERTICAL );
81c3f0fc 425 fourthPanelSz->Add(m_ctrl[3], 1, wxGROW|wxALL, 5);
bf19b714 426 fourthPanel->SetSizerAndFit(fourthPanelSz);
e39d30c0 427
1c3e52af 428
ecad59d8 429
bf19b714
FM
430 // complete GUI
431 // ------------
432
433 m_notebook->AddPage(firstPanel, "MyMusicTreeModel");
434 m_notebook->AddPage(secondPanel, "MyListModel");
435 m_notebook->AddPage(thirdPanel, "wxDataViewListCtrl");
436 m_notebook->AddPage(fourthPanel, "wxDataViewTreeCtrl");
437
438 wxSizer* mainSizer = new wxBoxSizer(wxVERTICAL);
ecad59d8
FM
439
440 m_log = new wxTextCtrl( this, wxID_ANY, wxString(), wxDefaultPosition,
bf19b714
FM
441 wxDefaultSize, wxTE_MULTILINE );
442 m_log->SetMinSize(wxSize(-1, 100));
443 m_logOld = wxLog::SetActiveTarget(new wxLogTextCtrl(m_log));
ecad59d8 444 wxLogMessage( "This is the log window" );
1c3e52af 445
bf19b714
FM
446 mainSizer->Add( m_notebook, 1, wxGROW );
447 mainSizer->Add( m_log, 0, wxGROW );
43b2d5e7 448
bf19b714 449 SetSizerAndFit(mainSizer);
a75124d0
RR
450}
451
e39d30c0
RR
452MyFrame::~MyFrame()
453{
454 delete wxLog::SetActiveTarget(m_logOld);
455}
456
81c3f0fc
FM
457void MyFrame::BuildDataViewCtrl(wxPanel* parent, unsigned int nPanel, unsigned long style)
458{
459 switch (nPanel)
460 {
461 case 0:
462 {
463 wxASSERT(!m_ctrl[0] && !m_music_model);
ecad59d8 464 m_ctrl[0] =
81c3f0fc
FM
465 new wxDataViewCtrl( parent, ID_MUSIC_CTRL, wxDefaultPosition,
466 wxDefaultSize, style );
467
468 m_music_model = new MyMusicTreeModel;
469 m_ctrl[0]->AssociateModel( m_music_model.get() );
470
471 m_ctrl[0]->EnableDragSource( wxDF_UNICODETEXT );
472 m_ctrl[0]->EnableDropTarget( wxDF_UNICODETEXT );
473
474 // column 0 of the view control:
475
ecad59d8
FM
476 wxDataViewTextRenderer *tr =
477 new wxDataViewTextRenderer( "string", wxDATAVIEW_CELL_INERT );
478 wxDataViewColumn *column0 =
479 new wxDataViewColumn( "title", tr, 0, 200, wxALIGN_LEFT,
81c3f0fc
FM
480 wxDATAVIEW_COL_SORTABLE | wxDATAVIEW_COL_RESIZABLE );
481 m_ctrl[0]->AppendColumn( column0 );
482#if 0
483 // Call this and sorting is enabled
484 // immediatly upon start up.
485 column0->SetAsSortKey();
486#endif
487
488 // column 1 of the view control:
489
ecad59d8
FM
490 tr = new wxDataViewTextRenderer( "string", wxDATAVIEW_CELL_EDITABLE );
491 wxDataViewColumn *column1 =
492 new wxDataViewColumn( "artist", tr, 1, 150, wxALIGN_LEFT,
493 wxDATAVIEW_COL_SORTABLE | wxDATAVIEW_COL_REORDERABLE |
81c3f0fc
FM
494 wxDATAVIEW_COL_RESIZABLE );
495 column1->SetMinWidth(150); // this column can't be resized to be smaller
496 m_ctrl[0]->AppendColumn( column1 );
497
498 // column 2 of the view control:
499
ecad59d8 500 wxDataViewSpinRenderer *sr =
81c3f0fc 501 new wxDataViewSpinRenderer( 0, 2010, wxDATAVIEW_CELL_EDITABLE, wxALIGN_RIGHT );
ecad59d8
FM
502 wxDataViewColumn *column2 =
503 new wxDataViewColumn( "year", sr, 2, 60, wxALIGN_LEFT,
81c3f0fc
FM
504 wxDATAVIEW_COL_SORTABLE | wxDATAVIEW_COL_REORDERABLE );
505 m_ctrl[0]->AppendColumn( column2 );
506
507 // column 3 of the view control:
508
509 wxArrayString choices;
510 choices.Add( "good" );
511 choices.Add( "bad" );
512 choices.Add( "lousy" );
ecad59d8 513 wxDataViewChoiceRenderer *c =
81c3f0fc 514 new wxDataViewChoiceRenderer( choices, wxDATAVIEW_CELL_EDITABLE, wxALIGN_RIGHT );
ecad59d8
FM
515 wxDataViewColumn *column3 =
516 new wxDataViewColumn( "rating", c, 3, 100, wxALIGN_LEFT,
81c3f0fc
FM
517 wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_RESIZABLE );
518 m_ctrl[0]->AppendColumn( column3 );
519
520 // column 4 of the view control:
521
ecad59d8 522 m_ctrl[0]->AppendProgressColumn( "popularity", 4, wxDATAVIEW_CELL_INERT, 80 );
81c3f0fc
FM
523
524 // column 5 of the view control:
525
526 MyCustomRenderer *cr = new MyCustomRenderer( wxDATAVIEW_CELL_ACTIVATABLE, wxALIGN_RIGHT );
ecad59d8
FM
527 wxDataViewColumn *column5 =
528 new wxDataViewColumn( "custom", cr, 5, -1, wxALIGN_LEFT,
81c3f0fc
FM
529 wxDATAVIEW_COL_RESIZABLE );
530 m_ctrl[0]->AppendColumn( column5 );
ecad59d8 531
81c3f0fc
FM
532
533 // select initially the ninth symphony:
534 m_ctrl[0]->Select(m_music_model->GetNinthItem());
535 }
536 break;
537
538 case 1:
539 {
540 wxASSERT(!m_ctrl[1] && !m_list_model);
541 m_ctrl[1] = new wxDataViewCtrl( parent, wxID_ANY, wxDefaultPosition,
542 wxDefaultSize, style );
543
544 m_list_model = new MyListModel;
545 m_ctrl[1]->AssociateModel( m_list_model.get() );
546
547 // the various columns
ecad59d8 548 m_ctrl[1]->AppendTextColumn("editable string", 0, wxDATAVIEW_CELL_EDITABLE);
205bdf20 549 m_ctrl[1]->AppendIconTextColumn("icon", 1, wxDATAVIEW_CELL_EDITABLE);
81c3f0fc 550 m_ctrl[1]->AppendColumn(
2d0d7813 551 new wxDataViewColumn("attributes", new wxDataViewTextRenderer, 2 ));
81c3f0fc
FM
552 }
553 break;
554
555 case 2:
556 {
557 wxASSERT(!m_ctrl[2]);
ecad59d8 558 wxDataViewListCtrl* lc =
81c3f0fc
FM
559 new wxDataViewListCtrl( parent, wxID_ANY, wxDefaultPosition,
560 wxDefaultSize, style );
561 m_ctrl[2] = lc;
562
ecad59d8
FM
563 lc->AppendToggleColumn( "Toggle" );
564 lc->AppendTextColumn( "Text" );
565 lc->AppendProgressColumn( "Progress" );
81c3f0fc
FM
566
567 wxVector<wxVariant> data;
568 for (unsigned int i=0; i<10; i++)
569 {
570 data.clear();
571 data.push_back( (i%3) == 0 );
572 data.push_back( wxString::Format("row %d", i) );
573 data.push_back( long(5*i) );
574
575 lc->AppendItem( data );
576 }
577 }
578 break;
579
580 case 3:
581 {
582 wxASSERT(!m_ctrl[3]);
ecad59d8 583 wxDataViewTreeCtrl* tc =
81c3f0fc
FM
584 new wxDataViewTreeCtrl( parent, wxID_ANY, wxDefaultPosition,
585 wxDefaultSize, style );
586 m_ctrl[3] = tc;
587
588 wxImageList *ilist = new wxImageList( 16, 16 );
589 ilist->Add( wxIcon(wx_small_xpm) );
590 tc->SetImageList( ilist );
591
ecad59d8
FM
592 wxDataViewItem parent =
593 tc->AppendContainer( wxDataViewItem(0), "The Root", 0 );
594 tc->AppendItem( parent, "Child 1", 0 );
595 tc->AppendItem( parent, "Child 2", 0 );
596 tc->AppendItem( parent, "Child 3, very long, long, long, long", 0 );
81c3f0fc
FM
597
598 wxDataViewItem cont =
ecad59d8
FM
599 tc->AppendContainer( parent, "Container child", 0 );
600 tc->AppendItem( cont, "Child 4", 0 );
601 tc->AppendItem( cont, "Child 5", 0 );
81c3f0fc
FM
602
603 tc->Expand(cont);
ecad59d8 604 }
81c3f0fc
FM
605 break;
606 }
607}
608
609
610// ----------------------------------------------------------------------------
611// MyFrame - generic event handlers
612// ----------------------------------------------------------------------------
613
ecad59d8
FM
614void MyFrame::OnClearLog( wxCommandEvent& WXUNUSED(event) )
615{
616 m_log->Clear();
617}
618
bb58fa37
VZ
619void MyFrame::OnSetForegroundColour(wxCommandEvent& WXUNUSED(event))
620{
621 wxDataViewCtrl * const dvc = m_ctrl[m_notebook->GetSelection()];
622 wxColour col = wxGetColourFromUser(this, dvc->GetForegroundColour());
623 if ( col.IsOk() )
624 {
625 dvc->SetForegroundColour(col);
626 Refresh();
627 }
628}
629
630void MyFrame::OnSetBackgroundColour(wxCommandEvent& WXUNUSED(event))
631{
632 wxDataViewCtrl * const dvc = m_ctrl[m_notebook->GetSelection()];
633 wxColour col = wxGetColourFromUser(this, dvc->GetBackgroundColour());
634 if ( col.IsOk() )
635 {
636 dvc->SetBackgroundColour(col);
637 Refresh();
638 }
639}
640
ecad59d8 641void MyFrame::OnPageChanged( wxBookCtrlEvent& WXUNUSED(event) )
81c3f0fc
FM
642{
643 unsigned int nPanel = m_notebook->GetSelection();
644
645 GetMenuBar()->FindItem(ID_STYLE_MENU)->SetItemLabel(
646 wxString::Format("Style of panel #%d", nPanel+1));
647
648 for (unsigned int id = ID_MULTIPLE; id <= ID_VERT_RULES; id++)
649 {
650 unsigned long style = 0;
651 switch (id)
652 {
653 /*case ID_SINGLE:
654 style = wxDV_SINGLE;
655 break;*/
656 case ID_MULTIPLE:
657 style = wxDV_MULTIPLE;
658 break;
659 case ID_ROW_LINES:
660 style = wxDV_ROW_LINES;
661 break;
662 case ID_HORIZ_RULES:
663 style = wxDV_HORIZ_RULES;
664 break;
665 case ID_VERT_RULES:
666 style = wxDV_VERT_RULES;
667 break;
668 default:
669 wxFAIL;
670 }
671
672 GetMenuBar()->FindItem(id)->Check( m_ctrl[nPanel]->HasFlag(style) );
673 }
674}
675
ecad59d8 676void MyFrame::OnStyleChange( wxCommandEvent& WXUNUSED(event) )
81c3f0fc
FM
677{
678 unsigned int nPanel = m_notebook->GetSelection();
679
680 // build the style
681 unsigned long style = 0;
682 /*if (GetMenuBar()->FindItem(ID_SINGLE)->IsChecked())
683 style |= wxDV_SINGLE;*/
684 if (GetMenuBar()->FindItem(ID_MULTIPLE)->IsChecked())
685 style |= wxDV_MULTIPLE;
686 if (GetMenuBar()->FindItem(ID_ROW_LINES)->IsChecked())
687 style |= wxDV_ROW_LINES;
688 if (GetMenuBar()->FindItem(ID_HORIZ_RULES)->IsChecked())
689 style |= wxDV_HORIZ_RULES;
690 if (GetMenuBar()->FindItem(ID_VERT_RULES)->IsChecked())
691 style |= wxDV_VERT_RULES;
692
693 wxSizer* sz = m_ctrl[nPanel]->GetContainingSizer();
694 wxASSERT(sz);
695
696 sz->Detach(m_ctrl[nPanel]);
697 wxDELETE(m_ctrl[nPanel]);
698 m_ctrl[nPanel] = NULL;
699
700 if (nPanel == 0)
701 m_music_model.reset(NULL);
702 else if (nPanel == 1)
703 m_list_model.reset(NULL);
704
705 // rebuild the DVC for the selected panel:
706 BuildDataViewCtrl((wxPanel*)m_notebook->GetPage(nPanel), nPanel, style);
707
708 sz->Prepend(m_ctrl[nPanel], 1, wxGROW|wxALL, 5);
709 sz->Layout();
710}
711
712void MyFrame::OnQuit( wxCommandEvent& WXUNUSED(event) )
a75124d0
RR
713{
714 Close(true);
e94d0c1e
RR
715}
716
ecad59d8 717void MyFrame::OnAbout( wxCommandEvent& WXUNUSED(event) )
81c3f0fc
FM
718{
719 wxAboutDialogInfo info;
720 info.SetName(_("DataView sample"));
721 info.SetDescription(_("This sample demonstrates wxDataViewCtrl"));
9a83f860 722 info.SetCopyright(wxT("(C) 2007-2009 Robert Roebling"));
81c3f0fc
FM
723 info.AddDeveloper("Robert Roebling");
724 info.AddDeveloper("Francesco Montorsi");
725
726 wxAboutBox(info);
727}
728
729
730// ----------------------------------------------------------------------------
731// MyFrame - event handlers for the first page
732// ----------------------------------------------------------------------------
733
734void MyFrame::OnBeginDrag( wxDataViewEvent &event )
735{
736 wxDataViewItem item( event.GetItem() );
737
738 // only allow drags for item, not containers
739 if (m_music_model->IsContainer( item ) )
740 {
741 event.Veto();
742 return;
743 }
744
745 MyMusicTreeModelNode *node = (MyMusicTreeModelNode*) item.GetID();
746 wxTextDataObject *obj = new wxTextDataObject;
747 obj->SetText( node->m_title );
748 event.SetDataObject( obj );
749}
750
751void MyFrame::OnDropPossible( wxDataViewEvent &event )
752{
753 wxDataViewItem item( event.GetItem() );
754
755 // only allow drags for item, not containers
756 if (m_music_model->IsContainer( item ) )
757 event.Veto();
758
759 if (event.GetDataFormat() != wxDF_UNICODETEXT)
760 event.Veto();
761}
762
763void MyFrame::OnDrop( wxDataViewEvent &event )
764{
765 wxDataViewItem item( event.GetItem() );
766
767 // only allow drops for item, not containers
768 if (m_music_model->IsContainer( item ) )
769 {
770 event.Veto();
771 return;
772 }
773
774 if (event.GetDataFormat() != wxDF_UNICODETEXT)
775 {
776 event.Veto();
777 return;
778 }
779
780 wxTextDataObject obj;
781 obj.SetData( wxDF_UNICODETEXT, event.GetDataSize(), event.GetDataBuffer() );
782
ecad59d8 783 wxLogMessage( "Text dropped: %s", obj.GetText() );
81c3f0fc
FM
784}
785
786void MyFrame::OnAddMozart( wxCommandEvent& WXUNUSED(event) )
c534e696 787{
ecad59d8 788 m_music_model->AddToClassical( "Kleine Nachtmusik", "Wolfgang Mozart", 1787 );
c534e696
RR
789}
790
81c3f0fc 791void MyFrame::OnDeleteMusic( wxCommandEvent& WXUNUSED(event) )
1e08ad10 792{
b7e9f8b1 793 wxDataViewItemArray items;
81c3f0fc 794 int len = m_ctrl[0]->GetSelections( items );
b7e9f8b1
RR
795 for( int i = 0; i < len; i ++ )
796 if (items[i].IsOk())
797 m_music_model->Delete( items[i] );
e63807a8
RR
798}
799
736fe67c
RR
800void MyFrame::OnDeleteYear( wxCommandEvent& WXUNUSED(event) )
801{
81c3f0fc 802 m_ctrl[0]->DeleteColumn( m_ctrl[0]->GetColumn( 2 ) );
736fe67c
RR
803 FindWindow( ID_DELETE_YEAR )->Disable();
804}
805
a400d56b
RR
806void MyFrame::OnSelectNinth( wxCommandEvent& WXUNUSED(event) )
807{
ecad59d8
FM
808 if (!m_music_model->GetNinthItem().IsOk())
809 {
810 wxLogError( "Cannot select the ninth symphony: it was removed!" );
811 return;
812 }
813
81c3f0fc 814 m_ctrl[0]->Select( m_music_model->GetNinthItem() );
1e08ad10
RR
815}
816
d2ee27fe
RR
817void MyFrame::OnCollapse( wxCommandEvent& WXUNUSED(event) )
818{
819 wxDataViewItem item = m_ctrl[0]->GetSelection();
820 if (item.IsOk())
821 m_ctrl[0]->Collapse( item );
822}
823
824void MyFrame::OnExpand( wxCommandEvent& WXUNUSED(event) )
825{
826 wxDataViewItem item = m_ctrl[0]->GetSelection();
827 if (item.IsOk())
828 m_ctrl[0]->Expand( item );
829}
830
d8331a01
RR
831void MyFrame::OnValueChanged( wxDataViewEvent &event )
832{
833 if (!m_log)
834 return;
1c3e52af 835
ecad59d8 836 wxLogMessage( "wxEVT_DATAVIEW_ITEM_VALUE_CHANGED, Item Id: %d; Column: %d",
bf19b714 837 event.GetItem().GetID(), event.GetColumn() );
b7e9f8b1
RR
838}
839
840void MyFrame::OnActivated( wxDataViewEvent &event )
841{
842 if(!m_log)
843 return;
844
d32332aa 845 wxString title = m_music_model->GetTitle( event.GetItem() );
ecad59d8 846 wxLogMessage( "wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, Item: %s", title );
8c2654ce 847
81c3f0fc 848 if (m_ctrl[0]->IsExpanded( event.GetItem() ))
43b2d5e7 849 {
ecad59d8 850 wxLogMessage( "Item: %s is expanded", title );
43b2d5e7 851 }
b7e9f8b1
RR
852}
853
aed836f3 854void MyFrame::OnSelectionChanged( wxDataViewEvent &event )
6848478c
RR
855{
856 if(!m_log)
857 return;
858
d32332aa
RR
859 wxString title = m_music_model->GetTitle( event.GetItem() );
860 if (title.empty())
ecad59d8 861 title = "None";
1c3e52af 862
ecad59d8 863 wxLogMessage( "wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, First selected Item: %s", title );
6848478c
RR
864}
865
718fd180
RR
866void MyFrame::OnExpanding( wxDataViewEvent &event )
867{
868 if (!m_log)
869 return;
1c3e52af 870
d32332aa 871 wxString title = m_music_model->GetTitle( event.GetItem() );
ecad59d8 872 wxLogMessage( "wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING, Item: %s", title );
718fd180
RR
873}
874
d14e1c3a 875
ecc32226
RR
876void MyFrame::OnStartEditing( wxDataViewEvent &event )
877{
878 wxString artist = m_music_model->GetArtist( event.GetItem() );
879 if (artist == "Ludwig van Beethoven")
880 {
881 event.Veto();
43b2d5e7 882
ecc32226
RR
883 if (!m_log)
884 return;
43b2d5e7 885
0a807957 886 wxLogMessage( "wxEVT_COMMAND_DATAVIEW_ITEM_START_EDITING vetoed. Artist: %s", artist );
ecc32226 887 }
0a807957
RR
888 else
889 wxLogMessage( "wxEVT_COMMAND_DATAVIEW_ITEM_START_EDITING not vetoed. Artist: %s", artist );
43b2d5e7 890
ecc32226
RR
891}
892
d14e1c3a
RR
893void MyFrame::OnEditingStarted( wxDataViewEvent &event )
894{
895 if (!m_log)
896 return;
1c3e52af 897
d32332aa 898 wxString title = m_music_model->GetTitle( event.GetItem() );
ecad59d8 899 wxLogMessage( "wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED, Item: %s", title );
d14e1c3a
RR
900}
901
902void MyFrame::OnEditingDone( wxDataViewEvent &event )
903{
904 if (!m_log)
905 return;
1c3e52af 906
d32332aa 907 wxString title = m_music_model->GetTitle( event.GetItem() );
ecad59d8 908 wxLogMessage( "wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE, Item: %s", title );
d14e1c3a
RR
909}
910
718fd180
RR
911void MyFrame::OnExpanded( wxDataViewEvent &event )
912{
913 if (!m_log)
914 return;
1c3e52af 915
d32332aa 916 wxString title = m_music_model->GetTitle( event.GetItem() );
ecad59d8 917 wxLogMessage( "wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED, Item: %s", title );
718fd180
RR
918}
919
920void MyFrame::OnCollapsing( wxDataViewEvent &event )
921{
922 if (!m_log)
923 return;
1c3e52af 924
d32332aa 925 wxString title = m_music_model->GetTitle( event.GetItem() );
ecad59d8 926 wxLogMessage( "wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING, Item: %s", title );
718fd180
RR
927}
928
929void MyFrame::OnCollapsed( wxDataViewEvent &event )
930{
931 if (!m_log)
932 return;
1c3e52af 933
d32332aa 934 wxString title = m_music_model->GetTitle( event.GetItem() );
ecad59d8 935 wxLogMessage( "wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED, Item: %s", title );
718fd180
RR
936}
937
74dea0de
RR
938void MyFrame::OnContextMenu( wxDataViewEvent &event )
939{
940 if (!m_log)
941 return;
1c3e52af 942
74dea0de 943 wxString title = m_music_model->GetTitle( event.GetItem() );
ecad59d8 944 wxLogMessage( "wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, Item: %s", title );
1c3e52af
VZ
945
946 wxMenu menu;
ecad59d8
FM
947 menu.Append( 1, "menuitem 1" );
948 menu.Append( 2, "menuitem 2" );
949 menu.Append( 3, "menuitem 3" );
1c3e52af 950
81c3f0fc 951 m_ctrl[0]->PopupMenu(&menu);
74dea0de
RR
952}
953
b7e9f8b1
RR
954void MyFrame::OnHeaderClick( wxDataViewEvent &event )
955{
fba41cf3
VZ
956 // we need to skip the event to let the default behaviour of sorting by
957 // this column when it is clicked to take place
958 event.Skip();
959
81c3f0fc 960 if (!m_log)
b7e9f8b1 961 return;
1c3e52af 962
81c3f0fc 963 int pos = m_ctrl[0]->GetColumnPosition( event.GetDataViewColumn() );
b7e9f8b1 964
ecad59d8 965 wxLogMessage( "wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK, Column position: %d", pos );
1c958845 966 wxLogMessage( "Column width: %d", event.GetDataViewColumn()->GetWidth() );
b7e9f8b1
RR
967}
968
969void MyFrame::OnHeaderRightClick( wxDataViewEvent &event )
970{
971 if(!m_log)
972 return;
973
81c3f0fc 974 int pos = m_ctrl[0]->GetColumnPosition( event.GetDataViewColumn() );
dadc879e 975
ecad59d8 976 wxLogMessage( "wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK, Column position: %d", pos );
b7e9f8b1
RR
977}
978
979void MyFrame::OnSorted( wxDataViewEvent &event )
980{
981 if(!m_log)
982 return;
983
81c3f0fc 984 int pos = m_ctrl[0]->GetColumnPosition( event.GetDataViewColumn() );
d32332aa 985
ecad59d8 986 wxLogMessage( "wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED, Column position: %d", pos );
b7e9f8b1
RR
987}
988
989void MyFrame::OnRightClick( wxMouseEvent &event )
990{
991 if(!m_log)
992 return;
993
ecad59d8
FM
994 wxLogMessage( "wxEVT_MOUSE_RIGHT_UP, Click Point is X: %d, Y: %d",
995 event.GetX(), event.GetY() );
b7e9f8b1
RR
996}
997
8b6cf9bf 998
81c3f0fc
FM
999// ----------------------------------------------------------------------------
1000// MyFrame - event handlers for the second page
1001// ----------------------------------------------------------------------------
8b6cf9bf 1002
81c3f0fc 1003void MyFrame::OnPrependList( wxCommandEvent& WXUNUSED(event) )
bd6169a6 1004{
ecad59d8 1005 m_list_model->Prepend("Test");
bd6169a6
RR
1006}
1007
81c3f0fc 1008void MyFrame::OnDeleteList( wxCommandEvent& WXUNUSED(event) )
15cac64f 1009{
81c3f0fc
FM
1010 wxDataViewItemArray items;
1011 int len = m_ctrl[1]->GetSelections( items );
1012 if (len > 0)
1013 m_list_model->DeleteItems( items );
15cac64f 1014}
e4de825e 1015
81c3f0fc 1016void MyFrame::OnGoto(wxCommandEvent& WXUNUSED(event))
e4de825e 1017{
81c3f0fc
FM
1018 wxDataViewItem item = m_list_model->GetItem( 50 );
1019 m_ctrl[1]->EnsureVisible(item,m_col);
e4de825e
RR
1020}
1021
81c3f0fc 1022void MyFrame::OnAddMany(wxCommandEvent& WXUNUSED(event))
e4de825e 1023{
81c3f0fc 1024 m_list_model->AddMany();
e4de825e
RR
1025}
1026