]> git.saurik.com Git - wxWidgets.git/commitdiff
support icns in bundle
authorStefan Csomor <csomor@advancedconcepts.ch>
Wed, 19 Jan 2011 18:32:53 +0000 (18:32 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Wed, 19 Jan 2011 18:32:53 +0000 (18:32 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66719 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/carbon/icon.cpp

index f391772e7574a505bec129d9dec02cb17c4fc4a1..50bd2b8c5a17e9b70eb769b055b31a7809c68b57 100644 (file)
@@ -321,6 +321,25 @@ bool wxIcon::LoadIconFromBundleResource(const wxString& resourceName, int desire
             ReleaseResource( resHandle ) ;
         }
     }
+    if ( iconRef == NULL )
+    {
+        wxCFStringRef name(resourceName);
+        FSRef iconFSRef;
+        
+        wxCFRef<CFURLRef> 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 )
     {