williamr@2
|
1 |
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@4
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@4
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
#ifndef __EIKRUTIL_H__
|
williamr@2
|
17 |
#define __EIKRUTIL_H__
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#include <e32std.h>
|
williamr@2
|
20 |
#include <gulutil.h>
|
williamr@2
|
21 |
|
williamr@2
|
22 |
class CFbsFont;
|
williamr@2
|
23 |
class CEikonEnv;
|
williamr@2
|
24 |
class CWsScreenDevice;
|
williamr@2
|
25 |
class TResourceReader;
|
williamr@2
|
26 |
|
williamr@2
|
27 |
|
williamr@2
|
28 |
/** Provides utilities for reading standard resources.
|
williamr@2
|
29 |
|
williamr@2
|
30 |
@publishedAll
|
williamr@2
|
31 |
@released */
|
williamr@2
|
32 |
NONSHARABLE_CLASS(EikResourceUtils)
|
williamr@2
|
33 |
{
|
williamr@2
|
34 |
public:
|
williamr@2
|
35 |
inline static CFbsFont* CreateScreenFontL(TResourceReader& aResourceReader,CWsScreenDevice& aScreenDevice);
|
williamr@2
|
36 |
IMPORT_C static CFbsFont* CreateScreenFontL(TInt aResourceId,CEikonEnv* aEnv=NULL);
|
williamr@2
|
37 |
inline static TInt8 ReadTInt8L(TInt aResourceId,CEikonEnv* aEnv=NULL);
|
williamr@2
|
38 |
inline static TInt16 ReadTInt16L(TInt aResourceId,CEikonEnv* aEnv=NULL);
|
williamr@2
|
39 |
inline static TInt32 ReadTInt32L(TInt aResourceId,CEikonEnv* aEnv=NULL);
|
williamr@2
|
40 |
IMPORT_C static CColorArray* CreateColorArrayL(TInt aResourceId,CEikonEnv* aEnv=NULL);
|
williamr@2
|
41 |
IMPORT_C static CColorArray* CreateColorArrayLC(TInt aResourceId,CEikonEnv* aEnv=NULL);
|
williamr@2
|
42 |
private:
|
williamr@2
|
43 |
enum TResourceTypeInt { EResourceInt8,EResourceInt16,EResourceInt32 };
|
williamr@2
|
44 |
private:
|
williamr@2
|
45 |
IMPORT_C static TInt32 ReadResourceIntL(TInt aResourceId, CEikonEnv* aEnv, TResourceTypeInt aSize);
|
williamr@2
|
46 |
EikResourceUtils();
|
williamr@2
|
47 |
};
|
williamr@2
|
48 |
|
williamr@2
|
49 |
/** Create a screen font from resource.
|
williamr@2
|
50 |
|
williamr@2
|
51 |
Creates a font for the specified screen device by reading a font UID and font
|
williamr@2
|
52 |
flags from the given position in a resource. Returns a pointer to the font
|
williamr@2
|
53 |
and transfers ownership.
|
williamr@2
|
54 |
|
williamr@2
|
55 |
@param aResourceReader The resource reader to use to read the font.
|
williamr@2
|
56 |
@param aScreenDevice The screen device for which the font will be created.
|
williamr@2
|
57 |
@return Screen font object. */
|
williamr@2
|
58 |
inline CFbsFont* EikResourceUtils::CreateScreenFontL(TResourceReader& aResourceReader,CWsScreenDevice& aScreenDevice)
|
williamr@2
|
59 |
{ return(ResourceUtils::CreateScreenFontL(aResourceReader,aScreenDevice)); }
|
williamr@2
|
60 |
|
williamr@2
|
61 |
/** Gets the 8 bit signed integer held in a specified resource location.
|
williamr@2
|
62 |
|
williamr@2
|
63 |
@param aResourceId The location in the resource to be read.
|
williamr@2
|
64 |
@param aEnv The UI environment.
|
williamr@2
|
65 |
@return The eight bits that follow the specified location in the resource. */
|
williamr@2
|
66 |
inline TInt8 EikResourceUtils::ReadTInt8L(TInt aResourceId,CEikonEnv* aEnv)
|
williamr@2
|
67 |
{ return static_cast<TInt8>(ReadResourceIntL(aResourceId,aEnv,EResourceInt8)); }
|
williamr@2
|
68 |
|
williamr@2
|
69 |
/** Gets the 16 bit signed integer held in a specified resource location.
|
williamr@2
|
70 |
|
williamr@2
|
71 |
@param aResourceId The location in the resource to be read.
|
williamr@2
|
72 |
@param aEnv The UI environment.
|
williamr@2
|
73 |
@return The 16 bits that follow the specified location in the resource. */
|
williamr@2
|
74 |
inline TInt16 EikResourceUtils::ReadTInt16L(TInt aResourceId,CEikonEnv* aEnv)
|
williamr@2
|
75 |
{ return static_cast<TInt16>(ReadResourceIntL(aResourceId,aEnv,EResourceInt16)); }
|
williamr@2
|
76 |
|
williamr@2
|
77 |
/** Gets the 32 bit signed integer held in a specified resource location.
|
williamr@2
|
78 |
|
williamr@2
|
79 |
@param aResourceId The location in the resource to be read.
|
williamr@2
|
80 |
@param aEnv The UI environment.
|
williamr@2
|
81 |
@return The 32 bits that follow the specified location in the resource. */
|
williamr@2
|
82 |
inline TInt32 EikResourceUtils::ReadTInt32L(TInt aResourceId,CEikonEnv* aEnv)
|
williamr@2
|
83 |
{ return static_cast<TInt32>(ReadResourceIntL(aResourceId,aEnv,EResourceInt32)); }
|
williamr@2
|
84 |
|
williamr@2
|
85 |
#endif // __EIKRUTIL_H__
|