|
1 /* |
|
2 * Copyright (c) 2007-2008 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: image attribute model |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_HNATTRIBUTEIMAGE_H |
|
20 #define C_HNATTRIBUTEIMAGE_H |
|
21 |
|
22 #include <AknsSkinInstance.h> |
|
23 #include "hnattributebase.h" |
|
24 |
|
25 class CFbsBitmap; |
|
26 class CHnAttrImgProvider; |
|
27 class CGulIcon; |
|
28 class TLiwVariant; |
|
29 |
|
30 /** |
|
31 * Image attribute. |
|
32 * |
|
33 * Class defining behaviour of the CHnAttributeBase interface |
|
34 * to support images. The model is responsible for creation |
|
35 * of the image, appropriately, depending on the source |
|
36 * of the image. |
|
37 * |
|
38 * @lib hnpresentationmodel |
|
39 * @since S60 5.0 |
|
40 * @ingroup group_hnpresentationmodel |
|
41 */ |
|
42 NONSHARABLE_CLASS( CHnAttributeImage ) : public CHnAttributeBase |
|
43 { |
|
44 public: |
|
45 |
|
46 /** |
|
47 * Two-phase constructor. |
|
48 * |
|
49 * @since S60 5.0 |
|
50 * @return Fully constructed object. |
|
51 */ |
|
52 IMPORT_C static CHnAttributeImage* NewL(); |
|
53 |
|
54 /** |
|
55 * Two-phase constructor. |
|
56 * |
|
57 * @since S60 5.0 |
|
58 * @return Fully constructed object. |
|
59 */ |
|
60 IMPORT_C static CHnAttributeImage* NewLC(); |
|
61 |
|
62 |
|
63 /** |
|
64 * Standard C++ virtual destructor. |
|
65 * @since S60 5.0 |
|
66 */ |
|
67 ~CHnAttributeImage(); |
|
68 |
|
69 /** |
|
70 * Sets skin id. |
|
71 * |
|
72 * @since S60 5.0 |
|
73 * @param aSkinId Skind id. |
|
74 */ |
|
75 IMPORT_C void SetSkinId ( TAknsItemID aSkinId ); |
|
76 |
|
77 /** |
|
78 * Sets file name source. |
|
79 * Takes ownership of the buffer. Therefore the buffer must not be NULL. |
|
80 * |
|
81 * @since S60 5.0 |
|
82 * @param aFileNameSrc A source filename, as a heap buffer pointer. |
|
83 */ |
|
84 IMPORT_C void SetFileNameSrc ( HBufC* aFileNameSrc ); |
|
85 |
|
86 /** |
|
87 * Sets mif file. |
|
88 * Takes ownership of the buffer. Therefore the buffer must not be NULL. |
|
89 * |
|
90 * @since S60 5.0 |
|
91 * @param aMifFile Mif filename as a heap buffer pointer. |
|
92 */ |
|
93 IMPORT_C void SetMifFile ( HBufC* aMifFile ); |
|
94 |
|
95 /** |
|
96 * Sets bitmap id. |
|
97 * |
|
98 * @since S60 5.0 |
|
99 * @param aBitmapId Bitmap id. |
|
100 */ |
|
101 IMPORT_C void SetBitmapId ( TInt aBitmapId ); |
|
102 |
|
103 /** |
|
104 * Sets mask id. |
|
105 * |
|
106 * @since S60 5.0 |
|
107 * @param aMaskId Mask id. |
|
108 */ |
|
109 IMPORT_C void SetMaskId ( TInt aMaskId ); |
|
110 |
|
111 /** |
|
112 * Sets application uid. |
|
113 * |
|
114 * @since S60 5.0 |
|
115 * @param aApplicationUid Application uid. |
|
116 */ |
|
117 IMPORT_C void SetApplicationUid( TUid aApplicationUid); |
|
118 |
|
119 /** |
|
120 * Sets bitmap. |
|
121 * Takes ownership. |
|
122 * |
|
123 * @since S60 5.0 |
|
124 * @param aBitmap Pointer to a bitmap. |
|
125 */ |
|
126 IMPORT_C void SetBitmap ( TLiwVariant* aBitmap ); |
|
127 |
|
128 /** |
|
129 * Sets mask. |
|
130 * Takes ownership. |
|
131 * |
|
132 * @since S60 5.0 |
|
133 * @param aMask Pointer to a mask. |
|
134 */ |
|
135 IMPORT_C void SetMask ( TLiwVariant* aMask ); |
|
136 |
|
137 /** |
|
138 * Gets icon, packed in CGulIcon. |
|
139 * |
|
140 * @see CGulIcon |
|
141 * @since S60 5.0 |
|
142 * @return Icon as a poitner to CGulIcon. |
|
143 */ |
|
144 IMPORT_C CGulIcon* GetIcon( TSize* aDesiredIconSize ); |
|
145 |
|
146 /** |
|
147 * Please see the description in the base class @c CHnAttributeBase. |
|
148 */ |
|
149 CHnIconHolder* GetIconHolder( TSize* aDesiredIconSize ); |
|
150 |
|
151 /** |
|
152 * Removes all LIW objects owned by this object. |
|
153 * |
|
154 * LIW objects owned by non-LIW objects that are owned by |
|
155 * this object are also removed. |
|
156 * @since S60 5.0 |
|
157 */ |
|
158 void RemoveLiwObjects(); |
|
159 |
|
160 private: |
|
161 |
|
162 /** |
|
163 * Standard C++ constructor. |
|
164 * |
|
165 * @since S60 5.0 |
|
166 */ |
|
167 CHnAttributeImage(); |
|
168 |
|
169 /** |
|
170 * Standard symbian 2nd phase constructor. |
|
171 * |
|
172 * @since S60 5.0 |
|
173 */ |
|
174 void ConstructL(); |
|
175 |
|
176 /** |
|
177 * Method is used to prepare the image provider, |
|
178 * if the icon is being fetched for the first time. |
|
179 * Image providers are created appropriately depending on |
|
180 * the image source, and they are responsible for providing |
|
181 * bitmaps. |
|
182 * |
|
183 * @since S60 5.0 |
|
184 * @return Error code when provider cannot be created. |
|
185 */ |
|
186 TInt Prepare(); |
|
187 |
|
188 /** |
|
189 * Method is used to prepare the image provider. |
|
190 * Image providers are created appropriately depending on |
|
191 * the image source, and they are responsible for providing |
|
192 * bitmaps. |
|
193 * |
|
194 * @since S60 5.0 |
|
195 */ |
|
196 void PrepareProviderL(); |
|
197 |
|
198 /** |
|
199 * Returns true if the attribute loaded a mif icon. |
|
200 * |
|
201 * @since S60 5.0 |
|
202 * @return True if image was loaded from mif. |
|
203 */ |
|
204 TBool IsThemeMif(); |
|
205 |
|
206 /** |
|
207 * Returns true if the attribute is loaded from application uid. |
|
208 * |
|
209 * @since S60 5.0 |
|
210 * @return True if image was loaded from application uid. |
|
211 */ |
|
212 TBool IsApplicationImage(); |
|
213 |
|
214 /** |
|
215 * Returns true if the attribute is loaded from image file. |
|
216 * |
|
217 * @since S60 5.0 |
|
218 * @return True if image was loaded from image file. |
|
219 */ |
|
220 TBool IsFileImageL(); |
|
221 |
|
222 /** |
|
223 * Returns true if the attribute is loaded from liw buffer. |
|
224 * |
|
225 * @since S60 5.0 |
|
226 * @return True if image was loaded from liw buffer. |
|
227 */ |
|
228 TBool IsLiwImage(); |
|
229 |
|
230 private: |
|
231 |
|
232 /** |
|
233 * Skin id. |
|
234 */ |
|
235 TAknsItemID iSkinId; |
|
236 |
|
237 /** |
|
238 * Mif file name. |
|
239 */ |
|
240 RBuf iMifFile; |
|
241 |
|
242 /** |
|
243 * Bitmap id. |
|
244 */ |
|
245 TInt iBitmapId; |
|
246 |
|
247 /** |
|
248 * Mask id. |
|
249 */ |
|
250 TInt iMaskId; |
|
251 |
|
252 /** |
|
253 * Image source file name. |
|
254 */ |
|
255 RBuf iFileNameSrc; |
|
256 |
|
257 /** |
|
258 * Application uid to fetch the image from. |
|
259 */ |
|
260 TUid iApplicationUid; |
|
261 |
|
262 /** |
|
263 * Bitmap from Liw Buffer. |
|
264 * Own. |
|
265 */ |
|
266 TLiwVariant* iBitmap; |
|
267 |
|
268 /** |
|
269 * Mask from Liw Buffer. |
|
270 * Own. |
|
271 */ |
|
272 TLiwVariant* iMask; |
|
273 |
|
274 /** |
|
275 * Hn image provider |
|
276 * Own. |
|
277 */ |
|
278 CHnAttrImgProvider* iAttrImgProvider; |
|
279 |
|
280 }; |
|
281 |
|
282 #endif // C_HNATTRIBUTEIMAGE_H |
|
283 |
|
284 |
|
285 |