+// get grid rendered size, origin offset and fill cell arrays
+void wxGrid::GetRenderSizes( const wxGridCellCoords& topLeft,
+ const wxGridCellCoords& bottomRight,
+ wxPoint& pointOffSet, wxSize& sizeGrid,
+ wxGridCellCoordsArray& renderCells,
+ wxArrayInt& arrayCols, wxArrayInt& arrayRows )
+{
+ pointOffSet.x = 0;
+ pointOffSet.y = 0;
+ sizeGrid.SetWidth( 0 );
+ sizeGrid.SetHeight( 0 );
+
+ int col, row;
+
+ wxGridSizesInfo sizeinfo = GetColSizes();
+ for ( col = 0; col <= bottomRight.GetCol(); col++ )
+ {
+ if ( col < topLeft.GetCol() )
+ {
+ pointOffSet.x += sizeinfo.GetSize( col );
+ }
+ else
+ {
+ for ( row = topLeft.GetRow(); row <= bottomRight.GetRow(); row++ )
+ {
+ renderCells.Add( wxGridCellCoords( row, col ));
+ arrayRows.Add( row ); // column labels rendered in DrawColLabels
+ }
+ arrayCols.Add( col ); // row labels rendered in DrawRowLabels
+ sizeGrid.x += sizeinfo.GetSize( col );
+ }
+ }
+
+ sizeinfo = GetRowSizes();
+ for ( row = 0; row <= bottomRight.GetRow(); row++ )
+ {
+ if ( row < topLeft.GetRow() )
+ pointOffSet.y += sizeinfo.GetSize( row );
+ else
+ sizeGrid.y += sizeinfo.GetSize( row );
+ }
+}
+
+// get render start position
+// if position not specified use dc draw extents MaxX and MaxY
+wxPoint wxGrid::GetRenderPosition( wxDC& dc, const wxPoint& position )
+{
+ wxPoint positionRender( position );
+
+ if ( !positionRender.IsFullySpecified() )
+ {
+ if ( positionRender.x == wxDefaultPosition.x )
+ positionRender.x = dc.MaxX();
+
+ if ( positionRender.y == wxDefaultPosition.y )
+ positionRender.y = dc.MaxY();
+ }
+
+ return positionRender;
+}
+
+// draw render rectangle bounding lines
+// useful where there is multi cell row or col clipping and no cell border
+void wxGrid::DoRenderBox( wxDC& dc, const int& style,
+ const wxPoint& pointOffSet,
+ const wxSize& sizeCells,
+ const wxGridCellCoords& topLeft,
+ const wxGridCellCoords& bottomRight )
+{
+ if ( !( style & wxGRID_DRAW_BOX_RECT ) )
+ return;
+
+ int bottom = pointOffSet.y + sizeCells.GetY(),
+ right = pointOffSet.x + sizeCells.GetX() - 1;
+
+ // horiz top line if we are not drawing column header/labels
+ if ( !( style & wxGRID_DRAW_COLS_HEADER ) )
+ {
+ int left = pointOffSet.x;
+ left += ( style & wxGRID_DRAW_COLS_HEADER )
+ ? - GetRowLabelSize() : 0;
+ dc.SetPen( GetRowGridLinePen( topLeft.GetRow() ) );
+ dc.DrawLine( left,
+ pointOffSet.y,
+ right,
+ pointOffSet.y );
+ }
+
+ // horiz bottom line
+ dc.SetPen( GetRowGridLinePen( bottomRight.GetRow() ) );
+ dc.DrawLine( pointOffSet.x, bottom - 1, right, bottom - 1 );
+
+ // left vertical line if we are not drawing row header/labels
+ if ( !( style & wxGRID_DRAW_ROWS_HEADER ) )
+ {
+ int top = pointOffSet.y;
+ top += ( style & wxGRID_DRAW_COLS_HEADER )
+ ? - GetColLabelSize() : 0;
+ dc.SetPen( GetColGridLinePen( topLeft.GetCol() ) );
+ dc.DrawLine( pointOffSet.x -1,
+ top,
+ pointOffSet.x - 1,
+ bottom - 1 );
+ }
+
+ // right vertical line
+ dc.SetPen( GetColGridLinePen( bottomRight.GetCol() ) );
+ dc.DrawLine( right, pointOffSet.y, right, bottom - 1 );
+}
+