]> git.saurik.com Git - wxWidgets.git/commitdiff
Added different strategy for updating grid lines.
authorStefan Neis <Stefan.Neis@t-online.de>
Sat, 5 Feb 2000 18:04:13 +0000 (18:04 +0000)
committerStefan Neis <Stefan.Neis@t-online.de>
Sat, 5 Feb 2000 18:04:13 +0000 (18:04 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5857 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/generic/grid.h
src/generic/grid.cpp

index 10636a77784cc02da7db182368cd0908ff0581e2..e6aa4f7f7a6f7c720d967f3c45e0a596a344e1be 100644 (file)
@@ -449,7 +449,7 @@ public:
 
     void DrawGridCellArea( wxDC& dc );
     void DrawCellBorder( wxDC& dc, const wxGridCellCoords& );
-    void DrawAllGridLines( wxDC& dc );  // TODO - delete this ?
+    void DrawAllGridLines( wxDC& dc, const wxRegion & reg = wxRegion() );
     void DrawCell( wxDC& dc, const wxGridCellCoords& );
     void DrawCellBackground( wxDC& dc, const wxGridCellCoords& );
     void DrawCellValue( wxDC& dc, const wxGridCellCoords& );
index ed983aadc6d2152e8fb2c513d959187a60568e46..a5c4a062487f20bb194be307e2e9dd0bcf935b25 100644 (file)
 
 #include "wx/generic/grid.h"
 
+#ifndef DRAW_LINES
+#define DRAW_LINES 1
+#endif
+
 //////////////////////////////////////////////////////////////////////
 
 wxGridCellCoords wxGridNoCellCoords( -1, -1 );
@@ -869,9 +873,12 @@ void wxGridWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
 {
     wxPaintDC dc( this );
     m_owner->PrepareDC( dc );
-
-    m_owner->CalcCellsExposed( GetUpdateRegion() );
+    wxRegion reg = GetUpdateRegion();
+    m_owner->CalcCellsExposed( reg );
     m_owner->DrawGridCellArea( dc );
+#if DRAW_LINES
+    m_owner->DrawAllGridLines( dc, reg );
+#endif
 }
 
 
@@ -2602,8 +2609,10 @@ void wxGrid::DrawCell( wxDC& dc, const wxGridCellCoords& coords )
     if ( m_colWidths[coords.GetCol()] <=0  ||
          m_rowHeights[coords.GetRow()] <= 0 ) return;
 
+#if !DRAW_LINES
     if ( m_gridLinesEnabled )
         DrawCellBorder( dc, coords );
+#endif
 
     DrawCellBackground( dc, coords );
 
@@ -2707,20 +2716,29 @@ void wxGrid::DrawCellValue( wxDC& dc, const wxGridCellCoords& coords )
 // This is used to redraw all grid lines e.g. when the grid line colour
 // has been changed
 //
-void wxGrid::DrawAllGridLines( wxDC& dc )
+void wxGrid::DrawAllGridLines( wxDC& dc, const wxRegion & reg )
 {
     if ( !m_gridLinesEnabled ||
          !m_numRows ||
          !m_numCols ) return;
 
-    int cw, ch;
-    m_gridWin->GetClientSize(&cw, &ch);
-
-    // virtual coords of visible area
-    //
     int top, bottom, left, right;
-    CalcUnscrolledPosition( 0, 0, &left, &top );
-    CalcUnscrolledPosition( cw, ch, &right, &bottom );
+
+    if (reg.IsEmpty()){
+      int cw, ch;
+      m_gridWin->GetClientSize(&cw, &ch);
+
+      // virtual coords of visible area
+      //
+      CalcUnscrolledPosition( 0, 0, &left, &top );
+      CalcUnscrolledPosition( cw, ch, &right, &bottom );
+    }
+    else{
+      wxCoord x, y, w, h;
+      reg.GetBox(x, y, w, h);
+      CalcUnscrolledPosition( x, y, &left, &top );
+      CalcUnscrolledPosition( x + w, y + h, &right, &bottom );
+    }
 
     dc.SetPen( wxPen(GetGridLineColour(), 1, wxSOLID) );