wxPaintDC dc(this); // needed to prevent zillions of paint events on MSW
}
-void wxGrid::Refresh(bool eraseb, wxRect* rect= NULL)
+void wxGrid::Refresh(bool eraseb, wxRect* rect)
{
- //Don't do anything if between Begin/EndBatch...
- // endbatch will do all this on the last nested one anyway.
+ // Don't do anything if between Begin/EndBatch...
+ // EndBatch() will do all this on the last nested one anyway.
if (! GetBatchCount())
{
wxScrolledWindow::Refresh(eraseb,rect);
{
wxArrayString lines;
- dc.SetClippingRegion( rect );
StringToLines( value, lines );
long textWidth, textHeight;
long lineWidth, lineHeight;
+ dc.SetClippingRegion( rect );
if ( lines.GetCount() )
{
GetTextBoxSize( dc, lines, &textWidth, &textHeight );
wxGridCellAttr *wxGrid::GetCellAttr(int row, int col) const
{
- wxGridCellAttr *attr;
- if ( !LookupAttr(row, col, &attr) )
+ wxGridCellAttr *attr = NULL;
+ // Additional test to avoid looking at the cache e.g. for
+ // wxNoCellCoords, as this will confuse memory management.
+ if ( row >= 0 )
{
- attr = m_table ? m_table->GetAttr(row, col , wxGridCellAttr::Any) : (wxGridCellAttr *)NULL;
- CacheAttr(row, col, attr);
+ if ( !LookupAttr(row, col, &attr) )
+ {
+ attr = m_table ? m_table->GetAttr(row, col , wxGridCellAttr::Any)
+ : (wxGridCellAttr *)NULL;
+ CacheAttr(row, col, attr);
+ }
}
if (attr)
{
// don't set sizes, only calculate them
wxGrid *self = (wxGrid *)this; // const_cast
- return wxSize(self->SetOrCalcColumnSizes(TRUE),
- self->SetOrCalcRowSizes(TRUE));
+ int width, height;
+ width = self->SetOrCalcColumnSizes(TRUE);
+ height = self->SetOrCalcRowSizes(TRUE);
+
+ int maxwidth, maxheight;
+ wxDisplaySize( & maxwidth, & maxheight );
+
+ if ( width > maxwidth ) width = maxwidth;
+ if ( height > maxheight ) height = maxheight;
+
+ return wxSize( width, height );
}
void wxGrid::Fit()
m_selectingBottomRight != wxGridNoCellCoords) ) );
}
-bool wxGrid::IsInSelection( int row, int col )
+bool wxGrid::IsInSelection( int row, int col ) const
{
return ( m_selection && (m_selection->IsInSelection( row, col ) ||
( row >= m_selectingTopLeft.GetRow() &&