+
+// ----------------------------------------------------------------------------
+// wxWizardSizer
+// ----------------------------------------------------------------------------
+
+wxWizardSizer::wxWizardSizer(wxWizard *owner)
+ : m_owner(owner)
+{
+ m_childSizeValid = false;
+}
+
+void wxWizardSizer::RecalcSizes()
+{
+ // Effect of this function depends on m_owner->m_page and
+ // it should be called whenever it changes (wxWizard::ShowPage)
+ if ( m_owner->m_page )
+ {
+ m_owner->m_page->SetSize(m_position.x,m_position.y, m_size.x,m_size.y);
+ }
+}
+
+wxSize wxWizardSizer::CalcMin()
+{
+ return m_owner->GetPageSize();
+}
+
+wxSize wxWizardSizer::GetMaxChildSize()
+{
+#if !defined(__WXDEBUG__)
+ if ( m_childSizeValid )
+ return m_childSize;
+#endif
+
+ wxSize maxOfMin;
+ wxSizerItemList::compatibility_iterator childNode;
+
+ for(childNode = m_children.GetFirst(); childNode;
+ childNode = childNode->GetNext())
+ {
+ wxSizerItem *child = childNode->GetData();
+ maxOfMin.IncTo(child->CalcMin());
+ maxOfMin.IncTo(SiblingSize(child));
+ }
+
+#ifdef __WXDEBUG__
+ if ( m_childSizeValid && m_childSize != maxOfMin )
+ {
+ wxFAIL_MSG( _T("Size changed in wxWizard::GetPageAreaSizer()")
+ _T("after RunWizard().\n")
+ _T("Did you forget to call GetSizer()->Fit(this) ")
+ _T("for some page?")) ;
+
+ return m_childSize;
+ }
+#endif // __WXDEBUG__
+
+ if ( m_owner->m_started )
+ {
+ m_childSizeValid = true;
+ m_childSize = maxOfMin;
+ }
+
+ return maxOfMin;
+}
+
+int wxWizardSizer::Border() const
+{
+ if ( m_owner->m_calledSetBorder )
+ return m_owner->m_border;
+
+ return m_children.IsEmpty() ? 5 : 0;
+}
+
+wxSize wxWizardSizer::SiblingSize(wxSizerItem *child)
+{
+ wxSize maxSibling;
+
+ if ( child->IsWindow() )
+ {
+ wxWizardPage *page = wxDynamicCast(child->GetWindow(), wxWizardPage);
+ if ( page )
+ {
+ for ( wxWizardPage *sibling = page->GetNext();
+ sibling;
+ sibling = sibling->GetNext() )
+ {
+ if ( sibling->GetSizer() )
+ {
+ maxSibling.IncTo(sibling->GetSizer()->CalcMin());
+ }
+ }
+ }
+ }
+
+ return maxSibling;
+}
+