propagate invalidated best size upstream

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29740 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2004-10-08 21:52:52 +00:00
parent 395698b2f3
commit 992b2ec476
2 changed files with 11 additions and 1 deletions

View File

@@ -317,7 +317,7 @@ public:
// reset the cached best size value so it will be recalculated the
// next time it is needed.
void InvalidateBestSize() { m_bestSizeCache = wxDefaultSize; }
void InvalidateBestSize();
void CacheBestSize(const wxSize& size) const
{ wxConstCast(this, wxWindowBase)->m_bestSizeCache = size; }

View File

@@ -530,6 +530,16 @@ static bool wxHasRealChildren(const wxWindowBase* win)
return (realChildCount > 0);
}
#endif
void wxWindowBase::InvalidateBestSize()
{
m_bestSizeCache = wxDefaultSize;
// parent's best size calculation may depend on its children's
// best sizes, so let's invalidate it as well to be safe:
if (m_parent)
m_parent->InvalidateBestSize();
}
// return the size best suited for the current window
wxSize wxWindowBase::DoGetBestSize() const