+int wxDataViewCtrl::GetColumnPosition( const wxDataViewColumn *column ) const
+{
+ GtkTreeViewColumn *gtk_column = GTK_TREE_VIEW_COLUMN(column->GetGtkHandle());
+
+ wxGtkList list(gtk_tree_view_get_columns(GTK_TREE_VIEW(m_treeview)));
+
+ return g_list_index( list, (gconstpointer) gtk_column );
+}
+
+wxDataViewColumn *wxDataViewCtrl::GetSortingColumn() const
+{
+ return m_internal->GetDataViewSortColumn();
+}
+
+void wxDataViewCtrl::Expand( const wxDataViewItem & item )
+{
+ GtkTreeIter iter;
+ iter.user_data = item.GetID();
+ wxGtkTreePath path(m_internal->get_path( &iter ));
+ gtk_tree_view_expand_row( GTK_TREE_VIEW(m_treeview), path, false );
+}
+
+void wxDataViewCtrl::Collapse( const wxDataViewItem & item )
+{
+ GtkTreeIter iter;
+ iter.user_data = item.GetID();
+ wxGtkTreePath path(m_internal->get_path( &iter ));
+ gtk_tree_view_collapse_row( GTK_TREE_VIEW(m_treeview), path );
+}
+
+bool wxDataViewCtrl::IsExpanded( const wxDataViewItem & item ) const
+{
+ GtkTreeIter iter;
+ iter.user_data = item.GetID();
+ wxGtkTreePath path(m_internal->get_path( &iter ));
+ return gtk_tree_view_row_expanded( GTK_TREE_VIEW(m_treeview), path ) != 0;
+}
+
+wxDataViewItem wxDataViewCtrl::DoGetCurrentItem() const
+{
+ // The tree doesn't have any current item if it hadn't been created yet but
+ // it's arguably not an error to call this function in this case so just
+ // return an invalid item without asserting.
+ if ( !m_treeview )
+ return wxDataViewItem();
+
+ wxGtkTreePath path;
+ gtk_tree_view_get_cursor(GTK_TREE_VIEW(m_treeview), path.ByRef(), NULL);
+
+ return GTKPathToItem(path);
+}
+
+void wxDataViewCtrl::DoSetCurrentItem(const wxDataViewItem& item)
+{
+ wxCHECK_RET( m_treeview,
+ "Current item can't be set before creating the control." );
+
+ // We need to make sure the model knows about this item or the path would
+ // be invalid and gtk_tree_view_set_cursor() would silently do nothing.
+ ExpandAncestors(item);
+
+ // We also need to preserve the existing selection from changing.
+ // Unfortunately the only way to do it seems to use our own selection
+ // function and forbid any selection changes during set cursor call.
+ wxGtkTreeSelectionLock
+ lock(gtk_tree_view_get_selection(GTK_TREE_VIEW(m_treeview)));
+
+ // Do move the cursor now.
+ GtkTreeIter iter;
+ iter.user_data = item.GetID();
+ wxGtkTreePath path(m_internal->get_path( &iter ));
+
+ gtk_tree_view_set_cursor(GTK_TREE_VIEW(m_treeview), path, NULL, FALSE);
+}
+
+wxDataViewColumn *wxDataViewCtrl::GetCurrentColumn() const
+{
+ // The tree doesn't have any current item if it hadn't been created yet but
+ // it's arguably not an error to call this function in this case so just
+ // return NULL without asserting.
+ if ( !m_treeview )
+ return NULL;
+
+ GtkTreeViewColumn *col;
+ gtk_tree_view_get_cursor(GTK_TREE_VIEW(m_treeview), NULL, &col);
+ return FromGTKColumn(col);
+}
+
+void wxDataViewCtrl::EditItem(const wxDataViewItem& item, const wxDataViewColumn *column)
+{
+ wxCHECK_RET( m_treeview,
+ "Current item can't be set before creating the control." );
+ wxCHECK_RET( item.IsOk(), "invalid item" );
+ wxCHECK_RET( column, "no column provided" );
+
+ // We need to make sure the model knows about this item or the path would
+ // be invalid and gtk_tree_view_set_cursor() would silently do nothing.
+ ExpandAncestors(item);
+
+ GtkTreeViewColumn *gcolumn = GTK_TREE_VIEW_COLUMN(column->GetGtkHandle());
+
+ // We also need to preserve the existing selection from changing.
+ // Unfortunately the only way to do it seems to use our own selection
+ // function and forbid any selection changes during set cursor call.
+ wxGtkTreeSelectionLock
+ lock(gtk_tree_view_get_selection(GTK_TREE_VIEW(m_treeview)));
+
+ // Do move the cursor now.
+ GtkTreeIter iter;
+ iter.user_data = item.GetID();
+ wxGtkTreePath path(m_internal->get_path( &iter ));
+
+ gtk_tree_view_set_cursor(GTK_TREE_VIEW(m_treeview), path, gcolumn, TRUE);
+}
+
+int wxDataViewCtrl::GetSelectedItemsCount() const