added optional parameter to SetSizer, to allow replacing a window's

sizer without deleting the existing one.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14537 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Ron Lee 2002-03-10 11:19:16 +00:00
parent e25f954b96
commit 3aa5d53272
3 changed files with 10 additions and 7 deletions

View File

@ -2483,17 +2483,20 @@ The resizing increments are only significant under Motif or Xt.
\membersection{wxWindow::SetSizer}\label{wxwindowsetsizer}
\func{void}{SetSizer}{\param{wxSizer* }{sizer}}
\func{void}{SetSizer}{\param{wxSizer* }{sizer}, \param{bool }{deleteOld=TRUE}}
Sets the window to have the given layout sizer. The window
will then own the object, and will take care of its deletion.
If an existing layout constraints object is already owned by the
window, it will be deleted.
window, it will be deleted if the deleteOld parameter is TRUE.
\wxheading{Parameters}
\docparam{sizer}{The sizer to set. Pass NULL to disassociate and delete the window's
sizer.}
\docparam{sizer}{The sizer to set. Pass NULL to disassociate and conditionally delete
the window's sizer. See below.}
\docparam{deleteOld}{If TRUE (the default), this will delete any prexisting sizer.
Pass FALSE if you wish to handle deleting the old sizer yourself.}
\wxheading{Remarks}

View File

@ -739,7 +739,7 @@ public:
virtual bool Layout();
// sizers
void SetSizer( wxSizer *sizer );
void SetSizer(wxSizer *sizer, bool deleteOld = TRUE );
wxSizer *GetSizer() const { return m_windowSizer; }
// Track if this window is a member of a sizer

View File

@ -1185,9 +1185,9 @@ void wxWindowBase::DeleteRelatedConstraints()
}
#endif
void wxWindowBase::SetSizer(wxSizer *sizer)
void wxWindowBase::SetSizer(wxSizer *sizer, bool deleteOld)
{
if (m_windowSizer) delete m_windowSizer;
if (m_windowSizer && deleteOld) delete m_windowSizer;
m_windowSizer = sizer;
}