From 992b2ec476a34e6f71220ad103b45b107f20f370 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Fri, 8 Oct 2004 21:52:52 +0000 Subject: [PATCH] propagate invalidated best size upstream git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29740 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/window.h | 2 +- src/common/wincmn.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/include/wx/window.h b/include/wx/window.h index 1b88bc156c..7a20ca1615 100644 --- a/include/wx/window.h +++ b/include/wx/window.h @@ -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; } diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 784b618111..c15d4f4da9 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -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 -- 2.45.2