Add wxGridCellRenderer::GetBest{Height,Width}() and use them in wxGrid.

Allow the renderer to specify the best height at the given width (or vice
versa) instead of the best size in both direction which is not defined for
e.g. wxGridCellAutoWrapStringRenderer.

Closes #15943.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76451 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-05-04 22:12:42 +00:00
parent 02f5b809bd
commit 2e8988c3d6
6 changed files with 120 additions and 13 deletions

View File

@@ -8407,8 +8407,11 @@ wxGrid::AutoSizeColOrRow(int colOrRow, bool setAsMin, wxGridDirection direction)
wxGridCellRenderer *renderer = attr->GetRenderer(this, row, col);
if ( renderer )
{
wxSize size = renderer->GetBestSize(*this, *attr, dc, row, col);
extent = column ? size.x : size.y;
extent = column
? renderer->GetBestWidth(*this, *attr, dc, row, col,
GetRowHeight(row))
: renderer->GetBestHeight(*this, *attr, dc, row, col,
GetColWidth(col));
if ( span != CellSpan_None )
{