Modified version of DrawGridSpace.

Added minor improvement suggested by GRG.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@6992 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Neis
2000-03-30 15:24:48 +00:00
parent f9b5150a08
commit 053ad70036

View File

@@ -5421,32 +5421,32 @@ void wxGrid::DrawGridCellArea( wxDC& dc )
void wxGrid::DrawGridSpace( wxDC& dc ) void wxGrid::DrawGridSpace( wxDC& dc )
{ {
if ( m_numRows && m_numCols ) int cw, ch;
{ m_gridWin->GetClientSize( &cw, &ch );
int cw, ch;
m_gridWin->GetClientSize( &cw, &ch );
int right, bottom; int right, bottom;
CalcUnscrolledPosition( cw, ch, &right, &bottom ); CalcUnscrolledPosition( cw, ch, &right, &bottom );
if ( right > GetColRight(m_numCols-1) || if ( right > (m_numCols>0) ? GetColRight(m_numCols-1) : 0 ||
bottom > GetRowBottom(m_numRows-1) ) bottom > (m_numRows>0) ? GetRowBottom(m_numRows-1) : 0 )
{ {
int left, top; int left, top;
CalcUnscrolledPosition( 0, 0, &left, &top ); CalcUnscrolledPosition( 0, 0, &left, &top );
dc.SetBrush( wxBrush(GetDefaultCellBackgroundColour(), wxSOLID) ); dc.SetBrush( wxBrush(GetDefaultCellBackgroundColour(), wxSOLID) );
dc.SetPen( *wxTRANSPARENT_PEN ); dc.SetPen( *wxTRANSPARENT_PEN );
if ( right > GetColRight(m_numCols-1) ) if ( right > (m_numCols>0) ? GetColRight(m_numCols-1) : 0 )
dc.DrawRectangle( GetColRight(m_numCols-1), top, dc.DrawRectangle( (m_numCols>0) ? GetColRight(m_numCols-1) : 0,
right - GetColRight(m_numCols-1), ch ); top, right - (m_numCols>0) ?
GetColRight(m_numCols-1) : 0, ch );
if ( bottom > GetRowBottom(m_numRows-1) ) if ( bottom > (m_numRows>0) ? GetRowBottom(m_numRows-1) : 0 )
dc.DrawRectangle( left, GetRowBottom(m_numRows-1), dc.DrawRectangle( left,
cw, bottom - GetRowBottom(m_numRows-1) ); (m_numRows>0) ? GetRowBottom(m_numRows-1) : 0,
cw,
bottom - ((m_numRows>0) ? GetRowBottom(m_numRows-1) : 0 ));
} }
}
} }
@@ -7681,7 +7681,7 @@ void wxGrid::SetCellValue( int row, int col, const wxString& s )
{ {
if ( m_table ) if ( m_table )
{ {
m_table->SetValue( row, col, s.c_str() ); m_table->SetValue( row, col, s );
if ( !GetBatchCount() ) if ( !GetBatchCount() )
{ {
wxClientDC dc( m_gridWin ); wxClientDC dc( m_gridWin );