]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/datavgen.cpp
correct i18n problems in accel handling code (replaces patch 1465417; closes bug...
[wxWidgets.git] / src / generic / datavgen.cpp
index 2ad27c525e20ed2271fbdd13fde6cff0ae656cc1..823ba3099aebf3e060ab6c6ea8e82b975f94d44e 100644 (file)
@@ -315,26 +315,23 @@ bool wxDataViewToggleCell::Render( wxRect cell, wxDC *dc, int WXUNUSED(state) )
 {
     // User wxRenderer here
 
-    if (GetMode() == wxDATAVIEW_CELL_ACTIVATABLE)
-        dc->SetPen( *wxBLACK_PEN );
-    else
-        dc->SetPen( *wxGREY_PEN );
-    dc->SetBrush( *wxTRANSPARENT_BRUSH );
     wxRect rect;
     rect.x = cell.x + cell.width/2 - 10;
     rect.width = 20;
     rect.y = cell.y + cell.height/2 - 10;
     rect.height = 20;
-    dc->DrawRectangle( rect );
+    
+    int flags = 0;
     if (m_toggle)
-    {
-        rect.x += 2;
-        rect.y += 2;
-        rect.width -= 4;
-        rect.height -= 4;
-        dc->DrawLine( rect.x, rect.y, rect.x+rect.width, rect.y+rect.height );
-        dc->DrawLine( rect.x+rect.width, rect.y, rect.x, rect.y+rect.height );
-    }
+        flags |= wxCONTROL_CHECKED;
+    if (GetMode() != wxDATAVIEW_CELL_ACTIVATABLE)
+        flags |= wxCONTROL_DISABLED;
+
+    wxRendererNative::Get().DrawCheckButton(
+            GetOwner()->GetOwner(),
+            *dc,
+            rect,
+            flags );
 
     return true;
 }
@@ -506,11 +503,14 @@ bool wxDataViewDateCell::Activate( wxRect WXUNUSED(cell), wxDataViewListModel *m
 
 IMPLEMENT_ABSTRACT_CLASS(wxDataViewColumn, wxDataViewColumnBase)
 
-wxDataViewColumn::wxDataViewColumn( const wxString &title, wxDataViewCell *cell,
-    size_t model_column, int flags ) :
+wxDataViewColumn::wxDataViewColumn( const wxString &title, wxDataViewCell *cell, size_t model_column, 
+        int fixed_width, wxDataViewColumnSizing sizing, int flags ) :
     wxDataViewColumnBase( title, cell, model_column, flags )
 {
-    m_width = 80;
+    m_sizing = sizing;
+    
+    m_width = fixed_width;
+    m_fixedWidth = fixed_width;
 }
 
 wxDataViewColumn::~wxDataViewColumn()
@@ -523,6 +523,27 @@ void wxDataViewColumn::SetTitle( const wxString &title )
 
 }
 
+int wxDataViewColumn::GetWidth()
+{
+    return m_width;
+}
+
+void wxDataViewColumn::SetFixedWidth( int width )
+{
+    m_fixedWidth = width;
+    
+    if (m_sizing == wxDATAVIEW_COL_WIDTH_FIXED)
+    {
+        m_width = width;
+        // Set dirty
+    }
+}
+
+int wxDataViewColumn::GetFixedWidth()
+{
+    return m_fixedWidth;
+}
+
 //-----------------------------------------------------------------------------
 // wxDataViewHeaderWindow
 //-----------------------------------------------------------------------------
@@ -595,7 +616,7 @@ void wxDataViewHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
                                 (
                                     this,
                                     dc,
-                                    wxRect(xpos, 0, cw, ch),
+                                    wxRect(xpos+1, 1, cw-1, ch-1),
                                     m_parent->IsEnabled() ? 0
                                                           : (int)wxCONTROL_DISABLED
                                 );
@@ -951,9 +972,9 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
 
     wxDataViewListModel *model = GetOwner()->GetModel();
 
-    size_t item_start = wxMax( 0, update.y / m_lineHeight );
-    size_t item_count = wxMin( (update.height / m_lineHeight) + 1, 
-                                (int)(model->GetNumberOfRows()-item_start) );
+    size_t item_start = wxMax( 0, (update.y / m_lineHeight) );
+    size_t item_count = wxMin( ((update.y + update.height) / m_lineHeight) - item_start + 1, 
+                               (int)(model->GetNumberOfRows()-item_start) );
 
     wxRect cell_rect;
     cell_rect.x = 0;