]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/dataview.cpp
fix compilation in wxUSE_MENUS==0 case
[wxWidgets.git] / src / gtk / dataview.cpp
index cc2dd4f4a7d621cde463560ddb8d7474578391be..448d7a762b51a8782bcc81c496340e33b1c15a35 100644 (file)
@@ -480,6 +480,15 @@ static gboolean gtk_wx_cell_renderer_activate(
                         GdkRectangle            *background_area,
                         GdkRectangle            *cell_area,
                         GtkCellRendererState     flags );
+static GtkCellEditable *gtk_wx_cell_renderer_start_editing(
+                        GtkCellRenderer         *cell,
+                        GdkEvent                *event,
+                        GtkWidget               *widget,
+                        const gchar             *path,
+                        GdkRectangle            *background_area,
+                        GdkRectangle            *cell_area,
+                        GtkCellRendererState     flags );
+
 
 static GObjectClass *cell_parent_class = NULL;
 
@@ -532,6 +541,7 @@ gtk_wx_cell_renderer_class_init (GtkWxCellRendererClass *klass)
     cell_class->get_size = gtk_wx_cell_renderer_get_size;
     cell_class->render = gtk_wx_cell_renderer_render;
     cell_class->activate = gtk_wx_cell_renderer_activate;
+    cell_class->start_editing = gtk_wx_cell_renderer_start_editing;
 }
 
 static void
@@ -547,6 +557,48 @@ gtk_wx_cell_renderer_new (void)
     return (GtkCellRenderer*) g_object_new (GTK_TYPE_WX_CELL_RENDERER, NULL);
 }
 
