]> git.saurik.com Git - wxWidgets.git/blobdiff - src/cocoa/dc.mm
Include missing.h to find O_* flags.
[wxWidgets.git] / src / cocoa / dc.mm
index 3a0e7c3657ba2697880805b198a6453eed4ab387..3358de935e0bb6d77aa2b43445d9f0861b04553c 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     2003/04/01
 // RCS-ID:      $Id$
 // Copyright:   (c) 2003 David Elliott
-// Licence:    wxWindows license
+// Licence:    wxWidgets licence
 /////////////////////////////////////////////////////////////////////////////
 
 #include "wx/wxprec.h"
@@ -98,10 +98,10 @@ void wxDC::CocoaShutdownTextSystem()
 
 void wxDC::CocoaUnwindStackAndLoseFocus()
 {
-    wxCocoaDCStack::Node *ourNode=sm_cocoaDCStack.Find(this);
+    wxCocoaDCStack::compatibility_iterator ourNode=sm_cocoaDCStack.Find(this);
     if(ourNode)
     {
-        wxCocoaDCStack::Node *node=sm_cocoaDCStack.GetFirst();
+        wxCocoaDCStack::compatibility_iterator node=sm_cocoaDCStack.GetFirst();
         for(;node!=ourNode; node=sm_cocoaDCStack.GetFirst())
         {
             wxDC *dc = node->GetData();
@@ -111,18 +111,18 @@ void wxDC::CocoaUnwindStackAndLoseFocus()
             {
                 wxFAIL_MSG(wxT("Unable to unlock focus on higher-level DC!"));
             }
-            sm_cocoaDCStack.DeleteNode(node);
+            sm_cocoaDCStack.Erase(node);
         }
         wxASSERT(node==ourNode);
         wxASSERT(ourNode->GetData() == this);
         ourNode->GetData()->CocoaUnlockFocus();
-        sm_cocoaDCStack.DeleteNode(ourNode);
+        sm_cocoaDCStack.Erase(ourNode);
     }
 }
 
 bool wxDC::CocoaUnwindStackAndTakeFocus()
 {
-    wxCocoaDCStack::Node *node=sm_cocoaDCStack.GetFirst();
+    wxCocoaDCStack::compatibility_iterator node=sm_cocoaDCStack.GetFirst();
     for(;node;node = sm_cocoaDCStack.GetFirst())
     {
         wxDC *dc = node->GetData();
@@ -133,7 +133,7 @@ bool wxDC::CocoaUnwindStackAndTakeFocus()
         // If unable to unlockFocus (e.g. wxPaintDC) stop here
         if(!dc->CocoaUnlockFocus())
             break;
-        sm_cocoaDCStack.DeleteNode(node);
+        sm_cocoaDCStack.Erase(node);
     }
     return CocoaLockFocus();
 }
@@ -183,6 +183,7 @@ void wxDC::CocoaApplyTransformations()
 
 void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
 {
+    wxAutoNSAutoreleasePool pool;
     if(!CocoaTakeFocus()) return;
     NSBezierPath *bezpath = [NSBezierPath bezierPathWithRect:NSMakeRect(x,y,width,height)];
     CocoaSetPenForNSBezierPath(m_pen,bezpath);
@@ -193,6 +194,7 @@ void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
 
 void wxDC::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
 {
+    wxAutoNSAutoreleasePool pool;
     if(!CocoaTakeFocus()) return;
     NSBezierPath *bezpath = [NSBezierPath bezierPath];
     [bezpath moveToPoint:NSMakePoint(x1,y1)];
@@ -226,6 +228,7 @@ void wxDC::DoGetTextExtent(const wxString& text, wxCoord *x, wxCoord *y, wxCoord
 
 void wxDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y)
 {
+    wxAutoNSAutoreleasePool pool;
     if(!CocoaTakeFocus()) return;
     wxASSERT_MSG(sm_cocoaNSTextStorage && sm_cocoaNSLayoutManager && sm_cocoaNSTextContainer, wxT("Text system has not been initialized.  BAD PROGRAMMER!"));
     NSAttributedString *attributedString = [[NSAttributedString alloc]
@@ -449,6 +452,7 @@ void wxDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
 
 void wxDC::DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask)
 {
+    wxAutoNSAutoreleasePool pool;
     if(!CocoaTakeFocus()) return;
     if(!bmp.Ok())
         return;