+
+//---------------------------------------------------------------------------
+// wxStaticBoxSizer
+//---------------------------------------------------------------------------
+
+#if wxUSE_STATBOX
+
+wxStaticBoxSizer::wxStaticBoxSizer( wxStaticBox *box, int 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;
+ (void)box;
+ *borderOther = 5;
+}
+
+void wxStaticBoxSizer::RecalcSizes()
+{
+ 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 );
+
+ 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()
+{
+ int top_border, other_border;
+ GetStaticBoxBorders(m_staticBox, &top_border, &other_border);
+
+ wxSize ret( wxBoxSizer::CalcMin() );
+ ret.x += 2*other_border;
+ ret.y += other_border + top_border;
+
+ return ret;
+}
+
+#endif // wxUSE_STATBOX
+
+//---------------------------------------------------------------------------
+// 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()
+{
+ wxSize sizeBorder = m_notebook->CalcSizeFromPage(wxSize(0, 0));
+
+ sizeBorder.x += 5;
+ sizeBorder.y += 5;
+
+ if (m_notebook->GetChildren().GetCount() == 0)
+ {
+ return wxSize(sizeBorder.x + 10, sizeBorder.y + 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( maxX, maxY ) + sizeBorder;
+}
+
+#endif // wxUSE_NOTEBOOK
+
+// vi:sts=4:sw=4:et