epoc32/include/mw/eikrutil.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/mw/eikrutil.h	Wed Mar 31 12:27:01 2010 +0100
     1.3 @@ -0,0 +1,85 @@
     1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef __EIKRUTIL_H__
    1.20 +#define __EIKRUTIL_H__
    1.21 +
    1.22 +#include <e32std.h>
    1.23 +#include <gulutil.h>
    1.24 +
    1.25 +class CFbsFont;
    1.26 +class CEikonEnv;
    1.27 +class CWsScreenDevice;
    1.28 +class TResourceReader;
    1.29 +
    1.30 +
    1.31 +/** Provides utilities for reading standard resources. 
    1.32 +
    1.33 +@publishedAll 
    1.34 +@released */
    1.35 +NONSHARABLE_CLASS(EikResourceUtils)
    1.36 +	{
    1.37 +public:
    1.38 +	inline static CFbsFont* CreateScreenFontL(TResourceReader& aResourceReader,CWsScreenDevice& aScreenDevice);
    1.39 +	IMPORT_C static CFbsFont* CreateScreenFontL(TInt aResourceId,CEikonEnv* aEnv=NULL);
    1.40 +	inline static TInt8 ReadTInt8L(TInt aResourceId,CEikonEnv* aEnv=NULL);
    1.41 +	inline static TInt16 ReadTInt16L(TInt aResourceId,CEikonEnv* aEnv=NULL);
    1.42 +	inline static TInt32 ReadTInt32L(TInt aResourceId,CEikonEnv* aEnv=NULL);
    1.43 +	IMPORT_C static CColorArray* CreateColorArrayL(TInt aResourceId,CEikonEnv* aEnv=NULL);
    1.44 +	IMPORT_C static CColorArray* CreateColorArrayLC(TInt aResourceId,CEikonEnv* aEnv=NULL);
    1.45 +private:
    1.46 +	enum TResourceTypeInt { EResourceInt8,EResourceInt16,EResourceInt32 };
    1.47 +private:
    1.48 +	IMPORT_C static TInt32 ReadResourceIntL(TInt aResourceId, CEikonEnv* aEnv, TResourceTypeInt aSize);
    1.49 +	EikResourceUtils();
    1.50 +	};
    1.51 +
    1.52 +/** Create a screen font from resource.
    1.53 +
    1.54 +Creates a font for the specified screen device by reading a font UID and font 
    1.55 +flags from the given position in a resource. Returns a pointer to the font 
    1.56 +and transfers ownership.
    1.57 +
    1.58 +@param aResourceReader The resource reader to use to read the font. 
    1.59 +@param aScreenDevice The screen device for which the font will be created. 
    1.60 +@return Screen font object. */
    1.61 +inline CFbsFont* EikResourceUtils::CreateScreenFontL(TResourceReader& aResourceReader,CWsScreenDevice& aScreenDevice)
    1.62 +	{	return(ResourceUtils::CreateScreenFontL(aResourceReader,aScreenDevice));	}
    1.63 +
    1.64 +/** Gets the 8 bit signed integer held in a specified resource location.
    1.65 +
    1.66 +@param aResourceId The location in the resource to be read. 
    1.67 +@param aEnv The UI environment. 
    1.68 +@return The eight bits that follow the specified location in the resource. */
    1.69 +inline TInt8 EikResourceUtils::ReadTInt8L(TInt aResourceId,CEikonEnv* aEnv)
    1.70 +	{	return static_cast<TInt8>(ReadResourceIntL(aResourceId,aEnv,EResourceInt8));	}
    1.71 +
    1.72 +/** Gets the 16 bit signed integer held in a specified resource location.
    1.73 +
    1.74 +@param aResourceId The location in the resource to be read. 
    1.75 +@param aEnv The UI environment. 
    1.76 +@return The 16 bits that follow the specified location in the resource. */
    1.77 +inline TInt16 EikResourceUtils::ReadTInt16L(TInt aResourceId,CEikonEnv* aEnv)
    1.78 +	{	return static_cast<TInt16>(ReadResourceIntL(aResourceId,aEnv,EResourceInt16));	}
    1.79 +
    1.80 +/** Gets the 32 bit signed integer held in a specified resource location.
    1.81 +
    1.82 +@param aResourceId The location in the resource to be read. 
    1.83 +@param aEnv The UI environment. 
    1.84 +@return The 32 bits that follow the specified location in the resource. */
    1.85 +inline TInt32 EikResourceUtils::ReadTInt32L(TInt aResourceId,CEikonEnv* aEnv)
    1.86 +	{	return static_cast<TInt32>(ReadResourceIntL(aResourceId,aEnv,EResourceInt32));	}
    1.87 +
    1.88 +#endif	// __EIKRUTIL_H__