Implement vetoing editing in wxDataViewTextRenderer under GTK+ and test it in the sample (see also #10495)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59457 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -98,6 +98,7 @@ public: // event handlers
|
||||
void OnCollapsed( wxDataViewEvent &event );
|
||||
void OnSelectionChanged( wxDataViewEvent &event );
|
||||
|
||||
void OnStartEditing( wxDataViewEvent &event );
|
||||
void OnEditingStarted( wxDataViewEvent &event );
|
||||
void OnEditingDone( wxDataViewEvent &event );
|
||||
|
||||
@@ -287,6 +288,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_DATAVIEW_ITEM_COLLAPSED(ID_MUSIC_CTRL, MyFrame::OnCollapsed)
|
||||
EVT_DATAVIEW_SELECTION_CHANGED(ID_MUSIC_CTRL, MyFrame::OnSelectionChanged)
|
||||
|
||||
EVT_DATAVIEW_ITEM_START_EDITING(ID_MUSIC_CTRL, MyFrame::OnStartEditing)
|
||||
EVT_DATAVIEW_ITEM_EDITING_STARTED(ID_MUSIC_CTRL, MyFrame::OnEditingStarted)
|
||||
EVT_DATAVIEW_ITEM_EDITING_DONE(ID_MUSIC_CTRL, MyFrame::OnEditingDone)
|
||||
|
||||
@@ -433,7 +435,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString &title, int x, int y, int w, int
|
||||
|
||||
mainSizer->Add( m_notebook, 1, wxGROW );
|
||||
mainSizer->Add( m_log, 0, wxGROW );
|
||||
|
||||
|
||||
SetSizerAndFit(mainSizer);
|
||||
}
|
||||
|
||||
@@ -842,6 +844,20 @@ void MyFrame::OnExpanding( wxDataViewEvent &event )
|
||||
}
|
||||
|
||||
|
||||
void MyFrame::OnStartEditing( wxDataViewEvent &event )
|
||||
{
|
||||
wxString artist = m_music_model->GetArtist( event.GetItem() );
|
||||
if (artist == "Ludwig van Beethoven")
|
||||
{
|
||||
event.Veto();
|
||||
|
||||
if (!m_log)
|
||||
return;
|
||||
|
||||
wxLogMessage( "wxEVT_COMMAND_DATAVIEW_ITEM_START_EDITING vetoed, Item: %s", artist );
|
||||
}
|
||||
}
|
||||
|
||||
void MyFrame::OnEditingStarted( wxDataViewEvent &event )
|
||||
{
|
||||
if (!m_log)
|
||||
|
Reference in New Issue
Block a user