Add wxGridCellRenderer::GetMaxBestSize()

This is another optimization, useful for the renderers that are used
with the values of a fixed form or part of a limited set, as it is much
faster to compute the best size for all values of the set rather than
computing them for all the cells in the column.
This commit is contained in:
Vadim Zeitlin
2020-06-13 15:51:20 +02:00
parent 249db04dd3
commit 71d42a8290
5 changed files with 102 additions and 2 deletions

View File

@@ -212,6 +212,20 @@ public:
return GetBestSize(grid, attr, dc, row, col).GetWidth();
}
// Unlike GetBestSize(), this functions is optional: it is used when
// auto-sizing columns to determine the best width without iterating over
// all cells in this column, if possible.
//
// If it isn't, return wxDefaultSize as the base class version does by
// default.
virtual wxSize GetMaxBestSize(wxGrid& WXUNUSED(grid),
wxGridCellAttr& WXUNUSED(attr),
wxDC& WXUNUSED(dc))
{
return wxDefaultSize;
}
// create a new object which is the copy of this one
virtual wxGridCellRenderer *Clone() const = 0;
};