]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/grid.cpp
1. more test code for drawing with ROPs/masks/bg brushes in drawing
[wxWidgets.git] / src / generic / grid.cpp
index 3272dfb10fc561e3eabd6cb192fd2c6c5ef851e2..1af51feba4cce20a5e32cdbb89a2e335622409c3 100644 (file)
@@ -36,8 +36,8 @@
 
 #include "wx/generic/grid.h"
 
-#ifndef DRAW_LINES
-#define DRAW_LINES 1
+#ifndef WXGRID_DRAW_LINES
+#define WXGRID_DRAW_LINES 1
 #endif
 
 //////////////////////////////////////////////////////////////////////
@@ -876,7 +876,7 @@ void wxGridWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
     wxRegion reg = GetUpdateRegion();
     m_owner->CalcCellsExposed( reg );
     m_owner->DrawGridCellArea( dc );
-#if DRAW_LINES
+#if WXGRID_DRAW_LINES
     m_owner->DrawAllGridLines( dc, reg );
 #endif
 }
@@ -1133,7 +1133,7 @@ void wxGrid::CalcDimensions()
         GetViewStart( &x, &y );
         SetScrollbars( GRID_SCROLL_LINE, GRID_SCROLL_LINE,
                        right/GRID_SCROLL_LINE, bottom/GRID_SCROLL_LINE,
-                       x, y, TRUE );
+                       x, y );
     }
 }
 
@@ -1612,6 +1612,7 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event )
             }
         }
 
+        m_cursorMode  = WXGRID_CURSOR_SELECT_CELL;
         m_dragLastPos  = -1;
     }
 
@@ -1800,6 +1801,7 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event )
             }
         }
 
+        m_cursorMode  = WXGRID_CURSOR_SELECT_CELL;
         m_dragLastPos  = -1;
     }
 
@@ -2005,6 +2007,13 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
                 // no default action at the moment
             }
         }
+
+        // ------------ Moving and no button action
+        //
+        else if ( event.Moving() && !event.IsButton() )
+        {
+            m_cursorMode = WXGRID_CURSOR_SELECT_CELL;
+        }
     }
 }
 
@@ -2621,7 +2630,7 @@ void wxGrid::DrawCell( wxDC& dc, const wxGridCellCoords& coords )
     if ( m_colWidths[coords.GetCol()] <=0  ||
          m_rowHeights[coords.GetRow()] <= 0 ) return;
 
-#if !DRAW_LINES
+#if !WXGRID_DRAW_LINES
     if ( m_gridLinesEnabled )
         DrawCellBorder( dc, coords );
 #endif
@@ -2752,12 +2761,17 @@ void wxGrid::DrawAllGridLines( wxDC& dc, const wxRegion & reg )
       CalcUnscrolledPosition( x + w, y + h, &right, &bottom );
     }
 
+    // avoid drawing grid lines past the last row and col
+    //
+    right = wxMin( right, m_colRights[m_numCols-1] );
+    bottom = wxMin( bottom, m_rowBottoms[m_numRows-1] );
+
     dc.SetPen( wxPen(GetGridLineColour(), 1, wxSOLID) );
 
     // horizontal grid lines
     //
     int i;
-    for ( i = 0; i <= m_numRows; i++ )
+    for ( i = 0; i < m_numRows; i++ )
     {
         if ( m_rowBottoms[i] > bottom )
         {
@@ -2772,7 +2786,7 @@ void wxGrid::DrawAllGridLines( wxDC& dc, const wxRegion & reg )
 
     // vertical grid lines
     //
-    for ( i = 0; i <= m_numCols; i++ )
+    for ( i = 0; i < m_numCols; i++ )
     {
         if ( m_colRights[i] > right )
         {