tried to fix layout of label-less static box sizers

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9119 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2001-01-17 17:00:33 +00:00
parent 237c5c0242
commit 84028727cb

View File

@ -945,21 +945,32 @@ wxSize wxBoxSizer::CalcMin()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
wxStaticBoxSizer::wxStaticBoxSizer( wxStaticBox *box, int orient ) wxStaticBoxSizer::wxStaticBoxSizer( wxStaticBox *box, int orient )
: wxBoxSizer( orient ) : wxBoxSizer( orient )
{ {
wxASSERT_MSG( box, wxT("wxStaticBoxSizer needs a static box") ); wxASSERT_MSG( box, wxT("wxStaticBoxSizer needs a static box") );
m_staticBox = 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() void wxStaticBoxSizer::RecalcSizes()
{ {
// this will have to be done platform by platform int top_border, other_border;
// as there is no way to guess the thickness of GetStaticBoxBorders(m_staticBox, &top_border, &other_border);
// a wxStaticBox border
int top_border = 15;
if (m_staticBox->GetLabel().IsEmpty()) top_border = 5;
int other_border = 5;
m_staticBox->SetSize( m_position.x, m_position.y, m_size.x, m_size.y ); 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() wxSize wxStaticBoxSizer::CalcMin()
{ {
// This will have to be done platform by platform int top_border, other_border;
// as there is no way to guess the thickness of GetStaticBoxBorders(m_staticBox, &top_border, &other_border);
// a wxStaticBox border.
int top_border = 15;
if (m_staticBox->GetLabel().IsEmpty()) top_border = 5;
int other_border = 5;
wxSize ret( wxBoxSizer::CalcMin() ); wxSize ret( wxBoxSizer::CalcMin() );
ret.x += 2*other_border; ret.x += 2*other_border;