]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/docview.cpp
return the index of the inserted/appended item
[wxWidgets.git] / src / common / docview.cpp
index c158c432432ff8b2dd7ad8373ad65a80d39d9829..bc34f640489f6a6d6980666f45f025c27040afbc 100644 (file)
@@ -17,7 +17,7 @@
 // headers
 // ----------------------------------------------------------------------------
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
     #pragma implementation "docview.h"
 #endif
 
@@ -183,18 +183,20 @@ bool wxDocument::OnCloseDocument()
 bool wxDocument::DeleteAllViews()
 {
     wxDocManager* manager = GetDocumentManager();
+    wxList::iterator it, en;
 
-    wxList::compatibility_iterator node = m_documentViews.GetFirst();
-    while (node)
+    for ( it = m_documentViews.begin(), en = m_documentViews.end();
+          it != en;
+          )
     {
-        wxView *view = (wxView *)node->GetData();
+        wxView *view = (wxView *)*it;
         if (!view->Close())
             return FALSE;
 
-        wxList::compatibility_iterator next = node->GetNext();
+        wxList::iterator next = it; ++next;
 
         delete view; // Deletes node implicitly
-        node = next;
+        it = next;
     }
     // If we haven't yet deleted the document (for example
     // if there were no views) then delete it.