From a50cf60efef65e4914481b894e797628c6735cf6 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 30 Mar 2007 20:16:11 +0000 Subject: [PATCH] don't use deprecated wxSizerItem::SetWindow/Sizer/Spacer(), use AssignXXX() equivalents instead git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45176 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/sizer.cpp | 18 ++++-------------- src/xrc/xh_sizer.cpp | 6 +++--- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index 06a9bf2e49..b4ae33b5a7 100644 --- a/src/common/sizer.cpp +++ b/src/common/sizer.cpp @@ -587,13 +587,9 @@ bool wxSizer::Remove( int index ) wxCHECK_MSG( node, false, _T("Failed to find child node") ); - wxSizerItem *item = node->GetData(); - - if ( item->IsWindow() ) - item->GetWindow()->SetContainingSizer( NULL ); - - delete item; + delete node->GetData(); m_children.Erase( node ); + return true; } @@ -630,7 +626,6 @@ bool wxSizer::Detach( wxWindow *window ) if (item->GetWindow() == window) { - item->GetWindow()->SetContainingSizer( NULL ); delete item; m_children.Erase( node ); return true; @@ -655,8 +650,6 @@ bool wxSizer::Detach( int index ) if ( item->IsSizer() ) item->DetachSizer(); - else if ( item->IsWindow() ) - item->GetWindow()->SetContainingSizer( NULL ); delete item; m_children.Erase( node ); @@ -675,8 +668,7 @@ bool wxSizer::Replace( wxWindow *oldwin, wxWindow *newwin, bool recursive ) if (item->GetWindow() == oldwin) { - item->GetWindow()->SetContainingSizer( NULL ); - item->SetWindow(newwin); + item->AssignWindow(newwin); newwin->SetContainingSizer( this ); return true; } @@ -704,9 +696,7 @@ bool wxSizer::Replace( wxSizer *oldsz, wxSizer *newsz, bool recursive ) if (item->GetSizer() == oldsz) { - wxSizer *old = item->GetSizer(); - item->SetSizer(newsz); - delete old; + item->AssignSizer(newsz); return true; } else if (recursive && item->IsSizer()) diff --git a/src/xrc/xh_sizer.cpp b/src/xrc/xh_sizer.cpp index b77b9a5cfe..c01742c7e1 100644 --- a/src/xrc/xh_sizer.cpp +++ b/src/xrc/xh_sizer.cpp @@ -144,9 +144,9 @@ wxObject* wxSizerXmlHandler::Handle_sizeritem() wxWindow *wnd = wxDynamicCast(item, wxWindow); if (sizer) - sitem->SetSizer(sizer); + sitem->AssignSizer(sizer); else if (wnd) - sitem->SetWindow(wnd); + sitem->AssignWindow(wnd); else wxLogError(wxT("Error in resource.")); @@ -170,7 +170,7 @@ wxObject* wxSizerXmlHandler::Handle_spacer() wxSizerItem* sitem = MakeSizerItem(); SetSizerItemAttributes(sitem); - sitem->SetSpacer(GetSize()); + sitem->AssignSpacer(GetSize()); AddSizerItem(sitem); return NULL; } -- 2.45.2