+int wxDataViewCtrl::GetSelections( wxDataViewItemArray & sel ) const
+{
+ sel.Clear();
+
+ GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW(m_treeview) );
+ if (HasFlag(wxDV_MULTIPLE))
+ {
+ GtkTreeModel *model;
+ GList *list = gtk_tree_selection_get_selected_rows( selection, &model );
+
+ int count = 0;
+ while (list)
+ {
+ GtkTreePath *path = (GtkTreePath*) list->data;
+
+ GtkTreeIter iter;
+ m_internal->get_iter( &iter, path );
+
+ sel.Add( wxDataViewItem( (void*) iter.user_data ) );
+
+ list = g_list_next( list );
+ count++;
+ }
+
+ // delete list
+ g_list_foreach( list, (GFunc) gtk_tree_path_free, NULL );
+ g_list_free( list );
+
+ return count;
+ }
+ else
+ {
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gboolean has_selection = gtk_tree_selection_get_selected( selection, &model, &iter );
+ if (has_selection)
+ {
+ sel.Add( wxDataViewItem( (void*) iter.user_data) );
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+void wxDataViewCtrl::SetSelections( const wxDataViewItemArray & sel )
+{
+ GtkDisableSelectionEvents();
+
+ GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW(m_treeview) );
+
+ gtk_tree_selection_unselect_all( selection );
+
+ size_t i;
+ for (i = 0; i < sel.GetCount(); i++)
+ {
+ GtkTreeIter iter;
+ iter.user_data = (gpointer) sel[i].GetID();
+ gtk_tree_selection_select_iter( selection, &iter );
+ }
+
+ GtkEnableSelectionEvents();
+}
+
+void wxDataViewCtrl::Select( const wxDataViewItem & item )
+{
+ GtkDisableSelectionEvents();
+
+ GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW(m_treeview) );
+
+ GtkTreeIter iter;
+ iter.user_data = (gpointer) item.GetID();
+ gtk_tree_selection_select_iter( selection, &iter );
+
+ GtkEnableSelectionEvents();
+}
+
+void wxDataViewCtrl::Unselect( const wxDataViewItem & item )
+{
+ GtkDisableSelectionEvents();
+
+ GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW(m_treeview) );
+
+ GtkTreeIter iter;
+ iter.user_data = (gpointer) item.GetID();
+ gtk_tree_selection_unselect_iter( selection, &iter );
+
+ GtkEnableSelectionEvents();
+}
+
+bool wxDataViewCtrl::IsSelected( const wxDataViewItem & item ) const
+{
+ GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW(m_treeview) );
+
+ GtkTreeIter iter;
+ iter.user_data = (gpointer) item.GetID();
+
+ return gtk_tree_selection_iter_is_selected( selection, &iter );
+}
+
+void wxDataViewCtrl::SelectAll()
+{
+ GtkDisableSelectionEvents();
+
+ GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW(m_treeview) );
+
+ gtk_tree_selection_select_all( selection );
+
+ GtkEnableSelectionEvents();
+}
+
+void wxDataViewCtrl::UnselectAll()
+{
+ GtkDisableSelectionEvents();
+
+ GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW(m_treeview) );
+
+ gtk_tree_selection_unselect_all( selection );
+
+ GtkEnableSelectionEvents();
+}
+
+void wxDataViewCtrl::EnsureVisible( const wxDataViewItem & item, const wxDataViewColumn *column )
+{
+ GtkTreeIter iter;
+ iter.user_data = (gpointer) item.GetID();
+ GtkTreePath *path = m_internal->get_path( &iter );
+ gtk_tree_view_scroll_to_cell( GTK_TREE_VIEW(m_treeview), path, NULL, false, 0.0, 0.0 );
+ gtk_tree_path_free( path );
+}
+
+void wxDataViewCtrl::HitTest( const wxPoint &point,
+ wxDataViewItem &item, wxDataViewColumn *&column ) const
+{
+ item = wxDataViewItem(0);
+ column = NULL;
+}
+
+wxRect wxDataViewCtrl::GetItemRect( const wxDataViewItem &item,
+ const wxDataViewColumn *column ) const
+{
+ return wxRect();
+}
+