uidesigner/com.nokia.sdt.series60.componentlibrary/components/LoadAndScaleIconL.inc
author chpeckha
Tue, 25 May 2010 13:19:07 -0500
changeset 1398 53b756905916
parent 0 fb279309251b
permissions -rw-r--r--
put all symbian build commands under a sub-menu for context menus only to make context menu smaller

		<defineLocation id="LOADANDSCALEICONL_METHOD" baseLocation="MAIN_FILE"
			owned="true"
			location="function(${className}::LoadAndScaleIconL(const TDesC&amp;,TInt,TInt,TSize*,TScaleMode))">
			<template><![CDATA[
/**
 *	This routine loads and scales a bitmap or icon.
 *
 *	@param aFileName the MBM or MIF filename
 *	@param aBitmapId the bitmap id
 *	@param aMaskId the mask id or -1 for none
 *	@param aSize the TSize for the icon, or NULL to use real size
 *	@param aScaleMode one of the EAspectRatio* enums when scaling
 *
 */
CGulIcon* ${className}::LoadAndScaleIconL( 
		const TDesC& aFileName,
		TInt aBitmapId, 
		TInt aMaskId, 
		TSize* aSize, 
		TScaleMode aScaleMode )
	{
	CFbsBitmap* bitmap;
	CFbsBitmap* mask;
	AknIconUtils::CreateIconL( bitmap, mask, aFileName, aBitmapId, aMaskId );
	
	TSize size;
	if ( aSize == NULL )
		{
		// Use size from the image header.  In case of SVG,
		// we preserve the image data for a while longer, since ordinarily
		// it is disposed at the first GetContentDimensions() or SetSize() call.
		AknIconUtils::PreserveIconData( bitmap );
		AknIconUtils::GetContentDimensions( bitmap, size );
		}
	else
		{
		size = *aSize;
		}
	
	AknIconUtils::SetSize( bitmap, size, aScaleMode );
	AknIconUtils::SetSize( mask, size, aScaleMode );
	
	if ( aSize == NULL )
		{
		AknIconUtils::DestroyIconData( bitmap );
		}
	
	return CGulIcon::NewL( bitmap, mask );
	}
]]>
			</template>
		</defineLocation>