Add WXDestroyWithoutChildren() and use it from wxStaticBoxSizer
Factor out the code from wxStaticBoxSizer dtor into a wxStaticBox method to improve encapsulation: the static box knows better than another class how to detach its children from it before destroying it. No real changes yet.
This commit is contained in:
@@ -2582,20 +2582,7 @@ wxStaticBoxSizer::~wxStaticBoxSizer()
|
||||
// previous wxWidgets versions, so ensure they are left alive.
|
||||
|
||||
if ( m_staticBox )
|
||||
{
|
||||
// Notice that we must make a copy of the list as it will be changed by
|
||||
// Reparent() calls in the loop.
|
||||
const wxWindowList children = m_staticBox->GetChildren();
|
||||
wxWindow* const parent = m_staticBox->GetParent();
|
||||
for ( wxWindowList::const_iterator i = children.begin();
|
||||
i != children.end();
|
||||
++i )
|
||||
{
|
||||
(*i)->Reparent(parent);
|
||||
}
|
||||
|
||||
delete m_staticBox;
|
||||
}
|
||||
m_staticBox->WXDestroyWithoutChildren();
|
||||
}
|
||||
|
||||
void wxStaticBoxSizer::RecalcSizes()
|
||||
|
Reference in New Issue
Block a user