X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/938156b25541ff200404018f8e6721686a046829..7d6a4d96961eac84d05db8bb24c64d39003f6e54:/src/cocoa/dc.mm diff --git a/src/cocoa/dc.mm b/src/cocoa/dc.mm index e371df92cd..0f24ba758f 100644 --- a/src/cocoa/dc.mm +++ b/src/cocoa/dc.mm @@ -6,7 +6,7 @@ // Created: 2003/04/01 // RCS-ID: $Id$ // Copyright: (c) 2003 David Elliott -// Licence: wxWidgets licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #include "wx/wxprec.h" @@ -20,6 +20,7 @@ #include "wx/cocoa/autorelease.h" #include "wx/cocoa/string.h" +#include "wx/cocoa/ObjcRef.h" #import #import @@ -75,11 +76,16 @@ inline void CocoaSetPenForNSBezierPath(wxPen &pen, NSBezierPath *bezpath) void wxCocoaDCImpl::CocoaInitializeTextSystem() { + wxAutoNSAutoreleasePool pool; + wxASSERT_MSG(!sm_cocoaNSTextStorage && !sm_cocoaNSLayoutManager && !sm_cocoaNSTextContainer,wxT("Text system already initalized! BAD PROGRAMMER!")); - sm_cocoaNSTextStorage = [[NSTextStorage alloc] init]; + // FIXME: Never released + sm_cocoaNSTextStorage = wxGCSafeRetain([[[NSTextStorage alloc] init] autorelease]); + + // FIXME: Never released + sm_cocoaNSLayoutManager = wxGCSafeRetain([[[NSLayoutManager alloc] init] autorelease]); - sm_cocoaNSLayoutManager = [[NSLayoutManager alloc] init]; [sm_cocoaNSTextStorage addLayoutManager:sm_cocoaNSLayoutManager]; // NSTextStorage retains NSLayoutManager, but so do we // [sm_cocoaNSLayoutManager release]; [sm_cocoaNSLayoutManager retain]; @@ -87,7 +93,8 @@ void wxCocoaDCImpl::CocoaInitializeTextSystem() // NOTE: initWithContainerSize is the designated initializer, but the // Apple CircleView sample gets away with just calling init, which // is all we really need for our purposes. - sm_cocoaNSTextContainer = [[NSTextContainer alloc] init]; + // FIXME: Never released + sm_cocoaNSTextContainer = wxGCSafeRetain([[[NSTextContainer alloc] init] autorelease]); [sm_cocoaNSLayoutManager addTextContainer:sm_cocoaNSTextContainer]; // NSLayoutManager retains NSTextContainer, but so do we // [sm_cocoaNSTextContainer release]; [sm_cocoaNSTextContainer retain]; @@ -355,7 +362,7 @@ void wxCocoaDCImpl::DoDrawPoint( int x, int y ) { }; -void wxCocoaDCImpl::DoDrawPolygon( int, wxPoint *, int, int, int) +void wxCocoaDCImpl::DoDrawPolygon( int, wxPoint *, int, int, wxPolygonFillMode) { }; @@ -449,7 +456,7 @@ void wxCocoaDCImpl::DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, bool { wxAutoNSAutoreleasePool pool; if(!CocoaTakeFocus()) return; - if(!bmp.Ok()) + if(!bmp.IsOk()) return; #if 0 @@ -492,7 +499,7 @@ void wxCocoaDCImpl::DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, bool [context restoreGraphicsState]; } -bool wxCocoaDCImpl::DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, int style) +bool wxCocoaDCImpl::DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, wxFloodFillStyle style) { return false; } @@ -502,7 +509,7 @@ void wxCocoaDCImpl::DoCrossHair(wxCoord x, wxCoord y) } -bool wxCocoaDCImpl::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop, bool useMask , wxCoord xsrcMask, wxCoord ysrcMask) +bool wxCocoaDCImpl::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC *source, wxCoord xsrc, wxCoord ysrc, wxRasterOperationMode rop, bool useMask , wxCoord xsrcMask, wxCoord ysrcMask) { if(!CocoaTakeFocus()) return false; if(!source) return false; @@ -533,13 +540,13 @@ void wxCocoaDCImpl::DoGetSizeMM( int* width, int* height ) const void wxCocoaDCImpl::SetTextForeground( const wxColour &col ) { -// if (!Ok()) return; +// if (!IsOk()) return; m_textForegroundColour = col; }; void wxCocoaDCImpl::SetTextBackground( const wxColour &col ) { -// if (!Ok()) return; +// if (!IsOk()) return; m_textBackgroundColour = col; }; @@ -572,12 +579,12 @@ void wxCocoaDCImpl::SetPalette(const wxPalette&) { } -void wxCocoaDCImpl::SetLogicalFunction(int) +void wxCocoaDCImpl::SetLogicalFunction(wxRasterOperationMode) { } -void wxCocoaDCImpl::SetMapMode( int mode ) +void wxCocoaDCImpl::SetMapMode( wxMappingMode mode ) { switch (mode) {