X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0cc1991e2a3ae8df8f716d5a9bf1a59e2a17d0b3..fdfa35b4d7a5f1564fc29c79e3090f50572b1f96:/samples/dataview/dataview.cpp diff --git a/samples/dataview/dataview.cpp b/samples/dataview/dataview.cpp index f3c8bb2074..df816643c9 100644 --- a/samples/dataview/dataview.cpp +++ b/samples/dataview/dataview.cpp @@ -189,22 +189,18 @@ public: return true; } - virtual bool Activate( const wxRect& WXUNUSED(cell), - wxDataViewModel *WXUNUSED(model), - const wxDataViewItem &WXUNUSED(item), - unsigned int WXUNUSED(col) ) + virtual bool ActivateCell(const wxRect& WXUNUSED(cell), + wxDataViewModel *WXUNUSED(model), + const wxDataViewItem &WXUNUSED(item), + unsigned int WXUNUSED(col), + const wxMouseEvent *mouseEvent) { - wxLogMessage( "MyCustomRenderer Activate()" ); - return false; - } - - virtual bool LeftClick(const wxPoint& cursor, - const wxRect& WXUNUSED(cell), - wxDataViewModel *WXUNUSED(model), - const wxDataViewItem &WXUNUSED(item), - unsigned int WXUNUSED(col) ) - { - wxLogMessage( "MyCustomRenderer LeftClick( %d, %d )", cursor.x, cursor.y ); + wxString position; + if ( mouseEvent ) + position = wxString::Format("via mouse at %d, %d", mouseEvent->m_x, mouseEvent->m_y); + else + position = "from keyboard"; + wxLogMessage("MyCustomRenderer ActivateCell() %s", position); return false; } @@ -684,7 +680,7 @@ void MyFrame::BuildDataViewCtrl(wxPanel* parent, unsigned int nPanel, unsigned l wxImageList *ilist = new wxImageList( 16, 16 ); ilist->Add( wxIcon(wx_small_xpm) ); - tc->SetImageList( ilist ); + tc->AssignImageList( ilist ); wxDataViewItem parent = tc->AppendContainer( wxDataViewItem(0), "The Root", 0 ); @@ -947,6 +943,17 @@ void MyFrame::OnShowCurrent(wxCommandEvent& WXUNUSED(event)) { wxLogMessage("There is no current item."); } + + wxDataViewColumn *col = m_ctrl[0]->GetCurrentColumn(); + if ( col ) + { + wxLogMessage("Current column: %d", + m_ctrl[0]->GetColumnPosition(col)); + } + else + { + wxLogMessage("There is no current column."); + } } void MyFrame::OnSetNinthCurrent(wxCommandEvent& WXUNUSED(event))