Move m_labelWin to wxStaticBoxBase itself

It will be reused by all platforms and is not specific to wxGTK.

This also means WXDestroyWithoutChildren() doesn't need to be virtual
any longer.
This commit is contained in:
Vadim Zeitlin
2017-12-20 00:03:55 +01:00
parent 7c849276f8
commit 8c06a24da4
4 changed files with 16 additions and 37 deletions

View File

@@ -31,6 +31,8 @@ extern WXDLLEXPORT_DATA(const char) wxStaticBoxNameStr[] = "groupBox";
wxStaticBoxBase::wxStaticBoxBase()
{
m_labelWin = NULL;
#ifndef __WXGTK__
m_container.DisableSelfFocus();
#endif
@@ -46,7 +48,15 @@ void wxStaticBoxBase::WXDestroyWithoutChildren()
i != children.end();
++i )
{
(*i)->Reparent(parent);
// The label window doesn't count as our child, it's really a part of
// static box itself and it makes no sense to leave it alive when the
// box is destroyed, so do it even when it's supposed to be destroyed
// without destroying its children -- by not reparenting it, we ensure
// that it's destroyed when this object itself is below.
if ( *i != m_labelWin )
{
(*i)->Reparent(parent);
}
}
delete this;