+//---------------------------------------------------------------------------
+// wxStaticBoxSizer
+//---------------------------------------------------------------------------
+
+wxStaticBoxSizer::wxStaticBoxSizer( wxStaticBox *box, int orient )
+ : wxBoxSizer( orient )
+{
+ wxASSERT_MSG( box, wxT("wxStaticBoxSizer needs a static box") );
+
+ m_staticBox = box;
+}
+
+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;
+
+ 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;
+
+ wxBoxSizer::RecalcSizes();
+
+ m_position = old_pos;
+ m_size = old_size;
+}
+
+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;
+
+ wxSize ret( wxBoxSizer::CalcMin() );
+ ret.x += 2*other_border;
+ ret.y += other_border + top_border;
+
+ return ret;
+}
+
+//---------------------------------------------------------------------------
+// wxNotebookSizer
+//---------------------------------------------------------------------------
+
+#if wxUSE_NOTEBOOK
+
+wxNotebookSizer::wxNotebookSizer( wxNotebook *nb )
+{
+ wxASSERT_MSG( nb, wxT("wxNotebookSizer needs a notebook") );
+
+ m_notebook = nb;
+}
+
+void wxNotebookSizer::RecalcSizes()
+{
+ m_notebook->SetSize( m_position.x, m_position.y, m_size.x, m_size.y );
+}
+
+wxSize wxNotebookSizer::CalcMin()
+{
+ // This will have to be done platform by platform
+ // as there is no way to guess the thickness of
+ // the wxNotebook tabs and border.
+
+ int borderX = 5;
+ int borderY = 5;
+ if ((m_notebook->HasFlag(wxNB_RIGHT)) ||
+ (m_notebook->HasFlag(wxNB_LEFT)))
+ {
+ borderX += 90; // improvements later..
+ }
+ else
+ {
+ borderY += 40; // improvements later..
+ }
+
+ if (m_notebook->GetChildren().GetCount() == 0)
+ return wxSize(borderX + 10, borderY + 10);
+
+ int maxX = 0;
+ int maxY = 0;
+
+ wxWindowList::Node *node = m_notebook->GetChildren().GetFirst();
+ while (node)
+ {
+ wxWindow *item = node->GetData();
+ wxSizer *itemsizer = item->GetSizer();
+
+ if (itemsizer)
+ {
+ wxSize subsize( itemsizer->CalcMin() );
+
+ if (subsize.x > maxX) maxX = subsize.x;
+ if (subsize.y > maxY) maxY = subsize.y;
+ }
+
+ node = node->GetNext();
+ }
+
+ return wxSize( borderX + maxX, borderY + maxY );
+}
+
+#endif // wxUSE_NOTEBOOK