+
+void wxWrapSizer::AdjustPropLastItem(wxSizer *psz, wxSizerItem *itemLast)
+{
+ wxSizerItem *psi = m_rows.GetItem(psz);
+ wxASSERT(psi);
+ wxPropHolder *pph = (wxPropHolder*)psi->GetUserData();
+ if ( !pph )
+ psi->SetUserData( pph=new wxPropHolder );
+
+ pph->Init( itemLast, itemLast->GetProportion() );
+ itemLast->SetProportion( wxDEFAULT_PROPORTION_LAST );
+}
+
+void wxWrapSizer::RecalcSizes()
+{
+ wxASSERT( m_orient&wxBOTH );
+ if (m_children.GetCount() == 0)
+ return;
+
+ // What we do here is to put our items into child box sizers,
+ // as many of them as we have lines.
+
+ // Empty all items in all rows in owned sizer.
+ // We have to access the list directly, since we don't want to
+ // destroy the wxSizerItems.
+ for( int ix=m_rows.GetChildren().GetCount()-1; ix>=0; ix-- ){
+ wxSizerItem *psi = m_rows.GetItem( (size_t)ix );
+
+ // Restore proportion for last item on line (if item has not been deleted)
+ wxPropHolder *pph = (wxPropHolder*)psi->GetUserData();
+ if( pph && GetChildren().Find(pph->m_item) )
+ pph->m_item->SetProportion(pph->m_propOld);
+
+ wxSizer *psz = psi->GetSizer();
+ wxASSERT( psz );
+ wxSizerItemList &sl = psz->GetChildren();
+ while( sl.GetLast() )
+ sl.Erase( sl.GetLast() );
+ }
+
+ int lineSumMajor = 0;
+ int majorSize = GetSizeInMajorDir(m_size);
+
+ // Make sure we have at least one child sizer
+ m_n_line = 1;
+ if( !m_rows.GetChildren().GetCount() )
+ m_rows.Add( new wxBoxSizer(GetOrientation()), 1, wxEXPAND );
+
+ // The sizer where to insert items in
+ wxSizer *psz = m_rows.GetItem((size_t)0)->GetSizer();
+ wxASSERT( psz );
+
+ // Now put our child items into child sizers instead
+ wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
+ wxSizerItem *item = NULL, *itemLast=NULL;