uidesigner/com.nokia.sdt.series60.componentlibrary/components/LoadAndScaleIconL.inc
changeset 0 fb279309251b
equal deleted inserted replaced
-1:000000000000 0:fb279309251b
       
     1 		<defineLocation id="LOADANDSCALEICONL_METHOD" baseLocation="MAIN_FILE"
       
     2 			owned="true"
       
     3 			location="function(${className}::LoadAndScaleIconL(const TDesC&amp;,TInt,TInt,TSize*,TScaleMode))">
       
     4 			<template><![CDATA[
       
     5 /**
       
     6  *	This routine loads and scales a bitmap or icon.
       
     7  *
       
     8  *	@param aFileName the MBM or MIF filename
       
     9  *	@param aBitmapId the bitmap id
       
    10  *	@param aMaskId the mask id or -1 for none
       
    11  *	@param aSize the TSize for the icon, or NULL to use real size
       
    12  *	@param aScaleMode one of the EAspectRatio* enums when scaling
       
    13  *
       
    14  */
       
    15 CGulIcon* ${className}::LoadAndScaleIconL( 
       
    16 		const TDesC& aFileName,
       
    17 		TInt aBitmapId, 
       
    18 		TInt aMaskId, 
       
    19 		TSize* aSize, 
       
    20 		TScaleMode aScaleMode )
       
    21 	{
       
    22 	CFbsBitmap* bitmap;
       
    23 	CFbsBitmap* mask;
       
    24 	AknIconUtils::CreateIconL( bitmap, mask, aFileName, aBitmapId, aMaskId );
       
    25 	
       
    26 	TSize size;
       
    27 	if ( aSize == NULL )
       
    28 		{
       
    29 		// Use size from the image header.  In case of SVG,
       
    30 		// we preserve the image data for a while longer, since ordinarily
       
    31 		// it is disposed at the first GetContentDimensions() or SetSize() call.
       
    32 		AknIconUtils::PreserveIconData( bitmap );
       
    33 		AknIconUtils::GetContentDimensions( bitmap, size );
       
    34 		}
       
    35 	else
       
    36 		{
       
    37 		size = *aSize;
       
    38 		}
       
    39 	
       
    40 	AknIconUtils::SetSize( bitmap, size, aScaleMode );
       
    41 	AknIconUtils::SetSize( mask, size, aScaleMode );
       
    42 	
       
    43 	if ( aSize == NULL )
       
    44 		{
       
    45 		AknIconUtils::DestroyIconData( bitmap );
       
    46 		}
       
    47 	
       
    48 	return CGulIcon::NewL( bitmap, mask );
       
    49 	}
       
    50 ]]>
       
    51 			</template>
       
    52 		</defineLocation>