X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cdddaeea1043fa8fd0c0efdce98b7370fb02ac05..4fdae9972d39fbe62adaa1c1d721ba1762cd8950:/src/common/sizer.cpp diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index e71d728a8b..0a92ab0569 100644 --- a/src/common/sizer.cpp +++ b/src/common/sizer.cpp @@ -945,21 +945,32 @@ wxSize wxBoxSizer::CalcMin() //--------------------------------------------------------------------------- wxStaticBoxSizer::wxStaticBoxSizer( wxStaticBox *box, int orient ) - : wxBoxSizer( orient ) + : wxBoxSizer( orient ) { wxASSERT_MSG( box, wxT("wxStaticBoxSizer needs a static box") ); m_staticBox = box; } +static void GetStaticBoxBorders(wxStaticBox *box, + int *borderTop, int *borderOther) +{ + // this has to be done platform by platform as there is no way to + // guess the thickness of a wxStaticBox border +#ifdef __WXGTK__ + if ( box->GetLabel().IsEmpty() ) + *borderTop = 5; + else +#endif // __WXGTK__ + *borderTop = 15; + + *borderOther = 5; +} + void wxStaticBoxSizer::RecalcSizes() { - // this will have to be done platform by platform - // as there is no way to guess the thickness of - // a wxStaticBox border - int top_border = 15; - if (m_staticBox->GetLabel().IsEmpty()) top_border = 5; - int other_border = 5; + int top_border, other_border; + GetStaticBoxBorders(m_staticBox, &top_border, &other_border); m_staticBox->SetSize( m_position.x, m_position.y, m_size.x, m_size.y ); @@ -978,13 +989,8 @@ void wxStaticBoxSizer::RecalcSizes() wxSize wxStaticBoxSizer::CalcMin() { - // This will have to be done platform by platform - // as there is no way to guess the thickness of - // a wxStaticBox border. - - int top_border = 15; - if (m_staticBox->GetLabel().IsEmpty()) top_border = 5; - int other_border = 5; + int top_border, other_border; + GetStaticBoxBorders(m_staticBox, &top_border, &other_border); wxSize ret( wxBoxSizer::CalcMin() ); ret.x += 2*other_border;