Add wxGridTableBase::CanMeasureColUsingSameAttr()

This allows to optimize AutoSizeColumns() in the common case when all
cells in the same column can be measured using the same attribute.
This commit is contained in:
Vadim Zeitlin
2020-06-11 09:43:08 +02:00
parent 70768a33d2
commit 249db04dd3
3 changed files with 43 additions and 2 deletions

View File

@@ -1065,6 +1065,16 @@ public:
return wxGridCellAttrPtr(GetAttr(row, col, kind));
}
// This is an optimization for a common case when the entire column uses
// roughly the same attribute, which can thus be reused for measuring all
// the cells in this column. Override this to return true (possibly for
// some columns only) to speed up AutoSizeColumns() for the grids using
// this table.
virtual bool CanMeasureColUsingSameAttr(int WXUNUSED(col)) const
{
return false;
}
// these functions take ownership of the pointer
virtual void SetAttr(wxGridCellAttr* attr, int row, int col);
virtual void SetRowAttr(wxGridCellAttr *attr, int row);