From 2003d0037f6575a4351abef25d7fcc7d28947bdd Mon Sep 17 00:00:00 2001 From: Francesco Montorsi Date: Sun, 3 May 2009 22:27:48 +0000 Subject: [PATCH] fix placement of wxStaticBox contents also under wxMSW, when using the (new) approach (i.e. when creating wxStaticBox contents as children of the staticbox itself, instead of as siblings) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60509 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/sizer.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index 47d3d48081..ad5f899c8c 100644 --- a/src/common/sizer.cpp +++ b/src/common/sizer.cpp @@ -2158,23 +2158,36 @@ void wxStaticBoxSizer::RecalcSizes() m_staticBox->SetSize( m_position.x, m_position.y, m_size.x, m_size.y ); - wxPoint old_pos( m_position ); - m_position.x += other_border; - m_position.y += top_border; wxSize old_size( m_size ); m_size.x -= 2*other_border; m_size.y -= top_border + other_border; -#ifdef __WXGTK20__ + wxPoint old_pos( m_position ); if (m_staticBox->GetChildren().GetCount() > 0) { +#if defined( __WXGTK20__ ) // if the wxStaticBox has created a wxPizza to contain its children // (see wxStaticBox::AddChild) then we need to place the items it contains // in the wxBoxSizer::RecalcSizes() call below using coordinates relative // to the top-left corner of the staticbox: m_position.x = m_position.y = 0; - } +#else + // if the wxStaticBox has childrens, then these windows must be placed + // by the wxBoxSizer::RecalcSizes() call below using coordinates relative + // to the top-left corner of the staticbox (but unlike wxGTK, we need + // to keep in count the static borders here!): + m_position.x = other_border; + m_position.y = top_border; #endif + } + else + { + // the windows contained in the staticbox have been created as siblings of the + // staticbox (this is the "old" way of staticbox contents creation); in this + // case we need to position them with coordinates relative to our common parent + m_position.x += other_border; + m_position.y += top_border; + } wxBoxSizer::RecalcSizes(); -- 2.45.2