uidesigner/com.nokia.sdt.series60.componentlibrary/components/LoadAndScaleIconL.inc
changeset 0 fb279309251b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uidesigner/com.nokia.sdt.series60.componentlibrary/components/LoadAndScaleIconL.inc	Fri Apr 03 23:33:03 2009 +0100
@@ -0,0 +1,52 @@
+		<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>
\ No newline at end of file