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:
@@ -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 )
|
||||
|
Reference in New Issue
Block a user