use GetMouseCursor().
- wxFontEnumerator::GetFacenames() and GetEncodings() now return arrays and
not pointers to arrays
+- wxStaticBoxSizer now deletes the associated wxStaticBox when it is deleted
Deprecated methods since 2.6.x and their replacements
\section{\class{wxStaticBoxSizer}}\label{wxstaticboxsizer}
wxStaticBoxSizer is a sizer derived from wxBoxSizer but adds a static
-box around the sizer. This static box has to be created independently or the
-sizer may create it itself as a convenience.
+box around the sizer. This static box may be either created independently or
+the sizer may create it itself as a convenience. In any case, the sizer owns
+the \helpref{wxStaticBox}{wxstaticbox} control and will delete it if it is
+deleted.
\wxheading{Derived from}
public:
wxStaticBoxSizer(wxStaticBox *box, int orient);
wxStaticBoxSizer(int orient, wxWindow *win, const wxString& label = wxEmptyString);
+ virtual ~wxStaticBoxSizer() { delete m_staticBox; }
void RecalcSizes();
wxSize CalcMin();
// override to hide/show the static box as well
virtual void ShowItems (bool show);
+ virtual bool Detach( wxWindow *window );
protected:
wxStaticBox *m_staticBox;
#if wxUSE_STATBOX
wxStaticBoxSizer::wxStaticBoxSizer( wxStaticBox *box, int orient )
- : wxBoxSizer( orient )
- , m_staticBox( box )
+ : wxBoxSizer( orient ),
+ m_staticBox( box )
{
wxASSERT_MSG( box, wxT("wxStaticBoxSizer needs a static box") );
+
+ // do this so that our Detach() is called if the static box is destroyed
+ // before we are
+ m_staticBox->SetContainingSizer(this);
}
wxStaticBoxSizer::wxStaticBoxSizer(int orient, wxWindow *win, const wxString& s)
: wxBoxSizer(orient),
m_staticBox(new wxStaticBox(win, wxID_ANY, s))
{
+ // same as above
+ m_staticBox->SetContainingSizer(this);
}
static void GetStaticBoxBorders( wxStaticBox *box,
wxBoxSizer::ShowItems( show );
}
+bool wxStaticBoxSizer::Detach( wxWindow *window )
+{
+ // avoid deleting m_staticBox in our dtor if it's being detached from the
+ // sizer (which can happen because it's being already destroyed for
+ // example)
+ if ( window == m_staticBox )
+ {
+ m_staticBox = NULL;
+ return true;
+ }
+
+ return wxSizer::Detach( window );
+}
+
#endif // wxUSE_STATBOX
#if wxUSE_BUTTON