|
1 /* |
|
2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Phonebook 2 icon information. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPBK2ICONINFO_H |
|
20 #define CPBK2ICONINFO_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <badesca.h> |
|
25 #include <TPbk2IconId.h> |
|
26 #include <AknsItemID.h> |
|
27 |
|
28 // CLASS DECLARATION |
|
29 class CFbsBitmap; |
|
30 |
|
31 /** |
|
32 * Phonebook 2 icon information. |
|
33 * Responsible for reading the icon information from a PBK2_ICON_INFO |
|
34 * resource structure. |
|
35 */ |
|
36 class CPbk2IconInfo : public CBase |
|
37 { |
|
38 public: // Construction and destruction |
|
39 /** |
|
40 * Creates a new instance of this class. |
|
41 * |
|
42 * @param aReader Resource reader pointed |
|
43 * to a PBK2_ICON_INFO resource. |
|
44 * @param aMbmFileNames Descriptor array for bitmap file names. |
|
45 * @return A new instance of this class. |
|
46 */ |
|
47 static CPbk2IconInfo* NewLC( |
|
48 TResourceReader& aReader, |
|
49 CDesCArray& aMbmFileNames ); |
|
50 |
|
51 /** |
|
52 * Creates a new instance of this class. |
|
53 * |
|
54 * @param aPbk2IconId Phonebook icon id. |
|
55 * |
|
56 * @param aBitmap Bitmap. |
|
57 * @param aMask Mask. |
|
58 * @param aSize Size to use. |
|
59 * @return A new instance of this class. |
|
60 */ |
|
61 IMPORT_C static CPbk2IconInfo* NewLC( |
|
62 TPbk2IconId aPbk2IconId, |
|
63 const CFbsBitmap* aBitmap, |
|
64 const CFbsBitmap* aMask, |
|
65 const TSize aSize ); |
|
66 |
|
67 /** |
|
68 * Creates a new instance of this class. |
|
69 * |
|
70 * @param aPbk2IconId Phonebook icon id. |
|
71 * @param aIconId Icon bitmap id. |
|
72 * @param aMaskId Mask bitmap id. |
|
73 * @param aMbmFileName Mbm file name. |
|
74 * @param aSkinId Skin id. |
|
75 * @param aColorId skin color table id. |
|
76 * @param aColorIndex Index of the icon color in color table. |
|
77 * @param aDefaultColorIndex Index of the default color. |
|
78 * @return A new instance of this class. |
|
79 */ |
|
80 IMPORT_C static CPbk2IconInfo* NewLC( |
|
81 TPbk2IconId aPbk2IconId, |
|
82 TInt aIconId, |
|
83 TInt aMaskId, |
|
84 TPtrC aMbmFileName, |
|
85 TAknsItemID aSkinId, |
|
86 TAknsItemID aColorId, |
|
87 TInt aColorIndex, |
|
88 TInt aDefaultColorIndex ); |
|
89 |
|
90 /** |
|
91 * Destructor. |
|
92 */ |
|
93 ~CPbk2IconInfo(); |
|
94 |
|
95 public: // Interface |
|
96 |
|
97 /** |
|
98 * Returns the unique Phonebook 2 icon id of this icon. |
|
99 * |
|
100 * @return Unique Phonebook2 icon id of this icon. |
|
101 */ |
|
102 const TPbk2IconId& Pbk2IconId() const; |
|
103 |
|
104 /** |
|
105 * Returns the bitmap file name of this icon. |
|
106 * |
|
107 * @return The bitmap file name of this icon. |
|
108 */ |
|
109 const TDesC& MbmFileName() const; |
|
110 |
|
111 /** |
|
112 * Returns this icon's id in the bitmap file. |
|
113 * |
|
114 * @return This icon's id in the bitmap file. |
|
115 */ |
|
116 TInt IconId() const; |
|
117 |
|
118 /** |
|
119 * Returns this icon's mask id in the bitmap file. |
|
120 * |
|
121 * @return This icon's mask id in the bitmap file. |
|
122 */ |
|
123 TInt MaskId() const; |
|
124 |
|
125 /** |
|
126 * Returns this icon's skin id. |
|
127 * |
|
128 * @return This icon's skin id. |
|
129 */ |
|
130 TAknsItemID SkinId() const; |
|
131 |
|
132 /** |
|
133 * Returns this icon's color table id. |
|
134 * |
|
135 * @return This icon's color table id. |
|
136 */ |
|
137 TAknsItemID ColorId() const; |
|
138 |
|
139 /** |
|
140 * Returns this icon's index in the color table. |
|
141 * |
|
142 * @return This icon's index in the color table; |
|
143 * one of the TAknsQsnIconColorsIndex or KErrNotFound. |
|
144 */ |
|
145 TInt ColorIndex() const; |
|
146 |
|
147 /** |
|
148 * Returns this icon default color index. |
|
149 * TRgb value can be retrieved using AKN_LAF_COLOR_STATIC macro. |
|
150 * |
|
151 * @return The default color index or KErrNotFound. |
|
152 */ |
|
153 TInt DefaultColorIndex() const; |
|
154 |
|
155 /** |
|
156 * Returns external bitmap. This is used when icon is provided by an |
|
157 * external provider (e.g a branding package). |
|
158 * |
|
159 * @return Bitmap for external icons. |
|
160 */ |
|
161 const CFbsBitmap* ExternalBitmap() const; |
|
162 |
|
163 /** |
|
164 * Returns external bitmap mask. This is used when icon is provided by an |
|
165 * external provider (e.g a branding package). |
|
166 * |
|
167 * @return Bitmap mask for not own icons. |
|
168 */ |
|
169 const CFbsBitmap* ExternalMask() const; |
|
170 |
|
171 /** |
|
172 * Check if icon is not own. |
|
173 * |
|
174 * @return ETrue if icon is not own, EFalse for own icons. |
|
175 */ |
|
176 TBool IsIconExternal() const; |
|
177 |
|
178 /** |
|
179 * Returns external icon size. This is used when icon is provided by an |
|
180 * external provider (e.g a branding package). |
|
181 * |
|
182 * @return Size not own icons. |
|
183 */ |
|
184 TSize ExternalIconSize() const; |
|
185 |
|
186 private: // Implementation |
|
187 CPbk2IconInfo(); |
|
188 CPbk2IconInfo(TPbk2IconId aPbk2IconId, TInt aIconId, |
|
189 TInt aMaskId, TPtrC aMbmFileName, TAknsItemID aSkinId, |
|
190 TAknsItemID aColorId, TInt aColorIndex, |
|
191 TInt aDefaultColorIndex ); |
|
192 CPbk2IconInfo(TPbk2IconId aPbk2IconId, const CFbsBitmap* aBitmap, |
|
193 const CFbsBitmap* aMask, const TSize aSize ); |
|
194 |
|
195 void ConstructL( |
|
196 TResourceReader& aReader, |
|
197 CDesCArray& aMbmFileNames ); |
|
198 |
|
199 private: // Data |
|
200 /// Own: Unique Phonebook 2 icon id |
|
201 TPbk2IconId iPbk2IconId; |
|
202 /// Own: Icon bitmap |
|
203 TInt iIconId; |
|
204 /// Own: Mask bitmap |
|
205 TInt iMaskId; |
|
206 /// Own: Mbm file name |
|
207 TPtrC iMbmFileName; |
|
208 /// Own: Skin id |
|
209 TAknsItemID iSkinId; |
|
210 /// Own: Color id |
|
211 TAknsItemID iColorId; |
|
212 /// Own: Color index |
|
213 TInt iColorIndex; |
|
214 /// Own: Default color index |
|
215 TInt iDefaultColorIndex; |
|
216 /// Not own: bitmap (for not own icons only) |
|
217 const CFbsBitmap* iExternalBitmap; |
|
218 /// Not own: bitmap mask (for not own icons only) |
|
219 const CFbsBitmap* iExternalMask; |
|
220 /// Own: indicates if bitmaps are external |
|
221 TBool iExternalBitmaps; |
|
222 /// Own: Size for external bitmaps |
|
223 TSize iExternalIconSize; |
|
224 }; |
|
225 |
|
226 #endif // CPBK2ICONINFO_H |
|
227 |
|
228 // End of File |