diff --git a/include/wx/dataview.h b/include/wx/dataview.h index 1c5f4d0b97..46cb8ae57f 100644 --- a/include/wx/dataview.h +++ b/include/wx/dataview.h @@ -111,7 +111,7 @@ public: // delegated notifiers virtual bool ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item ); - virtual bool ItemDeleted( const wxDataViewItem &item ); + virtual bool ItemDeleted( const wxDataViewItem &parent, const wxDataViewItem &item ); virtual bool ItemChanged( const wxDataViewItem &item ); virtual bool ValueChanged( const wxDataViewItem &item, unsigned int col ); virtual bool Cleared(); @@ -204,7 +204,7 @@ public: virtual ~wxDataViewModelNotifier() { m_owner = NULL; } virtual bool ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item ) = 0; - virtual bool ItemDeleted( const wxDataViewItem &item ) = 0; + virtual bool ItemDeleted( const wxDataViewItem &parent, const wxDataViewItem &item ) = 0; virtual bool ItemChanged( const wxDataViewItem &item ) = 0; virtual bool ValueChanged( const wxDataViewItem &item, unsigned int col ) = 0; virtual bool Cleared() = 0; diff --git a/samples/dataview/dataview.cpp b/samples/dataview/dataview.cpp index 7d958749da..9410e43128 100644 --- a/samples/dataview/dataview.cpp +++ b/samples/dataview/dataview.cpp @@ -577,7 +577,7 @@ void MyFrame::OnDeleteMusic(wxCommandEvent& WXUNUSED(event) ) { wxDataViewItem item = m_musicCtrl->GetSelection(); if (item.IsOk()) - m_music_model->Delete( item ); + m_music_model->Delete( m_music_model->GetParent(item), item ); } void MyFrame::OnPrependList( wxCommandEvent& WXUNUSED(event) ) @@ -589,7 +589,7 @@ void MyFrame::OnDeleteList( wxCommandEvent& WXUNUSED(event) ) { wxDataViewItem item = m_listCtrl->GetSelection(); if (item.IsOk()) - m_list_model->DeleteItem( item ); + m_list_model->DeleteItem( m_list_model->GetParent(item), item ); } void MyFrame::OnItemAdded( wxDataViewEvent &event ) diff --git a/src/common/datavcmn.cpp b/src/common/datavcmn.cpp index 89d8f183d5..87cdf764b2 100644 --- a/src/common/datavcmn.cpp +++ b/src/common/datavcmn.cpp @@ -59,7 +59,7 @@ bool wxDataViewModel::ItemAdded( const wxDataViewItem &parent, const wxDataViewI return ret; } -bool wxDataViewModel::ItemDeleted( const wxDataViewItem &item ) +bool wxDataViewModel::ItemDeleted( const wxDataViewItem &parent, const wxDataViewItem &item ) { bool ret = true; @@ -67,7 +67,7 @@ bool wxDataViewModel::ItemDeleted( const wxDataViewItem &item ) while (node) { wxDataViewModelNotifier* notifier = (wxDataViewModelNotifier*) node->GetData(); - if (!notifier->ItemDeleted( item )) + if (!notifier->ItemDeleted( parent, item )) ret = false; node = node->GetNext(); } @@ -250,7 +250,7 @@ void wxDataViewIndexListModel::RowDeleted( unsigned int row ) { wxDataViewItem item( m_hash[row] ); m_hash.RemoveAt( row ); - wxDataViewModel::ItemDeleted( item ); + wxDataViewModel::ItemDeleted( wxDataViewItem(0), item ); } void wxDataViewIndexListModel::RowChanged( unsigned int row ) diff --git a/src/gtk/dataview.cpp b/src/gtk/dataview.cpp index ccc38ed825..bcca3889c3 100644 --- a/src/gtk/dataview.cpp +++ b/src/gtk/dataview.cpp @@ -79,7 +79,7 @@ public: GtkWxTreeModel* GetGtkModel() { return m_gtk_model; } bool ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item ); - bool ItemDeleted( const wxDataViewItem &item ); + bool ItemDeleted( const wxDataViewItem &parent, const wxDataViewItem &item ); bool ItemChanged( const wxDataViewItem &item ); bool ValueChanged( const wxDataViewItem &item, unsigned int col ); bool Cleared(); @@ -1022,7 +1022,7 @@ public: ~wxGtkDataViewModelNotifier(); virtual bool ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item ); - virtual bool ItemDeleted( const wxDataViewItem &item ); + virtual bool ItemDeleted( const wxDataViewItem &parent, const wxDataViewItem &item ); virtual bool ItemChanged( const wxDataViewItem &item ); virtual bool ValueChanged( const wxDataViewItem &item, unsigned int col ); virtual bool Cleared(); @@ -1069,7 +1069,7 @@ bool wxGtkDataViewModelNotifier::ItemAdded( const wxDataViewItem &parent, const return true; } -bool wxGtkDataViewModelNotifier::ItemDeleted( const wxDataViewItem &item ) +bool wxGtkDataViewModelNotifier::ItemDeleted( const wxDataViewItem &parent, const wxDataViewItem &item ) { GtkTreeIter iter; iter.stamp = m_wxgtk_model->stamp; @@ -1081,7 +1081,7 @@ bool wxGtkDataViewModelNotifier::ItemDeleted( const wxDataViewItem &item ) GTK_TREE_MODEL(m_wxgtk_model), path ); gtk_tree_path_free (path); - m_owner->GtkGetInternal()->ItemDeleted( item ); + m_owner->GtkGetInternal()->ItemDeleted( parent, item ); return true; } @@ -2296,9 +2296,9 @@ bool wxDataViewCtrlInternal::ItemAdded( const wxDataViewItem &parent, const wxDa return true; } -bool wxDataViewCtrlInternal::ItemDeleted( const wxDataViewItem &item ) +bool wxDataViewCtrlInternal::ItemDeleted( const wxDataViewItem &parent, const wxDataViewItem &item ) { - wxGtkTreeModelNode *parent = FindParentNode( item ); + wxGtkTreeModelNode *parent = FindNode( parent ); parent->DeleteChild( item.GetID() ); wxDataViewEvent event( wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_DELETED, m_owner->GetId() ); @@ -2753,7 +2753,6 @@ void gtk_dataviewctrl_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation *alloc, wxDataViewCtrl *win ) { - wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst(); while (node) {