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