]> git.saurik.com Git - wxWidgets.git/blobdiff - src/cocoa/window.mm
don't use parent window of a TLW in HandleOnNavigationKey(), even if it's apparently...
[wxWidgets.git] / src / cocoa / window.mm
index 5fdc4548dd584bed48aaefa195bb35ddc3c5b682..8449277a890243996102c5f838ac249da583c70f 100644 (file)
     #include "wx/log.h"
     #include "wx/window.h"
     #include "wx/dc.h"
+    #include "wx/dcclient.h"
     #include "wx/utils.h"
 #endif //WX_PRECOMP
 
 #include "wx/tooltip.h"
 
+#include "wx/cocoa/dc.h"
 #include "wx/cocoa/autorelease.h"
 #include "wx/cocoa/string.h"
 #include "wx/cocoa/trackingrectmanager.h"
 #include "wx/mac/corefoundation/cfref.h"
+#include "wx/cocoa/ObjcRef.h"
 
 #import <Foundation/NSArray.h>
 #import <Foundation/NSRunLoop.h>
@@ -1107,8 +1110,8 @@ void wxWindowCocoa::SetNSView(WX_NSView cocoaNSView)
     bool need_debug = cocoaNSView || m_cocoaNSView;
     if(need_debug) wxLogTrace(wxTRACE_COCOA_RetainRelease,wxT("wxWindowCocoa=%p::SetNSView [m_cocoaNSView=%p retainCount]=%d"),this,m_cocoaNSView,[m_cocoaNSView retainCount]);
     DisassociateNSView(m_cocoaNSView);
-    [cocoaNSView retain];
-    [m_cocoaNSView release];
+    wxGCSafeRetain(cocoaNSView);
+    wxGCSafeRelease(m_cocoaNSView);
     m_cocoaNSView = cocoaNSView;
     AssociateNSView(m_cocoaNSView);
     if(need_debug) wxLogTrace(wxTRACE_COCOA_RetainRelease,wxT("wxWindowCocoa=%p::SetNSView [cocoaNSView=%p retainCount]=%d"),this,cocoaNSView,[cocoaNSView retainCount]);
@@ -1157,7 +1160,7 @@ NSRect wxWindowCocoa::CocoaTransformWxToBounds(NSRect rectWx)
 WX_NSAffineTransform wxWindowCocoa::CocoaGetWxToBoundsTransform()
 {
     // TODO: Handle scrolling offset
-    NSAffineTransform *transform = wxDC::CocoaGetWxToBoundsTransform([GetNSView() isFlipped], [GetNSView() bounds].size.height);
+    NSAffineTransform *transform = wxCocoaDCImpl::CocoaGetWxToBoundsTransform([GetNSView() isFlipped], [GetNSView() bounds].size.height);
     return transform;
 }
 
@@ -1782,7 +1785,7 @@ void wxWindow::GetTextExtent(const wxString& string, int *outX, int *outY,
     // transformations.  However, it's better than nothing.
     // We don't create a wxClientDC because we don't want to accidently be able to use
     // it for drawing.
-    wxDC tmpdc;
+    wxClientDC tmpdc(const_cast<wxWindow*>(this));
     return tmpdc.GetTextExtent(string, outX, outY, outDescent, outExternalLeading, inFont);
 }