+
+
+static GtkCellEditable *gtk_wx_cell_renderer_start_editing(
+                        GtkCellRenderer         *renderer,
+                        GdkEvent                *event,
+                        GtkWidget               *widget,
+                        const gchar             *path,
+                        GdkRectangle            *background_area,
+                        GdkRectangle            *cell_area,
+                        GtkCellRendererState     flags )
+{
+    GtkWxCellRenderer *wxrenderer = (GtkWxCellRenderer *) renderer;
+    wxDataViewCustomRenderer *cell = wxrenderer->cell;
+    if (!cell->HasEditorCtrl())
+        return NULL;
+
+    GdkRectangle rect;
+    gtk_wx_cell_renderer_get_size (renderer, widget, cell_area,
+                                   &rect.x,
+                                   &rect.y,
+                                   &rect.width,
+                                   &rect.height);
+
+    rect.x += cell_area->x;
+    rect.y += cell_area->y;
+//    rect.width  -= renderer->xpad * 2;
+//    rect.height -= renderer->ypad * 2;
+
+//    wxRect renderrect( rect.x, rect.y, rect.width, rect.height );
+    wxRect renderrect( cell_area->x, cell_area->y, cell_area->width, cell_area->height );
+
+    wxDataViewListModel *model = cell->GetOwner()->GetOwner()->GetModel();
+
+    GtkTreePath *treepath = gtk_tree_path_new_from_string( path );
+    unsigned int model_row = (unsigned int)gtk_tree_path_get_indices (treepath)[0];
+    gtk_tree_path_free( treepath );
+
+    cell->StartEditing( model_row, renderrect );
+
+    return NULL;
+}
+
 static void
 gtk_wx_cell_renderer_get_size (GtkCellRenderer *renderer,
                                GtkWidget       *widget,
@@ -678,7 +730,17 @@ gtk_wx_cell_renderer_activate(
 
     unsigned int model_col = cell->GetOwner()->GetModelColumn();
 
-    if (event->type == GDK_BUTTON_PRESS)
+    if (!event)
+    {
+        bool ret = false;
+
+        // activated by <ENTER>
+        if (cell->Activate( renderrect, model, model_col, model_row ))
+                    ret = true;
+
+        return ret;
+    }
+    else if (event->type == GDK_BUTTON_PRESS)
     {
         GdkEventButton *button_event = (GdkEventButton*) event;
         wxPoint pt( ((int) button_event->x) - renderrect.x,
@@ -716,6 +778,7 @@ class wxGtkDataViewListModelNotifier: public wxDataViewListModelNotifier
 {
 public:
     wxGtkDataViewListModelNotifier( GtkWxListStore* gtk_store, wxDataViewListModel *wx_model );
+    ~wxGtkDataViewListModelNotifier();
 
     virtual bool RowAppended();
     virtual bool RowPrepended();
@@ -726,13 +789,6 @@ public:
     virtual bool RowsReordered( unsigned int *new_order );
     virtual bool Cleared();
 
-    virtual bool Freed()
-    {
-        m_wx_model = NULL;
-        m_gtk_store = NULL;
-        return wxDataViewListModelNotifier::Freed();
-    }
-
     GtkWxListStore      *m_gtk_store;
     wxDataViewListModel *m_wx_model;
 };
@@ -748,6 +804,12 @@ wxGtkDataViewListModelNotifier::wxGtkDataViewListModelNotifier(
     m_wx_model = wx_model;
 }
 
+wxGtkDataViewListModelNotifier::~wxGtkDataViewListModelNotifier()
+{
+    m_wx_model = NULL;
+    m_gtk_store = NULL;
+}
+
 bool wxGtkDataViewListModelNotifier::RowAppended()
 {
     unsigned int pos = m_wx_model->GetRowCount()-1;
@@ -817,7 +879,8 @@ bool wxGtkDataViewListModelNotifier::RowChanged( unsigned int row )
 bool wxGtkDataViewListModelNotifier::ValueChanged( unsigned int model_col, unsigned int model_row )
 {
     // This adds GTK+'s missing MVC logic for ValueChanged
-    wxNode *node = GetOwner()->m_viewingColumns.GetFirst();
+    wxObjectList::compatibility_iterator
+        node = GetOwner()->m_viewingColumns.GetFirst();
     while (node)
     {
         wxDataViewViewingColumn* viewing_column = (wxDataViewViewingColumn*) node->GetData();
@@ -833,10 +896,14 @@ bool wxGtkDataViewListModelNotifier::ValueChanged( unsigned int model_col, unsig
             gtk_tree_view_get_cell_area( widget, path, column, &cell_area );
             gtk_tree_path_free( path );
 
+            GtkAdjustment* hadjust = gtk_tree_view_get_hadjustment( widget );
+            double d = gtk_adjustment_get_value( hadjust );
+            int xdiff = (int) d;
+
             int ydiff = column->button->allocation.height;
             // Redraw
             gtk_widget_queue_draw_area( GTK_WIDGET(widget),
-                cell_area.x, ydiff + cell_area.y, cell_area.width, cell_area.height );
+                cell_area.x - xdiff, ydiff + cell_area.y, cell_area.width, cell_area.height );
         }
 
         node = node->GetNext();
@@ -854,7 +921,8 @@ bool wxGtkDataViewListModelNotifier::RowsReordered( unsigned int *new_order )
     gtk_tree_path_free (path);
 
     // This adds GTK+'s missing MVC logic for RowsReordered
-    wxNode *node = GetOwner()->m_viewingColumns.GetFirst();
+    wxObjectList::compatibility_iterator
+        node = GetOwner()->m_viewingColumns.GetFirst();
     while (node)
     {
         wxDataViewViewingColumn* viewing_column = (wxDataViewViewingColumn*) node->GetData();
@@ -1017,7 +1085,7 @@ static void wxGtkTextRendererEditedCallback( GtkCellRendererText *renderer,
 {
     wxDataViewTextRenderer *cell = (wxDataViewTextRenderer*) user_data;
 
-    wxString tmp = wxGTK_CONV_BACK( arg2 );
+    wxString tmp = wxGTK_CONV_BACK_FONT(arg2, cell->GetOwner()->GetOwner()->GetFont());
     wxVariant value = tmp;
     if (!cell->Validate( value ))
         return;
@@ -1075,7 +1143,8 @@ bool wxDataViewTextRenderer::GetValue( wxVariant &value ) const
     GValue gvalue = { 0, };
     g_value_init( &gvalue, G_TYPE_STRING );
     g_object_get_property( G_OBJECT(m_renderer), "text", &gvalue );
-    wxString tmp = wxGTK_CONV_BACK( g_value_get_string( &gvalue ) );
+    wxString tmp = wxGTK_CONV_BACK_FONT( g_value_get_string( &gvalue ),
+        wx_const_cast(wxDataViewTextRenderer*, this)->GetOwner()->GetOwner()->GetFont() );
     g_value_unset( &gvalue );
 
     value = tmp;
@@ -1087,8 +1156,10 @@ void wxDataViewTextRenderer::SetAlignment( int align )
 {
     wxDataViewRenderer::SetAlignment(align);
 
-    // horizontal alignment:
+    if (gtk_check_version(2,10,0))
+        return;
 
+    // horizontal alignment:
     PangoAlignment pangoAlign = PANGO_ALIGN_LEFT;
     if (align & wxALIGN_RIGHT)
         pangoAlign = PANGO_ALIGN_RIGHT;
@@ -1102,9 +1173,9 @@ void wxDataViewTextRenderer::SetAlignment( int align )
     g_value_unset( &gvalue );
 }
 
-// --------------------------------------------------------- 
+// ---------------------------------------------------------
 // wxDataViewBitmapRenderer
-// --------------------------------------------------------- 
+// ---------------------------------------------------------
 
 IMPLEMENT_CLASS(wxDataViewBitmapRenderer, wxDataViewRenderer)
 
@@ -1124,38 +1195,38 @@ bool wxDataViewBitmapRenderer::SetValue( const wxVariant &value )
     {
         wxBitmap bitmap;
         bitmap << value;
-        
+
         // This may create a Pixbuf representation in the
         // wxBitmap object (and it will stay there)
         GdkPixbuf *pixbuf = bitmap.GetPixbuf();
-        
+
         GValue gvalue = { 0, };
         g_value_init( &gvalue, G_TYPE_OBJECT );
         g_value_set_object( &gvalue, pixbuf );
         g_object_set_property( G_OBJECT(m_renderer), "pixbuf", &gvalue );
         g_value_unset( &gvalue );
-        
+
         return true;
     }
-    
+
     if (value.GetType() == wxT("wxIcon"))
     {
         wxIcon bitmap;
         bitmap << value;
-        
+
         // This may create a Pixbuf representation in the
         // wxBitmap object (and it will stay there)
         GdkPixbuf *pixbuf = bitmap.GetPixbuf();
-        
+
         GValue gvalue = { 0, };
         g_value_init( &gvalue, G_TYPE_OBJECT );
         g_value_set_object( &gvalue, pixbuf );
         g_object_set_property( G_OBJECT(m_renderer), "pixbuf", &gvalue );
         g_value_unset( &gvalue );
-        
+
         return true;
     }
-    
+
     return false;
 }
 
@@ -1163,7 +1234,7 @@ bool wxDataViewBitmapRenderer::GetValue( wxVariant &value ) const
 {
     return false;
 }
-    
+
 // ---------------------------------------------------------
 // wxDataViewToggleRenderer
 // ---------------------------------------------------------
@@ -1540,7 +1611,7 @@ gtk_dataview_header_button_press_callback( GtkWidget *widget,
 {
     if (gdk_event->type != GDK_BUTTON_PRESS)
         return TRUE;
-        
+
     if (gdk_event->button == 1)
     {
         wxDataViewCtrl *dv = column->GetOwner();
@@ -1549,7 +1620,7 @@ gtk_dataview_header_button_press_callback( GtkWidget *widget,
         event.SetModel( dv->GetModel() );
         dv->GetEventHandler()->ProcessEvent( event );
     }
-    
+
     return TRUE;
 }
 
@@ -1579,8 +1650,8 @@ static void wxGtkTreeCellDataFunc( GtkTreeViewColumn *column,
     list_store->model->GetValue( value, cell->GetOwner()->GetModelColumn(), model_row );
 
     if (value.GetType() != cell->GetVariantType())
-        wxLogError( wxT("Wrong type, required: %s but: %s"), 
-                    value.GetType().c_str(), 
+        wxLogError( wxT("Wrong type, required: %s but: %s"),
+                    value.GetType().c_str(),
                     cell->GetVariantType().c_str() );
 
     cell->SetValue( value );
@@ -1588,8 +1659,8 @@ static void wxGtkTreeCellDataFunc( GtkTreeViewColumn *column,
 
 IMPLEMENT_CLASS(wxDataViewColumn, wxDataViewColumnBase)
 
-wxDataViewColumn::wxDataViewColumn( const wxString &title, wxDataViewRenderer *cell, 
-                                    unsigned int model_column, int width, 
+wxDataViewColumn::wxDataViewColumn( const wxString &title, wxDataViewRenderer *cell,
+                                    unsigned int model_column, int width,
                                     wxAlignment align, int flags ) :
     wxDataViewColumnBase( title, cell, model_column, width, align, flags )
 {
@@ -1599,8 +1670,8 @@ wxDataViewColumn::wxDataViewColumn( const wxString &title, wxDataViewRenderer *c
     SetTitle( title );
 }
 
-wxDataViewColumn::wxDataViewColumn( const wxBitmap &bitmap, wxDataViewRenderer *cell, 
-                                    unsigned int model_column, int width, 
+wxDataViewColumn::wxDataViewColumn( const wxBitmap &bitmap, wxDataViewRenderer *cell,
+                                    unsigned int model_column, int width,
                                     wxAlignment align, int flags ) :
     wxDataViewColumnBase( bitmap, cell, model_column, width, align, flags )
 {
@@ -1643,7 +1714,7 @@ void wxDataViewColumn::OnInternalIdle()
 {
     if (m_isConnected)
         return;
-        
+
     if (GTK_WIDGET_REALIZED(GetOwner()->m_treeview))
     {
         GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN(m_column);
@@ -1651,7 +1722,7 @@ void wxDataViewColumn::OnInternalIdle()
         {
             g_signal_connect(column->button, "button_press_event",
                       G_CALLBACK (gtk_dataview_header_button_press_callback), this);
-    
+
             m_isConnected = true;
         }
     }
@@ -1660,22 +1731,22 @@ void wxDataViewColumn::OnInternalIdle()
 void wxDataViewColumn::SetOwner( wxDataViewCtrl *owner )
 {
     wxDataViewColumnBase::SetOwner( owner );
-    
+
     GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN(m_column);
-    
+
     gtk_tree_view_column_set_title( column, wxGTK_CONV_FONT(GetTitle(), GetOwner()->GetFont() ) );
 }
 
 void wxDataViewColumn::SetTitle( const wxString &title )
 {
     GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN(m_column);
-    
+
     if (m_isConnected)
     {
         // disconnect before column->button gets recreated
-        g_signal_handlers_disconnect_by_func( column->button, 
+        g_signal_handlers_disconnect_by_func( column->button,
                       (GtkWidget*) gtk_dataview_header_button_press_callback, this);
-                      
+
         m_isConnected = false;
     }
 
@@ -1701,7 +1772,7 @@ void wxDataViewColumn::SetBitmap( const wxBitmap &bitmap )
     if (bitmap.Ok())
     {
         GtkImage *gtk_image = GTK_IMAGE( gtk_image_new() );
-        
+
         GdkBitmap *mask = (GdkBitmap *) NULL;
         if (bitmap.GetMask())
             mask = bitmap.GetMask()->GetBitmap();
@@ -1717,7 +1788,7 @@ void wxDataViewColumn::SetBitmap( const wxBitmap &bitmap )
                                       bitmap.GetPixmap(), mask);
         }
         gtk_widget_show( GTK_WIDGET(gtk_image) );
-        
+
         gtk_tree_view_column_set_widget( column, GTK_WIDGET(gtk_image) );
     }
     else
@@ -1739,14 +1810,14 @@ void wxDataViewColumn::SetResizeable( bool resizeable )
 void wxDataViewColumn::SetAlignment( wxAlignment align )
 {
     GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN(m_column);
-    
+
     gfloat xalign = 0.0;
     if (align == wxALIGN_RIGHT)
         xalign = 1.0;
     if (align == wxALIGN_CENTER_HORIZONTAL ||
         align == wxALIGN_CENTER)
         xalign = 0.5;
-        
+
     gtk_tree_view_column_set_alignment( column, xalign );
 }
 
@@ -1758,7 +1829,7 @@ wxAlignment wxDataViewColumn::GetAlignment() const
         return wxALIGN_RIGHT;
     if (xalign == 0.5)
         return wxALIGN_CENTER_HORIZONTAL;
-        
+
     return wxALIGN_LEFT;
 }
 
@@ -1789,7 +1860,7 @@ bool wxDataViewColumn::IsHidden() const
 void wxDataViewColumn::SetSortOrder( bool ascending )
 {
     GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN(m_column);
-    
+
     if (ascending)
         gtk_tree_view_column_set_sort_order( column, GTK_SORT_ASCENDING );
     else
@@ -1799,7 +1870,7 @@ void wxDataViewColumn::SetSortOrder( bool ascending )
 bool wxDataViewColumn::IsSortOrderAscending() const
 {
     GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN(m_column);
-    
+
     return (gtk_tree_view_column_get_sort_order( column ) != GTK_SORT_DESCENDING);
 }
 
@@ -1833,7 +1904,7 @@ wxdataview_selection_changed_callback( GtkTreeSelection* selection, wxDataViewCt
 {
     if (!GTK_WIDGET_REALIZED(dv->m_widget))
         return;
-    
+
     wxDataViewEvent event( wxEVT_COMMAND_DATAVIEW_ROW_SELECTED, dv->GetId() );
     event.SetRow( dv->GetSelection() );
     event.SetModel( dv->GetModel() );
@@ -1841,7 +1912,7 @@ wxdataview_selection_changed_callback( GtkTreeSelection* selection, wxDataViewCt
 }
 
 static void
-wxdataview_row_activated_callback( GtkTreeView* treeview, GtkTreePath *path, 
+wxdataview_row_activated_callback( GtkTreeView* treeview, GtkTreePath *path,
                                    GtkTreeViewColumn *column, wxDataViewCtrl *dv )
 {
     wxDataViewEvent event( wxEVT_COMMAND_DATAVIEW_ROW_ACTIVATED, dv->GetId() );
@@ -1855,6 +1926,49 @@ wxdataview_row_activated_callback( GtkTreeView* treeview, GtkTreePath *path,
 // wxDataViewCtrl
 //-----------------------------------------------------------------------------
 
+//-----------------------------------------------------------------------------
+// InsertChild for wxDataViewCtrl
+//-----------------------------------------------------------------------------
+
+static void wxInsertChildInDataViewCtrl( wxWindowGTK* parent, wxWindowGTK* child )
+{
+    wxDataViewCtrl * dvc = (wxDataViewCtrl*) parent;
+    GtkWidget *treeview = dvc->GtkGetTreeView();
+
+    // Insert widget in GtkTreeView
+    if (GTK_WIDGET_REALIZED(treeview))
+        gtk_widget_set_parent_window( child->m_widget,
+          gtk_tree_view_get_bin_window( GTK_TREE_VIEW(treeview) ) );
+    gtk_widget_set_parent( child->m_widget, treeview );
+}
+
+static
+void gtk_dataviewctrl_size_callback( GtkWidget *WXUNUSED(widget),
+                                     GtkAllocation *alloc,
+                                     wxDataViewCtrl *win )
+{
+
+    wxWindowList::Node *node = win->GetChildren().GetFirst();
+    while (node)
+    {
+        wxWindow *child = node->GetData();
+
+        GtkRequisition req;
+        gtk_widget_size_request( child->m_widget, &req );
+
+        GtkAllocation alloc;
+        alloc.x = child->m_x;
+        alloc.y = child->m_y;
+        alloc.width = child->m_width;
+        alloc.height = child->m_height;
+        gtk_widget_size_allocate( child->m_widget, &alloc );
+
+        node = node->GetNext();
+    }
+}
+
+
+
 IMPLEMENT_DYNAMIC_CLASS(wxDataViewCtrl, wxDataViewCtrlBase)
 
 wxDataViewCtrl::~wxDataViewCtrl()
@@ -1878,9 +1992,6 @@ bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id,
 {
     Init();
 
-    m_needParent = true;
-    m_acceptsFocus = true;
-
     if (!PreCreation( parent, pos, size ) ||
         !CreateBase( parent, id, pos, size, style, validator ))
     {
@@ -1888,6 +1999,8 @@ bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id,
         return false;
     }
 
+    m_insertCallback = wxInsertChildInDataViewCtrl;
+
     m_widget = gtk_scrolled_window_new (NULL, NULL);
 
     GtkScrolledWindowSetBorder(m_widget, style);
@@ -1895,6 +2008,9 @@ bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id,
     m_treeview = gtk_tree_view_new();
     gtk_container_add (GTK_CONTAINER (m_widget), m_treeview);
 
+    g_signal_connect (m_treeview, "size_allocate",
+                     G_CALLBACK (gtk_dataviewctrl_size_callback), this);
+
 #ifdef __WXGTK26__
     if (!gtk_check_version(2,6,0))
         gtk_tree_view_set_fixed_height_mode( GTK_TREE_VIEW(m_treeview), TRUE );
@@ -1912,8 +2028,8 @@ bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id,
     if (!gtk_check_version(2,10,0))
     {
         GtkTreeViewGridLines grid = GTK_TREE_VIEW_GRID_LINES_NONE;
-    
-        if ((style & wxDV_HORIZ_RULES) != 0 && 
+
+        if ((style & wxDV_HORIZ_RULES) != 0 &&
             (style & wxDV_VERT_RULES) != 0)
             grid = GTK_TREE_VIEW_GRID_LINES_BOTH;
         else if (style & wxDV_VERT_RULES)
@@ -1925,7 +2041,9 @@ bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id,
     }
     else
 #endif
+    {
         gtk_tree_view_set_rules_hint( GTK_TREE_VIEW(m_treeview), (style & wxDV_HORIZ_RULES) != 0 );
+    }
 
     gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (m_widget),
         GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
@@ -1947,7 +2065,7 @@ bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id,
 void wxDataViewCtrl::OnInternalIdle()
 {
     wxWindow::OnInternalIdle();
-    
+
     unsigned int cols = GetColumnCount();
     unsigned int i;
     for (i = 0; i < cols; i++)
@@ -1990,7 +2108,7 @@ bool wxDataViewCtrl::AppendColumn( wxDataViewColumn *col )
 void wxDataViewCtrl::SetSelection( int row )
 {
     GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW(m_treeview) );
-    
+
     if (row < 0)
     {
         gtk_tree_selection_unselect_all( selection );
@@ -1999,9 +2117,9 @@ void wxDataViewCtrl::SetSelection( int row )
     {
         GtkTreePath *path = gtk_tree_path_new ();
         gtk_tree_path_append_index( path, row );
-        
+
         gtk_tree_selection_select_path( selection, path );
-        
+
         gtk_tree_path_free( path );
     }
 }
@@ -2009,12 +2127,12 @@ void wxDataViewCtrl::SetSelection( int row )
 void wxDataViewCtrl::Unselect( unsigned int row )
 {
     GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW(m_treeview) );
-    
+
     GtkTreePath *path = gtk_tree_path_new ();
     gtk_tree_path_append_index( path, row );
-        
+
     gtk_tree_selection_unselect_path( selection, path );
-        
+
     gtk_tree_path_free( path );
 }
 
@@ -2025,18 +2143,18 @@ void wxDataViewCtrl::SetSelectionRange( unsigned int from, unsigned int to )
 void wxDataViewCtrl::SetSelections( const wxArrayInt& aSelections)
 {
 }
-    
+
 bool wxDataViewCtrl::IsSelected( unsigned int row ) const
 {
     GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW(m_treeview) );
-    
+
     GtkTreePath *path = gtk_tree_path_new ();
     gtk_tree_path_append_index( path, row );
-    
+
     gboolean ret =  gtk_tree_selection_path_is_selected( selection, path );
-    
+
     gtk_tree_path_free( path );
-    
+
     return ret;
 }
 
@@ -2047,25 +2165,25 @@ int wxDataViewCtrl::GetSelection() const
     {
         GtkTreeModel *model;
         GList *list = gtk_tree_selection_get_selected_rows( selection, &model );
-        
+
         // do something
         if (list)
         {
             // list = g_list_nth( list, 0 );  should be a noop
             GtkTreePath *path = (GtkTreePath*) list->data;
-            
+
             unsigned int row = (unsigned int)gtk_tree_path_get_indices (path)[0];
-        
+
             // delete list
             g_list_foreach( list, (GFunc) gtk_tree_path_free, NULL );
             g_list_free( list );
-            
+
             return (int) row;
         }
     }
     else
     {
-        
+
         GtkTreeModel *model;
         GtkTreeIter iter;
         gboolean has_selection = gtk_tree_selection_get_selected( selection, &model, &iter );
@@ -2075,7 +2193,7 @@ int wxDataViewCtrl::GetSelection() const
             return (int) row;
         }
     }
-    
+
     return -1;
 }
 
@@ -2088,25 +2206,25 @@ int wxDataViewCtrl::GetSelections(wxArrayInt& aSelections) const
     {
         GtkTreeModel *model;
         GList *list = gtk_tree_selection_get_selected_rows( selection, &model );
-        
+
         int count = 0;
         while (list)
         {
-            
+
             // list = g_list_nth( list, 0 );  should be a noop
             GtkTreePath *path = (GtkTreePath*) list->data;
-            
+
             unsigned int row = (unsigned int)gtk_tree_path_get_indices (path)[0];
-            
+
             aSelections.Add( (int) row );
-        
-            list = g_list_next( list );            
+
+            list = g_list_next( list );
         }
-        
+
         // delete list
         g_list_foreach( list, (GFunc) gtk_tree_path_free, NULL );
         g_list_free( list );
-        
+
         return count;
     }
     else
@@ -2121,7 +2239,7 @@ int wxDataViewCtrl::GetSelections(wxArrayInt& aSelections) const
             return 1;
         }
     }
-    
+
     return 0;
 }