X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/739a839903d6017270e085b7308eda71934efa64..9b66a1d31a32e9235792261db6ff755ce26ab5c1:/src/gtk/dataview.cpp diff --git a/src/gtk/dataview.cpp b/src/gtk/dataview.cpp index 75849f7fab..297f496801 100644 --- a/src/gtk/dataview.cpp +++ b/src/gtk/dataview.cpp @@ -4018,8 +4018,10 @@ bool wxDataViewCtrl::IsExpanded( const wxDataViewItem & item ) const GtkTreeIter iter; iter.user_data = item.GetID(); GtkTreePath *path = m_internal->get_path( &iter ); - gtk_tree_view_row_expanded( GTK_TREE_VIEW(m_treeview), path ); + bool res = gtk_tree_view_row_expanded( GTK_TREE_VIEW(m_treeview), path ); gtk_tree_path_free( path ); + + return res; } wxDataViewItem wxDataViewCtrl::GetSelection() const @@ -4111,12 +4113,23 @@ void wxDataViewCtrl::SetSelections( const wxDataViewItemArray & sel ) gtk_tree_selection_unselect_all( selection ); + wxDataViewItem last_parent; + size_t i; for (i = 0; i < sel.GetCount(); i++) { + wxDataViewItem item = sel[i]; + wxDataViewItem parent = GetModel()->GetParent( item ); + if (parent) + { + if (parent != last_parent) + ExpandAncestors(item); + } + last_parent = parent; + GtkTreeIter iter; iter.stamp = m_internal->GetGtkModel()->stamp; - iter.user_data = (gpointer) sel[i].GetID(); + iter.user_data = (gpointer) item.GetID(); gtk_tree_selection_select_iter( selection, &iter ); } @@ -4125,6 +4138,8 @@ void wxDataViewCtrl::SetSelections( const wxDataViewItemArray & sel ) void wxDataViewCtrl::Select( const wxDataViewItem & item ) { + ExpandAncestors(item); + GtkDisableSelectionEvents(); GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW(m_treeview) ); @@ -4187,6 +4202,8 @@ void wxDataViewCtrl::UnselectAll() void wxDataViewCtrl::EnsureVisible(const wxDataViewItem& item, const wxDataViewColumn *WXUNUSED(column)) { + ExpandAncestors(item); + GtkTreeIter iter; iter.user_data = (gpointer) item.GetID(); GtkTreePath *path = m_internal->get_path( &iter );