X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b8885bb39b61f599b16d059a17ea4d9cae7018e7..0c60a0e2b726073be874f45e5227ea93b63623f4:/src/common/sizer.cpp diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index bcc5bad25b..31bed2c619 100644 --- a/src/common/sizer.cpp +++ b/src/common/sizer.cpp @@ -5,7 +5,6 @@ // Dirk Holtwick, Ron Lee // Modified by: Ron Lee // Created: -// RCS-ID: $Id$ // Copyright: (c) Robin Dunn, Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -602,20 +601,10 @@ bool wxSizerItem::IsShown() const return m_window->IsShown(); case Item_Sizer: - { // arbitrarily decide that if at least one of our elements is // shown, so are we (this arbitrariness is the reason for // deprecating this function) - for ( wxSizerItemList::compatibility_iterator - node = m_sizer->GetChildren().GetFirst(); - node; - node = node->GetNext() ) - { - if ( node->GetData()->IsShown() ) - return true; - } - return false; - } + return m_sizer->AreAnyItemsShown(); case Item_Spacer: return m_spacer->IsShown(); @@ -986,6 +975,8 @@ void wxSizer::Layout() CalcMin(); // Applies the layout and repositions/resizes the items + wxWindow::ChildrenRepositioningGuard repositionGuard(m_containingWindow); + RecalcSizes(); } @@ -1290,6 +1281,19 @@ void wxSizer::ShowItems( bool show ) } } +bool wxSizer::AreAnyItemsShown() const +{ + wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); + while (node) + { + if ( node->GetData()->IsShown() ) + return true; + node = node->GetNext(); + } + + return false; +} + bool wxSizer::IsShown( wxWindow *window ) const { wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); @@ -2102,9 +2106,8 @@ void wxBoxSizer::RecalcSizes() minMajorSize += GetSizeInMajorDir(item->GetMinSizeWithBorder()); } - // update our min size and delta which may have changed + // update our min size have changed SizeInMajorDir(m_minSize) = minMajorSize; - delta = totalMajorSize - minMajorSize; // space and sum of proportions for the remaining items, both may change @@ -2542,6 +2545,16 @@ void wxStaticBoxSizer::ShowItems( bool show ) wxBoxSizer::ShowItems( show ); } +bool wxStaticBoxSizer::AreAnyItemsShown() const +{ + // We don't need to check the status of our child items: if the box is + // shown, this sizer should be considered shown even if all its elements + // are hidden (or, more prosaically, there are no elements at all). And, + // conversely, if the box is hidden then all our items, which are its + // children, are hidden too. + return m_staticBox->IsShown(); +} + bool wxStaticBoxSizer::Detach( wxWindow *window ) { // avoid deleting m_staticBox in our dtor if it's being detached from the