- {/*
- Str255 theName ;
- OSType theType ;
- wxMacStringToPascal( name , theName ) ;
-
- Handle resHandle = GetNamedResource( 'cicn' , theName ) ;
- if ( resHandle != 0L )
+ {
+ IconRef iconRef = NULL ;
+
+ // first look in the resource fork
+ if ( iconRef == NULL )
+ {
+ Str255 theName ;
+
+ wxMacStringToPascal( filename , theName ) ;
+ Handle resHandle = GetNamedResource( 'icns' , theName ) ;
+ if ( resHandle != 0L )
+ {
+ IconFamilyHandle iconFamily = (IconFamilyHandle) resHandle ;
+ HLock((Handle) iconFamily);
+ OSStatus err = GetIconRefFromIconFamilyPtr( *iconFamily, GetHandleSize((Handle) iconFamily), &iconRef );
+ HUnlock((Handle) iconFamily);
+ if ( err != noErr )
+ {
+ wxFAIL_MSG("Error when constructing icon ref");
+ }
+
+ ReleaseResource( resHandle ) ;
+ }
+ }
+ if ( iconRef == NULL )