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