1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxDataViewCtrl wxWidgets sample
4 // Author: Robert Roebling
5 // Modified by: Francesco Montorsi, Bo Yang
8 // Copyright: (c) Robert Roebling
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx/wx.h".
13 #include "wx/wxprec.h"
23 #include "wx/datetime.h"
24 #include "wx/splitter.h"
25 #include "wx/aboutdlg.h"
26 #include "wx/choicdlg.h"
27 #include "wx/numdlg.h"
28 #include "wx/dataview.h"
29 #include "wx/spinctrl.h"
32 #include "../sample.xpm"
38 #define DEFAULT_ALIGN wxALIGN_LEFT
39 #define DATAVIEW_DEFAULT_STYLE (wxDV_MULTIPLE|wxDV_HORIZ_RULES|wxDV_VERT_RULES)
42 // -------------------------------------
43 // MySpinCtrlInPlaceRenderer
44 // -------------------------------------
46 class MySpinCtrlInPlaceRenderer
: public wxDataViewCustomRenderer
49 MySpinCtrlInPlaceRenderer() :
50 wxDataViewCustomRenderer( wxT("long"), wxDATAVIEW_CELL_EDITABLE
) { }
53 virtual bool HasEditorCtrl()
57 virtual wxControl
* CreateEditorCtrl( wxWindow
*parent
, wxRect labelRect
, const wxVariant
&value
)
60 return new wxSpinCtrl( parent
, wxID_ANY
, wxEmptyString
,
61 labelRect
.GetTopLeft(), labelRect
.GetSize(), -0, -1, 2010, l
);
63 virtual bool GetValueFromEditorCtrl( wxControl
* editor
, wxVariant
&value
)
65 wxSpinCtrl
*sc
= (wxSpinCtrl
*) editor
;
66 long l
= sc
->GetValue();
71 bool Render( wxRect rect
, wxDC
*dc
, int WXUNUSED(state
) )
74 str
.Printf( wxT("%d"), (int) m_data
);
75 dc
->SetTextForeground( *wxBLACK
);
76 dc
->DrawText( str
, rect
.x
, rect
.y
);
79 wxSize
GetSize() const
83 bool SetValue( const wxVariant
&value
)
85 m_data
= value
.GetLong();
88 bool GetValue( wxVariant
&value
) const
100 // -------------------------------------
102 // -------------------------------------
105 Implement this data model
107 -------------------------------------------------------------
110 3: You are not alone Michael Jackson 1995
111 4: Take a bow Madonna 1994
113 6: Ninth Symphony Ludwig v. Beethoven 1824
114 7: German Requiem Johannes Brahms 1868
119 class MyMusicModelNode
;
120 WX_DEFINE_ARRAY_PTR( MyMusicModelNode
*, MyMusicModelNodes
);
122 class MyMusicModelNode
125 MyMusicModelNode( MyMusicModelNode
* parent
,
126 const wxString
&title
, const wxString
&artist
, int year
)
132 m_isContainer
= false;
135 MyMusicModelNode( MyMusicModelNode
* parent
,
136 const wxString
&branch
)
141 m_isContainer
= true;
146 size_t count
= m_children
.GetCount();
148 for (i
= 0; i
< count
; i
++)
150 MyMusicModelNode
*child
= m_children
[i
];
155 bool IsContainer() { return m_isContainer
; }
157 MyMusicModelNode
* GetParent() { return m_parent
; }
158 MyMusicModelNodes
&GetChildren() { return m_children
; }
159 MyMusicModelNode
* GetNthChild( unsigned int n
) { return m_children
.Item( n
); }
160 void Insert( MyMusicModelNode
* child
, unsigned int n
) { m_children
.Insert( child
, n
); }
161 void Append( MyMusicModelNode
* child
) { m_children
.Add( child
); }
162 unsigned int GetChildCount() { return m_children
.GetCount(); }
170 MyMusicModelNode
*m_parent
;
171 MyMusicModelNodes m_children
;
176 class MyMusicModel
: public wxDataViewModel
184 m_root
= new MyMusicModelNode( NULL
, "My Music" );
185 m_pop
= new MyMusicModelNode( m_root
, "Pop music" );
186 m_root
->Append( m_pop
);
187 m_pop
->Append( new MyMusicModelNode( m_pop
,
188 "You are not alone", "Michael Jackson", 1995 ) );
189 m_pop
->Append( new MyMusicModelNode( m_pop
,
190 "Take a bow", "Madonna", 1994 ) );
191 m_classical
= new MyMusicModelNode( m_root
, "Classical music" );
192 m_root
->Append( m_classical
);
193 m_classical
->Append( new MyMusicModelNode( m_classical
,
194 "Ninth symphony", "Ludwig van Beethoven", 1824 ) );
195 m_classical
->Append( new MyMusicModelNode( m_classical
,
196 "German Requiem", "Johannes Brahms", 1868 ) );
197 m_classicalMusicIsKnownToControl
= false;
200 // helper methods to change the model
202 void AddToClassical( const wxString
&title
, const wxString
&artist
, int year
)
205 MyMusicModelNode
*child_node
=
206 new MyMusicModelNode( m_classical
, title
, artist
, year
);
208 m_classical
->Append( child_node
);
210 if (m_classicalMusicIsKnownToControl
)
213 wxDataViewItem
child( (void*) child_node
);
214 wxDataViewItem
parent( (void*) m_classical
);
215 ItemAdded( parent
, child
);
219 void Delete( const wxDataViewItem
&item
)
221 MyMusicModelNode
*node
= (MyMusicModelNode
*) item
.GetID();
222 wxDataViewItem
parent( node
->GetParent() );
224 node
->GetParent()->GetChildren().Remove( node
);
228 ItemDeleted( parent
, item
);
231 // override sorting to always sort branches ascendingly
233 int Compare( const wxDataViewItem
&item1
, const wxDataViewItem
&item2
,
234 unsigned int column
, bool ascending
)
236 if (IsContainer(item1
) && IsContainer(item2
))
238 wxVariant value1
,value2
;
239 GetValue( value1
, item1
, 0 );
240 GetValue( value2
, item2
, 0 );
242 wxString str1
= value1
.GetString();
243 wxString str2
= value2
.GetString();
244 int res
= str1
.Cmp( str2
);
247 // items must be different
248 unsigned long litem1
= (unsigned long) item1
.GetID();
249 unsigned long litem2
= (unsigned long) item2
.GetID();
251 return litem1
-litem2
;
254 return wxDataViewModel::Compare( item1
, item2
, column
, ascending
);
257 // implementation of base class virtuals to define model
259 virtual unsigned int GetColumnCount() const
264 virtual wxString
GetColumnType( unsigned int col
) const
272 virtual void GetValue( wxVariant
&variant
,
273 const wxDataViewItem
&item
, unsigned int col
) const
275 MyMusicModelNode
*node
= (MyMusicModelNode
*) item
.GetID();
278 case 0: variant
= node
->m_title
; break;
279 case 1: variant
= node
->m_artist
; break;
280 case 2: variant
= (long) node
->m_year
; break;
283 wxLogError( "MyMusicModel::GetValue: wrong column" );
285 // provoke a crash when mouse button down
286 wxMouseState state
= wxGetMouseState();
287 if (state
.ShiftDown())
296 virtual bool SetValue( const wxVariant
&variant
,
297 const wxDataViewItem
&item
, unsigned int col
)
299 MyMusicModelNode
*node
= (MyMusicModelNode
*) item
.GetID();
302 case 0: node
->m_title
= variant
.GetString(); break;
303 case 1: node
->m_artist
= variant
.GetString(); break;
304 case 2: node
->m_year
= variant
.GetLong(); break;
305 default: wxLogError( "MyMusicModel::SetValue: wrong column" );
309 virtual wxDataViewItem
GetParent( const wxDataViewItem
&item
) const
311 // the invisble root node has no parent
313 return wxDataViewItem(0);
315 MyMusicModelNode
*node
= (MyMusicModelNode
*) item
.GetID();
317 // "MyMusic" also has no parent
319 return wxDataViewItem(0);
321 return wxDataViewItem( (void*) node
->GetParent() );
324 virtual bool IsContainer( const wxDataViewItem
&item
) const
326 // the invisble root node can have children (in
327 // our model always "MyMusic")
331 MyMusicModelNode
*node
= (MyMusicModelNode
*) item
.GetID();
332 return node
->IsContainer();
335 virtual wxDataViewItem
GetFirstChild( const wxDataViewItem
&parent
) const
337 MyMusicModelNode
*node
= (MyMusicModelNode
*) parent
.GetID();
339 return wxDataViewItem( (void*) m_root
);
341 if (node
->GetChildCount() == 0)
342 return wxDataViewItem( 0 );
344 if (node
== m_classical
)
346 MyMusicModel
*model
= (MyMusicModel
*)(const MyMusicModel
*) this;
347 model
->m_classicalMusicIsKnownToControl
= true;
350 MyMusicModelNode
*first_child
= node
->GetChildren().Item( 0 );
351 return wxDataViewItem( (void*) first_child
);
354 virtual wxDataViewItem
GetNextSibling( const wxDataViewItem
&item
) const
356 MyMusicModelNode
*node
= (MyMusicModelNode
*) item
.GetID();
358 // "MyMusic" has no siblings in our model
360 return wxDataViewItem(0);
362 MyMusicModelNode
*parent
= node
->GetParent();
363 int pos
= parent
->GetChildren().Index( node
);
365 // Something went wrong
366 if (pos
== wxNOT_FOUND
)
367 return wxDataViewItem(0);
370 if (pos
== parent
->GetChildCount()-1)
371 return wxDataViewItem(0);
373 node
= parent
->GetChildren().Item( pos
+1 );
374 return wxDataViewItem( (void*) node
);
378 MyMusicModelNode
* m_root
;
379 MyMusicModelNode
* m_pop
;
380 MyMusicModelNode
* m_classical
;
381 bool m_classicalMusicIsKnownToControl
;
384 class MyListModel
: public wxDataViewIndexListModel
388 wxDataViewIndexListModel( 100 )
391 for (i
= 0; i
< 100; i
++)
394 str
.Printf( "row number %d", i
);
399 // helper methods to change the model
401 void Prepend( const wxString
&text
)
403 m_array
.Insert( text
, 0 );
407 void DeleteItem( const wxDataViewItem
&item
)
409 unsigned int row
= GetRow( item
);
410 m_array
.RemoveAt( row
);
414 // implementation of base class virtuals to define model
416 virtual unsigned int GetColumnCount() const
421 virtual wxString
GetColumnType( unsigned int col
) const
426 virtual unsigned int GetRowCount()
428 return m_array
.GetCount();
431 virtual void GetValue( wxVariant
&variant
,
432 unsigned int row
, unsigned int col
) const
436 variant
= m_array
[ row
];
441 str
.Printf( "row %d col %d", row
, col
);
446 virtual bool SetValue( const wxVariant
&variant
,
447 unsigned int row
, unsigned int col
)
451 m_array
[row
] = variant
.GetString();
458 wxArrayString m_array
;
461 // -------------------------------------
463 // -------------------------------------
465 class MyApp
: public wxApp
472 // -------------------------------------
474 // -------------------------------------
476 class MyFrame
: public wxFrame
479 MyFrame(wxFrame
*frame
, wxChar
*title
, int x
, int y
, int w
, int h
);
482 void OnQuit(wxCommandEvent
& event
);
483 void OnAbout(wxCommandEvent
& event
);
485 void OnAddMozart(wxCommandEvent
& event
);
486 void OnDeleteMusic(wxCommandEvent
& event
);
488 void OnPrependList(wxCommandEvent
& event
);
489 void OnDeleteList(wxCommandEvent
& event
);
491 void OnValueChanged( wxDataViewEvent
&event
);
492 void OnItemAdded( wxDataViewEvent
&event
);
493 void OnItemDeleted( wxDataViewEvent
&event
);
495 void OnActivated( wxDataViewEvent
&event
);
496 void OnExpanding( wxDataViewEvent
&event
);
497 void OnExpanded( wxDataViewEvent
&event
);
498 void OnCollapsing( wxDataViewEvent
&event
);
499 void OnCollapsed( wxDataViewEvent
&event
);
500 void OnSelected( wxDataViewEvent
&event
);
502 void OnEditingStarted( wxDataViewEvent
&event
);
503 void OnEditingDone( wxDataViewEvent
&event
);
505 void OnHeaderClick( wxDataViewEvent
&event
);
506 void OnHeaderRightClick( wxDataViewEvent
&event
);
507 void OnSorted( wxDataViewEvent
&event
);
509 void OnRightClick( wxMouseEvent
&event
);
510 void OnGoto( wxCommandEvent
&event
);
513 wxDataViewCtrl
* m_musicCtrl
;
514 wxObjectDataPtr
<MyMusicModel
> m_music_model
;
516 wxDataViewCtrl
* m_listCtrl
;
517 wxObjectDataPtr
<MyListModel
> m_list_model
;
519 wxDataViewColumn
* m_col
;
525 DECLARE_EVENT_TABLE()
528 // -------------------------------------
530 // -------------------------------------
534 bool MyApp::OnInit(void)
536 if ( !wxApp::OnInit() )
539 // build the first frame
541 new MyFrame(NULL
, wxT("wxDataViewCtrl feature test"), 40, 40, 800, 440);
554 // -------------------------------------
556 // -------------------------------------
561 ID_ABOUT
= wxID_ABOUT
,
567 ID_DELETE_MUSIC
= 101,
569 ID_PREPEND_LIST
= 200,
570 ID_DELETE_LIST
= 201,
574 BEGIN_EVENT_TABLE(MyFrame
, wxFrame
)
575 EVT_MENU( ID_ABOUT
, MyFrame::OnAbout
)
576 EVT_MENU( ID_EXIT
, MyFrame::OnQuit
)
577 EVT_BUTTON( ID_ADD_MOZART
, MyFrame::OnAddMozart
)
578 EVT_BUTTON( ID_DELETE_MUSIC
, MyFrame::OnDeleteMusic
)
579 EVT_BUTTON( ID_PREPEND_LIST
, MyFrame::OnPrependList
)
580 EVT_BUTTON( ID_DELETE_LIST
, MyFrame::OnDeleteList
)
581 EVT_BUTTON( ID_GOTO
, MyFrame::OnGoto
)
583 EVT_DATAVIEW_MODEL_ITEM_ADDED( ID_MUSIC_CTRL
, MyFrame::OnItemAdded
)
584 EVT_DATAVIEW_MODEL_ITEM_DELETED( ID_MUSIC_CTRL
, MyFrame::OnItemDeleted
)
585 EVT_DATAVIEW_MODEL_VALUE_CHANGED( ID_MUSIC_CTRL
, MyFrame::OnValueChanged
)
586 EVT_DATAVIEW_MODEL_ITEM_CHANGED( ID_MUSIC_CTRL
, MyFrame::OnValueChanged
)
588 EVT_DATAVIEW_ITEM_ACTIVATED(ID_MUSIC_CTRL
, MyFrame::OnActivated
)
589 EVT_DATAVIEW_ITEM_EXPANDING(ID_MUSIC_CTRL
, MyFrame::OnExpanding
)
590 EVT_DATAVIEW_ITEM_EXPANDED(ID_MUSIC_CTRL
, MyFrame::OnExpanded
)
591 EVT_DATAVIEW_ITEM_COLLAPSING(ID_MUSIC_CTRL
, MyFrame::OnCollapsing
)
592 EVT_DATAVIEW_ITEM_COLLAPSED(ID_MUSIC_CTRL
, MyFrame::OnCollapsed
)
593 EVT_DATAVIEW_ITEM_SELECTED(ID_MUSIC_CTRL
, MyFrame::OnSelected
)
595 EVT_DATAVIEW_ITEM_EDITING_STARTED(ID_MUSIC_CTRL
, MyFrame::OnEditingStarted
)
596 EVT_DATAVIEW_ITEM_EDITING_DONE(ID_MUSIC_CTRL
, MyFrame::OnEditingDone
)
599 EVT_DATAVIEW_COLUMN_HEADER_CLICK(ID_MUSIC_CTRL
, MyFrame::OnHeaderClick
)
600 EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED(ID_MUSIC_CTRL
, MyFrame::OnHeaderRightClick
)
601 EVT_DATAVIEW_COLUMN_SORTED(ID_MUSIC_CTRL
, MyFrame::OnSorted
)
603 EVT_RIGHT_UP(MyFrame::OnRightClick
)
606 MyFrame::MyFrame(wxFrame
*frame
, wxChar
*title
, int x
, int y
, int w
, int h
):
607 wxFrame(frame
, wxID_ANY
, title
, wxPoint(x
, y
), wxSize(w
, h
))
612 SetIcon(wxICON(sample
));
616 wxMenu
*file_menu
= new wxMenu
;
617 file_menu
->Append(ID_ABOUT
, "&About");
618 file_menu
->AppendSeparator();
619 file_menu
->Append(ID_EXIT
, "E&xit");
621 wxMenuBar
*menu_bar
= new wxMenuBar
;
622 menu_bar
->Append(file_menu
, "&File");
624 SetMenuBar(menu_bar
);
627 wxBoxSizer
*main_sizer
= new wxBoxSizer( wxVERTICAL
);
629 wxBoxSizer
*data_sizer
= new wxBoxSizer( wxHORIZONTAL
);
633 m_musicCtrl
= new wxDataViewCtrl( this, ID_MUSIC_CTRL
, wxDefaultPosition
,
634 wxDefaultSize
, wxDV_MULTIPLE
);
636 m_music_model
= new MyMusicModel
;
637 m_musicCtrl
->AssociateModel( m_music_model
.get() );
639 wxDataViewColumn
*col
= m_musicCtrl
->AppendTextColumn( "Title", 0, wxDATAVIEW_CELL_INERT
, 200,
640 DEFAULT_ALIGN
, wxDATAVIEW_COL_SORTABLE
);
642 // Call this and sorting is enabled
643 // immediatly upon start up.
644 col
->SetSortOrder( true );
647 m_musicCtrl
->AppendTextColumn( "Artist", 1, wxDATAVIEW_CELL_EDITABLE
, 150,
648 DEFAULT_ALIGN
, wxDATAVIEW_COL_SORTABLE
);
650 MySpinCtrlInPlaceRenderer
*sr
= new MySpinCtrlInPlaceRenderer
;
651 wxDataViewColumn
*column
= new wxDataViewColumn( "year", sr
, 2, -1, wxALIGN_CENTRE
, wxDATAVIEW_COL_SORTABLE
);
652 m_musicCtrl
->AppendColumn( column
);
654 data_sizer
->Add( m_musicCtrl
, 3, wxGROW
);
660 m_listCtrl
= new wxDataViewCtrl( this, wxID_ANY
, wxDefaultPosition
,
661 wxDefaultSize
, wxDV_MULTIPLE
);
663 m_list_model
= new MyListModel
;
664 m_listCtrl
->AssociateModel( m_list_model
.get() );
666 m_listCtrl
->AppendTextColumn( "editable string", 0, wxDATAVIEW_CELL_EDITABLE
, 120 );
667 m_col
= m_listCtrl
->AppendTextColumn( "index", 1, wxDATAVIEW_CELL_INERT
, 120 );
669 data_sizer
->Add( m_listCtrl
, 2, wxGROW
);
673 main_sizer
->Add( data_sizer
, 2, wxGROW
);
675 wxBoxSizer
*button_sizer
= new wxBoxSizer( wxHORIZONTAL
);
677 button_sizer
->Add( new wxButton( this, ID_ADD_MOZART
, "Add Mozart"), 0, wxALL
, 10 );
678 button_sizer
->Add( new wxButton( this, ID_DELETE_MUSIC
, "Delete selected"), 0, wxALL
, 10 );
679 button_sizer
->Add( 10, 10, 1 );
680 button_sizer
->Add( new wxButton( this, ID_PREPEND_LIST
, "Prepend"), 0, wxALL
, 10 );
681 button_sizer
->Add( new wxButton( this, ID_DELETE_LIST
, "Delete selected"), 0, wxALL
, 10 );
682 button_sizer
->Add( new wxButton( this, ID_GOTO
, "Goto 50"), 0, wxALL
, 10 );
684 main_sizer
->Add( button_sizer
, 0, wxGROW
, 0 );
686 m_log
= new wxTextCtrl( this, -1, "", wxDefaultPosition
, wxDefaultSize
, wxTE_MULTILINE
);
687 m_logOld
= wxLog::SetActiveTarget(new wxLogTextCtrl(m_log
));
688 wxLogMessage("This is the log window");
690 main_sizer
->Add( m_log
, 1, wxGROW
);
692 SetSizer( main_sizer
);
695 void MyFrame::OnQuit(wxCommandEvent
& WXUNUSED(event
) )
700 void MyFrame::OnAddMozart(wxCommandEvent
& WXUNUSED(event
) )
702 m_music_model
->AddToClassical( "Kleine Nachtmusik", "Wolfgang Mozart", 1787 );
705 void MyFrame::OnDeleteMusic(wxCommandEvent
& WXUNUSED(event
) )
707 wxDataViewItemArray items
;
708 int len
= m_musicCtrl
->GetSelections( items
);
709 for( int i
= 0; i
< len
; i
++ )
711 m_music_model
->Delete( items
[i
] );
714 void MyFrame::OnPrependList( wxCommandEvent
& WXUNUSED(event
) )
716 m_list_model
->Prepend( "Test" );
719 void MyFrame::OnDeleteList( wxCommandEvent
& WXUNUSED(event
) )
721 wxDataViewItemArray items
;
722 int len
= m_listCtrl
->GetSelections( items
);
723 for( int i
= 0; i
< len
; i
++ )
725 m_list_model
->DeleteItem( items
[i
] );
728 void MyFrame::OnItemAdded( wxDataViewEvent
&event
)
733 wxLogMessage("wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_ADDED, Item Id: %d",event
.GetItem().GetID());
736 void MyFrame::OnItemDeleted( wxDataViewEvent
&event
)
741 wxLogMessage( "EVT_DATAVIEW_MODEL_ITEM_DELETED, Item Id: %d", event
.GetItem().GetID() );
744 void MyFrame::OnValueChanged( wxDataViewEvent
&event
)
749 wxLogMessage( "EVT_DATAVIEW_MODEL_VALUE_CHANGED, Item Id: %d; Column: %d", event
.GetItem().GetID(), event
.GetColumn() );
752 void MyFrame::OnActivated( wxDataViewEvent
&event
)
757 wxLogMessage("wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, Item Id: %d; Column: %d", event
.GetItem().GetID(), event
.GetColumn());
760 void MyFrame::OnSelected( wxDataViewEvent
&event
)
765 wxLogMessage("wxEVT_COMMAND_DATAVIEW_ITEM_SELECTED, Item Id: %d", event
.GetItem().GetID() );
768 void MyFrame::OnExpanding( wxDataViewEvent
&event
)
773 wxLogMessage("wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING, Item Id: %d", event
.GetItem().GetID() );
777 void MyFrame::OnEditingStarted( wxDataViewEvent
&event
)
782 wxLogMessage("wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED, Item Id: %d", event
.GetItem().GetID() );
785 void MyFrame::OnEditingDone( wxDataViewEvent
&event
)
790 wxLogMessage("wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE, Item Id: %d", event
.GetItem().GetID() );
793 void MyFrame::OnExpanded( wxDataViewEvent
&event
)
798 wxLogMessage("wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED, Item Id: %d", event
.GetItem().GetID() );
801 void MyFrame::OnCollapsing( wxDataViewEvent
&event
)
806 wxLogMessage("wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING, Item Id: %d", event
.GetItem().GetID() );
809 void MyFrame::OnCollapsed( wxDataViewEvent
&event
)
814 wxLogMessage("wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED, Item Id: %d", event
.GetItem().GetID() );
817 void MyFrame::OnHeaderClick( wxDataViewEvent
&event
)
822 wxLogMessage("wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK, Column: %d", event
.GetColumn());
825 void MyFrame::OnHeaderRightClick( wxDataViewEvent
&event
)
830 wxLogMessage("wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK, Column: %d", event
.GetColumn());
833 void MyFrame::OnSorted( wxDataViewEvent
&event
)
838 wxLogMessage("wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED, Column: %d", event
.GetColumn());
841 void MyFrame::OnRightClick( wxMouseEvent
&event
)
846 wxLogMessage("wxEVT_MOUSE_RIGHT_UP, Click Point is X: %d, Y: %d", event
.GetX(), event
.GetY());
849 void MyFrame::OnGoto( wxCommandEvent
&event
)
851 wxDataViewItem item
= m_list_model
->GetItem( 50 );
852 m_listCtrl
->EnsureVisible(item
,m_col
);
855 void MyFrame::OnAbout(wxCommandEvent
& WXUNUSED(event
) )
857 wxAboutDialogInfo info
;
858 info
.SetName(_("DataView sample"));
859 info
.SetDescription(_("This sample demonstrates the dataview control handling"));
860 info
.SetCopyright(_T("(C) 2007 Robert Roebling"));