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

@@ -10017,6 +10017,21 @@ wxGrid::AutoSizeColOrRow(int colOrRow, bool setAsMin, wxGridDirection direction)
{
attr = GetCellAttrPtr(row, col);
renderer = attr->GetRendererPtr(this, row, col);
if ( canReuseAttr )
{
// Try to get the best width for the entire column at once, if
// it's supported by the renderer.
extent = renderer->GetMaxBestSize(*this, *attr, dc).x;
if ( extent != wxDefaultCoord )
{
extentMax = extent;
// No need to check all the values.
break;
}
}
}
if ( renderer )