Add wxWindow::GetBest{Height,Width}().

These functions will be used when it is necessary to determine the best size
of the control if one of its size components is fixed. Currently none of the
classes implements DoGetBestClient{Height,Width}() yet but wxListCtrl will do
it soon, see #13898.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71392 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-05-09 14:24:37 +00:00
parent 386279c3f2
commit d119983947
3 changed files with 88 additions and 0 deletions

View File

@@ -916,6 +916,24 @@ wxSize wxWindowBase::GetBestSize() const
return DoGetBestSize();
}
int wxWindowBase::GetBestHeight(int width) const
{
const int height = DoGetBestClientHeight(width);
return height == wxDefaultCoord
? GetBestSize().y
: height + DoGetBorderSize().y;
}
int wxWindowBase::GetBestWidth(int height) const
{
const int width = DoGetBestClientWidth(height);
return width == wxDefaultCoord
? GetBestSize().x
: width + DoGetBorderSize().x;
}
void wxWindowBase::SetMinSize(const wxSize& minSize)
{
m_minWidth = minSize.x;