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
{
#if 0
Str255 theName ;
OSType theType ;
wxMacStringToPascal( name , theName ) ;
IconRef iconRef = NULL ;
Handle resHandle = GetNamedResource( 'cicn' , theName ) ;
// first look in the resource fork
if ( iconRef == NULL )
{
Str255 theName ;
wxMacStringToPascal( filename , theName ) ;
Handle resHandle = GetNamedResource( 'icns' , theName ) ;
if ( resHandle != 0L )
{
GetResInfo( resHandle , &theId , &theType , theName ) ;
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 ) ;
}
#endif
}
if ( iconRef == NULL )
{
// TODO add other attempts to load it from files etc here
}
if ( iconRef )
{
m_refData = new wxIconRefData( (WXHICON) iconRef ) ;
return true ;
}
}
if ( theId != 0 )