From: Stefan Csomor Date: Wed, 19 Jan 2011 18:32:53 +0000 (+0000) Subject: support icns in bundle X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/d2ec5847d6cf4b1bd45a60682eeb32cee5b07ea4 support icns in bundle git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66719 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/osx/carbon/icon.cpp b/src/osx/carbon/icon.cpp index f391772e75..50bd2b8c5a 100644 --- a/src/osx/carbon/icon.cpp +++ b/src/osx/carbon/icon.cpp @@ -321,6 +321,25 @@ bool wxIcon::LoadIconFromBundleResource(const wxString& resourceName, int desire ReleaseResource( resHandle ) ; } } + if ( iconRef == NULL ) + { + wxCFStringRef name(resourceName); + FSRef iconFSRef; + + wxCFRef iconURL(CFBundleCopyResourceURL(CFBundleGetMainBundle(), name, CFSTR("icns"), NULL)); + + if (CFURLGetFSRef(iconURL, &iconFSRef)) + { + // Get a handle on the icon family + IconFamilyHandle iconFamily; + OSStatus err = ReadIconFromFSRef( &iconFSRef, &iconFamily ); + + if ( err == noErr ) + { + err = GetIconRefFromIconFamilyPtr( *iconFamily, GetHandleSize((Handle) iconFamily), &iconRef ); + } + } + } if ( iconRef ) {