1 /* |
|
2 * ============================================================================ |
|
3 * Name : hgfswiconcache.h |
|
4 * Part of : Hg Teleport / Fast Swap module |
|
5 * Description : Icon cache |
|
6 * Version : %version: 2 % |
|
7 * |
|
8 * Copyright 2008 Nokia. All rights reserved. |
|
9 * This material, including documentation and any related computer |
|
10 * programs, is protected by copyright controlled by Nokia. All |
|
11 * rights are reserved. Copying, including reproducing, storing, |
|
12 * adapting or translating, any or all of this material requires the |
|
13 * prior written consent of Nokia. This material also contains |
|
14 * confidential information which may not be disclosed to others |
|
15 * without the prior written consent of Nokia. |
|
16 * ============================================================================ |
|
17 */ |
|
18 |
|
19 #ifndef HGFSWICONCACHE_H_ |
|
20 #define HGFSWICONCACHE_H_ |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <e32hashtab.h> |
|
24 |
|
25 class CFbsBitmap; |
|
26 class CGulIcon; |
|
27 |
|
28 /** |
|
29 * App icon cache. |
|
30 */ |
|
31 NONSHARABLE_CLASS( CHgFswIconCache ) : public CBase |
|
32 { |
|
33 public: |
|
34 |
|
35 /** |
|
36 * Two phased constructor. |
|
37 */ |
|
38 static CHgFswIconCache* NewL(); |
|
39 |
|
40 /** |
|
41 * Two phased constructor. |
|
42 */ |
|
43 static CHgFswIconCache* NewLC(); |
|
44 |
|
45 /** |
|
46 * Destructor |
|
47 */ |
|
48 ~CHgFswIconCache(); |
|
49 |
|
50 /** |
|
51 * Gets the bitmaps associated with the given app from the cache. |
|
52 * If not found then creates the app icon, stores it to the cache, |
|
53 * and returns that. |
|
54 * @param aAppUid application uid |
|
55 * @param aBitmap bitmap ptr, ownership NOT transferred to caller, or NULL |
|
56 * @param aMask mask ptr, ownership NOT transferred to caller, or NULL |
|
57 */ |
|
58 void GetIconL( const TUid& aAppUid, |
|
59 CFbsBitmap*& aBitmap, CFbsBitmap*& aMask ); |
|
60 |
|
61 /** |
|
62 * Sets the ptrs to the default icon. |
|
63 * Ownership not transferred to caller. |
|
64 */ |
|
65 void DefaultIcon( CFbsBitmap*& aBitmap, CFbsBitmap*& aMask ); |
|
66 |
|
67 private: |
|
68 /** |
|
69 * Default constructor. |
|
70 */ |
|
71 CHgFswIconCache(); |
|
72 |
|
73 /** |
|
74 * Second phase construction |
|
75 */ |
|
76 void ConstructL(); |
|
77 |
|
78 /** |
|
79 * Retrieves the bitmap/mask for the icon of the given app. |
|
80 * @param aAppUid application uid |
|
81 * @param aBitmap bitmap ptr, ownership transferred to caller, or NULL |
|
82 * @param aMask mask ptr, ownership transferred to caller, or NULL |
|
83 */ |
|
84 void GetAppIconL( const TUid& aAppUid, |
|
85 CFbsBitmap*& aBitmap, CFbsBitmap*& aMask ); |
|
86 |
|
87 private: |
|
88 struct SHgBitmapPair |
|
89 { |
|
90 SHgBitmapPair( CFbsBitmap* aBitmap, CFbsBitmap* aMask ) |
|
91 : iBitmap( aBitmap ), iMask( aMask ) { } |
|
92 CFbsBitmap* iBitmap; |
|
93 CFbsBitmap* iMask; |
|
94 }; |
|
95 RHashMap<TInt, SHgBitmapPair> iAppIcons; |
|
96 |
|
97 CGulIcon* iDefaultIcon; |
|
98 }; |
|
99 |
|
100 #endif |
|