Notify GtkTreeView if a node stops being a parent.
GtkTreeView requires the row-has-child-toggled signal to be emitted in this situation, so do it from ItemDeleted handler. Curiously, it handles adding the first child automatically. That's good, because detecting this situation when adding the first child wouldn't be trivial and so not having to do it is a plus. (Emitting it on every node addition doesn't sound like a terribly bright idea.) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68915 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
d0cfefc4e0
commit
15d1fd3f6f
@ -1588,12 +1588,14 @@ bool wxGtkDataViewModelNotifier::ItemDeleted( const wxDataViewItem &parent, cons
|
||||
GTK_TREE_MODEL(wxgtk_model), &iter ));
|
||||
#else
|
||||
// so get the path from the parent
|
||||
GtkTreeIter iter;
|
||||
iter.stamp = wxgtk_model->stamp;
|
||||
iter.user_data = (gpointer) parent.GetID();
|
||||
wxGtkTreePath path(wxgtk_tree_model_get_path(
|
||||
GTK_TREE_MODEL(wxgtk_model), &iter ));
|
||||
GtkTreeIter parentIter;
|
||||
parentIter.stamp = wxgtk_model->stamp;
|
||||
parentIter.user_data = (gpointer) parent.GetID();
|
||||
wxGtkTreePath parentPath(wxgtk_tree_model_get_path(
|
||||
GTK_TREE_MODEL(wxgtk_model), &parentIter ));
|
||||
|
||||
// and add the final index ourselves
|
||||
wxGtkTreePath path(gtk_tree_path_copy(parentPath));
|
||||
int index = m_internal->GetIndexOf( parent, item );
|
||||
gtk_tree_path_append_index( path, index );
|
||||
#endif
|
||||
@ -1603,6 +1605,17 @@ bool wxGtkDataViewModelNotifier::ItemDeleted( const wxDataViewItem &parent, cons
|
||||
|
||||
m_internal->ItemDeleted( parent, item );
|
||||
|
||||
// Did we remove the last child, causing 'parent' to become a leaf?
|
||||
if ( !m_wx_model->IsContainer(parent) )
|
||||
{
|
||||
gtk_tree_model_row_has_child_toggled
|
||||
(
|
||||
GTK_TREE_MODEL(wxgtk_model),
|
||||
parentPath,
|
||||
&parentIter
|
||||
);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user