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

@@ -379,6 +379,13 @@ public:
*h = s.y;
}
// Determine the best size in the other direction if one of them is
// fixed. This is used with windows that can wrap their contents and
// returns input-independent best size for the others.
int GetBestHeight(int width) const;
int GetBestWidth(int height) const;
void SetScrollHelper( wxScrollHelper *sh ) { m_scrollHelper = sh; }
wxScrollHelper *GetScrollHelper() { return m_scrollHelper; }
@@ -1687,6 +1694,14 @@ protected:
// (GetBorderSize() will be used to add them)
virtual wxSize DoGetBestClientSize() const { return wxDefaultSize; }
// These two methods can be overridden to implement intelligent
// width-for-height and/or height-for-width best size determination for the
// window. By default the fixed best size is used.
virtual int DoGetBestClientHeight(int WXUNUSED(width)) const
{ return wxDefaultCoord; }
virtual int DoGetBestClientWidth(int WXUNUSED(height)) const
{ return wxDefaultCoord; }
// this is the virtual function to be overridden in any derived class which
// wants to change how SetSize() or Move() works - it is called by all
// versions of these functions in the base class