|
1 /* |
|
2 * Copyright (c) 2009 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: Background manager |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CXNBACKGROUNDMANAGER_H |
|
19 #define CXNBACKGROUNDMANAGER_H |
|
20 |
|
21 // System includes |
|
22 #include <coecntrl.h> |
|
23 #include <AknsSrvClient.h> |
|
24 #include <coeview.h> |
|
25 #include <disknotifyhandler.h> |
|
26 |
|
27 // CLASS DECLARATION |
|
28 class CXnViewManager; |
|
29 class CXnViewData; |
|
30 class CAknsLayeredBackgroundControlContext; |
|
31 |
|
32 namespace hspswrapper |
|
33 { |
|
34 class CHspsWrapper; |
|
35 } |
|
36 |
|
37 using namespace hspswrapper; |
|
38 |
|
39 /** |
|
40 * Background manager. |
|
41 * |
|
42 * @since S60 v5.0 |
|
43 */ |
|
44 NONSHARABLE_CLASS( CXnBackgroundManager ) : public CCoeControl, |
|
45 public MAknsSkinChangeObserver, public MDiskNotifyHandlerCallback |
|
46 { |
|
47 public: |
|
48 |
|
49 enum WppType |
|
50 { |
|
51 ENone, |
|
52 ECommon, |
|
53 EPageSpecific |
|
54 }; |
|
55 |
|
56 /** |
|
57 * Two-phased constructor. |
|
58 * @param aWrapper HSPS wrapper |
|
59 * @return new instance of CXnWallpaperView. |
|
60 */ |
|
61 static CXnBackgroundManager* NewL( CXnViewManager& aViewManager, CHspsWrapper& aWrapper ); |
|
62 |
|
63 /** |
|
64 * Destructor. |
|
65 */ |
|
66 ~CXnBackgroundManager(); |
|
67 |
|
68 /** |
|
69 * Caches wallpaper image. |
|
70 * |
|
71 * @since S60 5.0 |
|
72 * @param aFileName WallpaperImage image path and filename to be cached |
|
73 * @param aViewData Page that owns the given wallpaper. |
|
74 * @return Error code. |
|
75 */ |
|
76 TInt ConstructWallpaper( const TDesC& aFileName, CXnViewData& aViewData ); |
|
77 |
|
78 /** |
|
79 * Shows wallpaper change dialog |
|
80 * |
|
81 * @since S60 5.0 |
|
82 */ |
|
83 void SetWallpaperL(); |
|
84 |
|
85 /** |
|
86 * Changes wallpaper image of the current page. |
|
87 * |
|
88 * @since S60 5.0 |
|
89 * @param aFileName WallpaperImage image path and filename |
|
90 * @return Whether wallpaper is succesfully set or not. |
|
91 */ |
|
92 TBool SetWallpaper( const TDesC& aFileName ); |
|
93 |
|
94 /** |
|
95 * Deletes wallpaper from the given page as well as from the cache. |
|
96 * |
|
97 * @since S60 5.0 |
|
98 * @param aViewData Page where the wallpaper is to be destroyed. |
|
99 */ |
|
100 void DeleteWallpaper( CXnViewData& aViewData ); |
|
101 |
|
102 /** |
|
103 * Handles wallpaper changing in page change |
|
104 * |
|
105 * @since S60 5.0 |
|
106 * @param aOldView Old view |
|
107 * @param aNewView New view |
|
108 * @param aDrawNow ETrue if appearance should be updated |
|
109 */ |
|
110 void ChangeWallpaper( const CXnViewData& aOldView, |
|
111 const CXnViewData& aNewView, TBool aDrawNow ); |
|
112 |
|
113 /** |
|
114 * Returns wallpaper type. |
|
115 * |
|
116 * @since S60 5.0 |
|
117 */ |
|
118 CXnBackgroundManager::WppType WallpaperType(); |
|
119 |
|
120 /** |
|
121 * Store current wallpaper if needed by using |
|
122 * AknsWallpaperUtils::SetIdleWallpaper |
|
123 */ |
|
124 void StoreWallpaperL(); |
|
125 |
|
126 public: // Functions from base classes |
|
127 |
|
128 /** |
|
129 * @see CCoeControl |
|
130 */ |
|
131 void MakeVisible( TBool aVisible ); |
|
132 |
|
133 private: // Functions from base classes |
|
134 |
|
135 /** |
|
136 * see CCoeControl |
|
137 */ |
|
138 void Draw(const TRect& aRect) const; |
|
139 |
|
140 /** |
|
141 * see CCoeControl |
|
142 */ |
|
143 void SizeChanged(); |
|
144 |
|
145 /** |
|
146 * see MAknsSkinChangeObserver |
|
147 */ |
|
148 void SkinContentChanged(); |
|
149 |
|
150 /** |
|
151 * see MAknsSkinChangeObserver |
|
152 */ |
|
153 void SkinConfigurationChanged( |
|
154 const TAknsSkinStatusConfigurationChangeReason aReason ); |
|
155 |
|
156 /** |
|
157 * see MAknsSkinChangeObserver |
|
158 */ |
|
159 void SkinPackageChanged( |
|
160 const TAknsSkinStatusPackageChangeReason aReason ); |
|
161 |
|
162 /** |
|
163 * From MDiskNotifyHandlerCallback. |
|
164 */ |
|
165 void HandleNotifyDisk( TInt aError, const TDiskEvent& aEvent ); |
|
166 |
|
167 private: |
|
168 |
|
169 /** |
|
170 * C++ default constructor. |
|
171 */ |
|
172 CXnBackgroundManager( CXnViewManager& aViewManager, CHspsWrapper& aWrapper ); |
|
173 |
|
174 /** |
|
175 * By default Symbian 2nd phase constructor is private. |
|
176 */ |
|
177 void ConstructL(); |
|
178 |
|
179 /** |
|
180 * Gets dublicate bitmap from AknsSrv cache and stores ot to view data. |
|
181 */ |
|
182 void UpdateViewData( const TDesC& aFileName, CXnViewData& aViewData ); |
|
183 |
|
184 /** |
|
185 * Stores current wallpaper to HSPS. |
|
186 */ |
|
187 void SaveWallpaperL(); |
|
188 TInt SetSettingPropertyL( const TDesC8& aPluginId, const TDesC8& aItemId, |
|
189 const TDesC8& aPropertyName, const TDesC8& aPropertyValue ); |
|
190 |
|
191 /** |
|
192 * Goes through all the views and updates wallpapers to the correct size. |
|
193 */ |
|
194 void UpdateWallpapersL(); |
|
195 |
|
196 /** |
|
197 * Removes wallpaper from AknsSrv cache, |
|
198 * if it is not used in other pages than the given (or active page). |
|
199 */ |
|
200 void RemoveWallpaperFromCache( const TDesC& aFileName, |
|
201 CXnViewData* aViewData = NULL ); |
|
202 |
|
203 /** |
|
204 * Removes wallpapers that were loaded from MMC. |
|
205 */ |
|
206 void RemovableDiskRemovedL(); |
|
207 |
|
208 /** |
|
209 * Tries to restore wallpapers from MMC. |
|
210 */ |
|
211 void RemovableDiskInsertedL(); |
|
212 |
|
213 /** |
|
214 * Reads from cenrep wheteher page specific or common wallpaper is enabled |
|
215 * and acts accordingly. |
|
216 */ |
|
217 void CheckFeatureTypeL(); |
|
218 |
|
219 /** |
|
220 * Set the given wallpaper to the active page. |
|
221 */ |
|
222 void SetPageSpecificWallpaperL( const TDesC& aFileName ); |
|
223 |
|
224 /** |
|
225 * Set the given wallpaper. |
|
226 * aSave states whether to save change to HSPS or not. |
|
227 */ |
|
228 void SetCommonWallpaperL( const TDesC& aFileName, TBool aSave = ETrue, |
|
229 TBool aShowProgressBar = ETrue ); |
|
230 |
|
231 /** |
|
232 * Called when wallpaper has been changed outside of Homescreen. |
|
233 * aSave states whether to save change to HSPS or not. |
|
234 */ |
|
235 void ReadWallpaperFromCenrepL(); |
|
236 |
|
237 /** |
|
238 * Helper functions for drawing |
|
239 */ |
|
240 void DrawEditModeBackgroundSkin() const; |
|
241 void DrawStatusPaneMask() const; |
|
242 void UpdateStatuspaneMaskL(); |
|
243 |
|
244 private: // data |
|
245 |
|
246 /** |
|
247 * Provides needed services |
|
248 */ |
|
249 CXnViewManager& iViewManager; |
|
250 |
|
251 /** |
|
252 * Hsps wrapper |
|
253 */ |
|
254 CHspsWrapper& iHspsWrapper; |
|
255 |
|
256 /** |
|
257 * skin server to detect when wallpaper has changed |
|
258 * Own. |
|
259 */ |
|
260 RAknsSrvSession iSkinSrv; |
|
261 |
|
262 /** |
|
263 * File server session. |
|
264 * Own. |
|
265 */ |
|
266 RFs iFsSession; |
|
267 |
|
268 /** |
|
269 * Notifier for disk drive status changes. |
|
270 * Own. |
|
271 */ |
|
272 CDiskNotifyHandler* iDiskNotifier; |
|
273 |
|
274 /** |
|
275 * Background control context. |
|
276 * Own. |
|
277 */ |
|
278 CAknsLayeredBackgroundControlContext* iBgContext; |
|
279 |
|
280 /** |
|
281 * Current view rect, which is basically the whole screen. |
|
282 */ |
|
283 TRect iRect; |
|
284 |
|
285 /** |
|
286 * Stores wallpaper type. |
|
287 */ |
|
288 CXnBackgroundManager::WppType iType; |
|
289 |
|
290 /** |
|
291 * Internal wallpaper update in progress |
|
292 */ |
|
293 TInt iIntUpdate; |
|
294 |
|
295 /** |
|
296 * Status pane bitmap. Drawn on top of a wallpaper in |
|
297 * the status pane area. |
|
298 * Own. |
|
299 */ |
|
300 CFbsBitmap* iSpBitmap; |
|
301 |
|
302 /** |
|
303 * Pointer to status pane mask. Drawn on top of a wallpaper in |
|
304 * the status pane area. |
|
305 * Own. |
|
306 */ |
|
307 CFbsBitmap* iSpMask; |
|
308 |
|
309 /** |
|
310 * Path of the wallpaper image, including filename. |
|
311 * This is used only if same wallpaper |
|
312 * is shared among all HS pages. |
|
313 * Own. |
|
314 */ |
|
315 HBufC* iBgImagePath; |
|
316 |
|
317 /** |
|
318 * Pointer to wallpaper image. This is used only if same wallpaper |
|
319 * is shared among all HS pages. |
|
320 * Own. |
|
321 */ |
|
322 CFbsBitmap* iBgImage; |
|
323 |
|
324 /* |
|
325 * Flag to indicate wheter wallpaper information needs |
|
326 * to be stored to AknsWallpaperUtils |
|
327 */ |
|
328 TBool iStoreWallpaper; |
|
329 }; |
|
330 |
|
331 #endif // CXNBACKGROUNDMANAGER_H |
|
332 |
|
333 // End of File |