X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f03fc89fff2d6e823e7d4d14fbe14822ad6777b1..9145664b28fc7a4a2a9bacf7024f257fe6f15479:/src/common/wincmn.cpp diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 34eb0c66ee..234252ff00 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -17,6 +17,10 @@ // headers // ---------------------------------------------------------------------------- +#ifdef __GNUG__ + #pragma implementation "windowbase.h" +#endif + // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -53,7 +57,7 @@ // static data // ---------------------------------------------------------------------------- -int wxWindowBase::ms_lastControlId = 0; +int wxWindowBase::ms_lastControlId = -200; IMPLEMENT_ABSTRACT_CLASS(wxWindowBase, wxEvtHandler) @@ -78,7 +82,6 @@ END_EVENT_TABLE() void wxWindowBase::InitBase() { // no window yet, no parent nor children - m_widget = (WXWidget)0; m_parent = (wxWindow *)NULL; m_windowId = -1; m_children.DeleteContents( FALSE ); // don't auto delete node data @@ -138,8 +141,8 @@ void wxWindowBase::InitBase() // common part of window creation process bool wxWindowBase::CreateBase(wxWindowBase *parent, wxWindowID id, - const wxPoint& pos, - const wxSize& size, + const wxPoint& WXUNUSED(pos), + const wxSize& WXUNUSED(size), long style, const wxString& name) { @@ -176,7 +179,7 @@ wxWindowBase::~wxWindowBase() // we weren't a dialog class wxTopLevelWindows.DeleteObject(this); - DestroyChildren(); + wxASSERT_MSG( GetChildren().GetCount() == 0, _T("children not destroyed") ); if ( m_windowValidator ) delete m_windowValidator; @@ -241,14 +244,21 @@ bool wxWindowBase::Close(bool force) bool wxWindowBase::DestroyChildren() { wxWindowList::Node *node; - for ( node = m_children.GetFirst(); node; node = node->GetNext() ) + for ( ;; ) { + // we iterate until the list becomes empty + node = GetChildren().GetFirst(); + if ( !node ) + break; + wxWindow *child = node->GetData(); - if ( child ) - { - delete child; - delete node; - } + + wxASSERT_MSG( child, _T("children list contains empty nodes") ); + + delete child; + + wxASSERT_MSG( !GetChildren().Find(child), + _T("child didn't remove itself using RemoveChild()") ); } return TRUE; @@ -299,6 +309,14 @@ void wxWindowBase::Fit() while ( node ) { wxWindow *win = node->GetData(); + if ( win->IsKindOf(CLASSINFO(wxFrame)) || + win->IsKindOf(CLASSINFO(wxDialog)) ) + { + // dialogs and frames line in different top level windows - don't + // deal with them here + continue; + } + int wx, wy, ww, wh; win->GetPosition(&wx, &wy); win->GetSize(&ww, &wh); @@ -563,9 +581,9 @@ wxWindow *wxWindowBase::FindWindow( const wxString& name ) // dialog oriented functions // ---------------------------------------------------------------------------- -void wxWindowBase::MakeModal(bool modal) +void wxWindowBase::MakeModal(bool WXUNUSED(modal)) { - wxFAIL_MSG("TODO"); + wxFAIL_MSG(_T("TODO")); } bool wxWindowBase::Validate() @@ -1106,14 +1124,11 @@ void wxWindowBase::UpdateWindowUI() if ( event.GetSetChecked() ) ((wxCheckBox *)this)->SetValue(event.GetChecked()); } - // TODO No radio buttons in wxGTK yet -#ifndef __WXGTK__ else if ( IsKindOf(CLASSINFO(wxRadioButton)) ) { if ( event.GetSetChecked() ) ((wxRadioButton *) this)->SetValue(event.GetChecked()); } -#endif // !wxGTK } } }