]> 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 792d56f9051d43c599546fc5e15f7630809c8fd2..448d7a762b51a8782bcc81c496340e33b1c15a35 100644 (file)
@@ -488,7 +488,7 @@ static GtkCellEditable *gtk_wx_cell_renderer_start_editing(
                         GdkRectangle            *background_area,
                         GdkRectangle            *cell_area,
                         GtkCellRendererState     flags );
-                        
+
 
 static GObjectClass *cell_parent_class = NULL;
 
@@ -572,7 +572,7 @@ static GtkCellEditable *gtk_wx_cell_renderer_start_editing(
     wxDataViewCustomRenderer *cell = wxrenderer->cell;
     if (!cell->HasEditorCtrl())
         return NULL;
-        
+
     GdkRectangle rect;
     gtk_wx_cell_renderer_get_size (renderer, widget, cell_area,
                                    &rect.x,
@@ -595,7 +595,7 @@ static GtkCellEditable *gtk_wx_cell_renderer_start_editing(
     gtk_tree_path_free( treepath );
 
     cell->StartEditing( model_row, renderrect );
-    
+
     return NULL;
 }
 
@@ -733,11 +733,11 @@ gtk_wx_cell_renderer_activate(
     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)
@@ -778,6 +778,7 @@ class wxGtkDataViewListModelNotifier: public wxDataViewListModelNotifier
 {
 public:
     wxGtkDataViewListModelNotifier( GtkWxListStore* gtk_store, wxDataViewListModel *wx_model );
+    ~wxGtkDataViewListModelNotifier();
 
     virtual bool RowAppended();
     virtual bool RowPrepended();
@@ -788,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;
 };
@@ -810,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;
@@ -896,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();
@@ -1933,7 +1937,7 @@ static void wxInsertChildInDataViewCtrl( wxWindowGTK* parent, wxWindowGTK* child
 
     // Insert widget in GtkTreeView
     if (GTK_WIDGET_REALIZED(treeview))
-        gtk_widget_set_parent_window( child->m_widget, 
+        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 );
 }
@@ -1943,22 +1947,22 @@ 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();
     }
 }
@@ -1988,8 +1992,6 @@ bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id,
 {
     Init();
 
-    m_needParent = true;
-
     if (!PreCreation( parent, pos, size ) ||
         !CreateBase( parent, id, pos, size, style, validator ))
     {
@@ -2005,7 +2007,7 @@ 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);
 
@@ -2039,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);