icns support from resources

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@49034 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2007-10-04 07:32:09 +00:00
parent 00ae2ece4a
commit 9ad88af224

View File

@@ -128,18 +128,34 @@ bool wxIcon::LoadFile(
} }
else else
{ {
#if 0 IconRef iconRef = NULL ;
Str255 theName ;
OSType theType ; // first look in the resource fork
wxMacStringToPascal( name , theName ) ; if ( iconRef == NULL )
{
Str255 theName ;
Handle resHandle = GetNamedResource( 'cicn' , theName ) ; wxMacStringToPascal( filename , theName ) ;
if ( resHandle != 0L ) 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);
wxASSERT_MSG( err == noErr , wxT("Error when constructing icon ref") );
ReleaseResource( resHandle ) ;
}
}
if ( iconRef == NULL )
{ {
GetResInfo( resHandle , &theId , &theType , theName ) ; // TODO add other attempts to load it from files etc here
ReleaseResource( resHandle ) ;
} }
#endif if ( iconRef )
{
m_refData = new wxIconRefData( (WXHICON) iconRef ) ;
return true ;
}
} }
if ( theId != 0 ) if ( theId != 0 )