]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/wincmn.cpp
Compile fix for GTK 1.0
[wxWidgets.git] / src / common / wincmn.cpp
index 66390ee06f8643628f1402ae19110cccd9e8211b..234252ff00420bab58ade5d61078cab0217725db 100644 (file)
@@ -57,7 +57,7 @@
 // static data
 // ----------------------------------------------------------------------------
 
-int wxWindowBase::ms_lastControlId = 0;
+int wxWindowBase::ms_lastControlId = -200;
 
 IMPLEMENT_ABSTRACT_CLASS(wxWindowBase, wxEvtHandler)
 
@@ -179,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;
@@ -244,13 +244,21 @@ bool wxWindowBase::Close(bool force)
 bool wxWindowBase::DestroyChildren()
 {
     wxWindowList::Node *node;
-    for ( node = GetChildren().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;
-        }
+
+        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;
@@ -301,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);
@@ -567,7 +583,7 @@ wxWindow *wxWindowBase::FindWindow( const wxString& name )
 
 void wxWindowBase::MakeModal(bool WXUNUSED(modal))
 {
-    wxFAIL_MSG("TODO");
+    wxFAIL_MSG(_T("TODO"));
 }
 
 bool wxWindowBase::Validate()
@@ -1108,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
         }
     }
 }