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

@@ -48,10 +48,40 @@ public:
/**
Get the preferred size of the cell for its contents.
This method must be overridden in the derived classes to return the
minimal fitting size for displaying the content of the given grid cell.
@see GetBestHeight(), GetBestWidth()
*/
virtual wxSize GetBestSize(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc,
int row, int col) = 0;
/**
Get the preferred height of the cell at the given width.
Some renderers may not have a well-defined best size, but only be able
to provide the best height at the given width, e.g. this is the case of
the standard wxGridCellAutoWrapStringRenderer. In this case, they
should override this method, in addition to GetBestSize().
@see GetBestWidth()
@since 3.1.0
*/
virtual wxSize GetBestHeight(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc,
int row, int col, int width);
/**
Get the preferred width of the cell at the given height.
See GetBestHeight(), this method is symmetric to it.
@since 3.1.0
*/
virtual wxSize GetBestWidth(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc,
int row, int col, int height);
protected:
/**
The destructor is private because only DecRef() can delete us.