From 21aa2122f431577c62fdd9026a0e5052ac8f9c60 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Sun, 23 Feb 2014 19:02:58 +0000 Subject: [PATCH] make sure a frozen control calls a native 'thaw' on the tlw during destruction, otherwise tlws might end up unresponsive, see #16011 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75993 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/osx/cocoa/private.h | 2 ++ src/osx/carbon/utilscocoa.mm | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/wx/osx/cocoa/private.h b/include/wx/osx/cocoa/private.h index e92df39539..37eb0b7091 100644 --- a/include/wx/osx/cocoa/private.h +++ b/include/wx/osx/cocoa/private.h @@ -33,7 +33,9 @@ OSStatus WXDLLIMPEXP_CORE wxMacDrawCGImage( const CGRect * inBounds, CGImageRef inImage) ; WX_NSImage WXDLLIMPEXP_CORE wxOSXGetNSImageFromCGImage( CGImageRef image, double scale = 1.0 ); +WX_NSImage WXDLLIMPEXP_CORE wxOSXGetNSImageFromIconRef( WXHICON iconref ); CGImageRef WXDLLIMPEXP_CORE wxOSXCreateCGImageFromNSImage( WX_NSImage nsimage, double *scale = NULL ); +CGImageRef WXDLLIMPEXP_CORE wxOSXGetCGImageFromNSImage( const WX_NSImage nsimage, CGRect* r, CGContextRef cg); CGContextRef WXDLLIMPEXP_CORE wxOSXCreateBitmapContextFromNSImage( WX_NSImage nsimage); wxBitmap WXDLLIMPEXP_CORE wxOSXCreateSystemBitmap(const wxString& id, const wxString &client, const wxSize& size); diff --git a/src/osx/carbon/utilscocoa.mm b/src/osx/carbon/utilscocoa.mm index 3dec92f22d..5ffad95e1c 100644 --- a/src/osx/carbon/utilscocoa.mm +++ b/src/osx/carbon/utilscocoa.mm @@ -447,6 +447,20 @@ WX_NSImage wxOSXGetNSImageFromCGImage( CGImageRef image, double scaleFactor ) return( newImage ); } +WX_NSImage WXDLLIMPEXP_CORE wxOSXGetNSImageFromIconRef( WXHICON iconref ) +{ + NSImage *newImage = [[NSImage alloc] initWithIconRef:iconref]; + [newImage autorelease]; + return( newImage ); +} + +CGImageRef WXDLLIMPEXP_CORE wxOSXGetCGImageFromNSImage( WX_NSImage nsimage, CGRect* r, CGContextRef cg) +{ + return [nsimage CGImageForProposedRect:r + context:[NSGraphicsContext graphicsContextWithGraphicsPort:cg flipped:NO] + hints:nil]; +} + CGContextRef WXDLLIMPEXP_CORE wxOSXCreateBitmapContextFromNSImage( WX_NSImage nsimage) { // based on http://www.mail-archive.com/cocoa-dev@lists.apple.com/msg18065.html