]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/datavgen.cpp
No changes, just fix a typo in the changelog.
[wxWidgets.git] / src / generic / datavgen.cpp
index 8362e7a8430ae93ab3d89570a5e86350c4c98082..ca7dc0a9bd50219f3b9dd4b98f6505a7070f4f36 100644 (file)
@@ -145,7 +145,6 @@ protected:
         return *(GetOwner()->GetColumn(idx));
     }
 
-    // FIXME: currently unused
     virtual bool UpdateColumnWidthToFit(unsigned int idx, int widthTitle)
     {
         wxDataViewCtrl * const owner = GetOwner();
@@ -1665,22 +1664,23 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
         dc.SetPen(m_penRule);
         dc.SetBrush(*wxTRANSPARENT_BRUSH);
 
-        int x = x_start;
+        // NB: Vertical rules are drawn in the last pixel of a column so that
+        //     they align perfectly with native MSW wxHeaderCtrl as well as for
+        //     consistency with MSW native list control. There's no vertical
+        //     rule at the most-left side of the control.
+
+        int x = x_start - 1;
         for (unsigned int i = col_start; i < col_last; i++)
         {
             wxDataViewColumn *col = GetOwner()->GetColumnAt(i);
             if (col->IsHidden())
                 continue;       // skip it
 
+            x += col->GetWidth();
+
             dc.DrawLine(x, GetLineStart( item_start ),
                         x, GetLineStart( item_last ) );
-
-            x += col->GetWidth();
         }
-
-        // Draw last vertical rule
-        dc.DrawLine(x, GetLineStart( item_start ),
-                    x, GetLineStart( item_last ) );
     }
 
     // redraw the background for the items which are selected/current
@@ -4238,7 +4238,7 @@ unsigned int wxDataViewCtrl::GetBestColumnWidth(int idx) const
         calculator.UpdateWithRow(row);
     }
 
-    // row is the first unmeasured item now; that's out value of N/2
+    // row is the first unmeasured item now; that's our value of N/2
 
     if ( row < count )
     {
@@ -4278,8 +4278,6 @@ unsigned int wxDataViewCtrl::GetBestColumnWidth(int idx) const
 
     const_cast<wxDataViewCtrl*>(this)->m_colsBestWidths[idx] = max_width;
     return max_width;
-
-    #undef MEASURE_ITEM
 }
 
 void wxDataViewCtrl::ColumnMoved(wxDataViewColumn * WXUNUSED(col),
@@ -4327,8 +4325,9 @@ void wxDataViewCtrl::InvalidateColBestWidths()
 
     if ( m_headerArea )
     {
-        // this updates visual appearance of columns 0 and up, not just 0
-        m_headerArea->UpdateColumn(0);
+        const unsigned cols = m_headerArea->GetColumnCount();
+        for ( unsigned i = 0; i < cols; i++ )
+            m_headerArea->UpdateColumn(i);
     }
 }
 
@@ -4634,7 +4633,8 @@ void wxDataViewCtrl::StartEditor( const wxDataViewItem & item, unsigned int colu
 
     wxRect itemRect = GetItemRect(item, col);
     wxDataViewRenderer* renderer = col->GetRenderer();
-    renderer->StartEditing(item, itemRect);
+    if (renderer->GetMode() == wxDATAVIEW_CELL_EDITABLE)
+        renderer->StartEditing(item, itemRect);
 }
 
 #endif // !wxUSE_GENERICDATAVIEWCTRL