+ delete item;
+ m_children.Erase( node );
+ return true;
+}
+
+bool wxSizer::Replace( wxWindow *oldwin, wxWindow *newwin, bool recursive )
+{
+ wxASSERT_MSG( oldwin, wxT("Replacing NULL window") );
+ wxASSERT_MSG( newwin, wxT("Replacing with NULL window") );
+
+ wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
+ while (node)
+ {
+ wxSizerItem *item = node->GetData();
+
+ if (item->GetWindow() == oldwin)
+ {
+ item->AssignWindow(newwin);
+ newwin->SetContainingSizer( this );
+ return true;
+ }
+ else if (recursive && item->IsSizer())
+ {
+ if (item->GetSizer()->Replace( oldwin, newwin, true ))
+ return true;
+ }
+
+ node = node->GetNext();
+ }
+
+ return false;
+}
+
+bool wxSizer::Replace( wxSizer *oldsz, wxSizer *newsz, bool recursive )
+{
+ wxASSERT_MSG( oldsz, wxT("Replacing NULL sizer") );
+ wxASSERT_MSG( newsz, wxT("Replacing with NULL sizer") );
+
+ wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
+ while (node)
+ {
+ wxSizerItem *item = node->GetData();
+
+ if (item->GetSizer() == oldsz)
+ {
+ item->AssignSizer(newsz);
+ return true;
+ }
+ else if (recursive && item->IsSizer())
+ {
+ if (item->GetSizer()->Replace( oldsz, newsz, true ))
+ return true;
+ }
+
+ node = node->GetNext();
+ }
+
+ return false;
+}
+
+bool wxSizer::Replace( size_t old, wxSizerItem *newitem )
+{
+ wxCHECK_MSG( old < m_children.GetCount(), false, wxT("Replace index is out of range") );
+ wxASSERT_MSG( newitem, wxT("Replacing with NULL item") );
+
+ wxSizerItemList::compatibility_iterator node = m_children.Item( old );
+
+ wxCHECK_MSG( node, false, wxT("Failed to find child node") );
+
+ wxSizerItem *item = node->GetData();
+ node->SetData(newitem);
+
+ if (item->IsWindow() && item->GetWindow())
+ item->GetWindow()->SetContainingSizer(NULL);
+
+ delete item;
+
+ return true;