|
1 /* |
|
2 * Copyright (c) 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: Icon cache |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef TSFSWICONCACHE_H_ |
|
20 #define TSFSWICONCACHE_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( CTsFswIconCache ) : public CBase |
|
32 { |
|
33 public: |
|
34 |
|
35 /** |
|
36 * Two phased constructor. |
|
37 */ |
|
38 static CTsFswIconCache* NewL(); |
|
39 |
|
40 /** |
|
41 * Two phased constructor. |
|
42 */ |
|
43 static CTsFswIconCache* NewLC(); |
|
44 |
|
45 /** |
|
46 * Destructor |
|
47 */ |
|
48 ~CTsFswIconCache(); |
|
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 CTsFswIconCache(); |
|
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 STsBitmapPair |
|
89 { |
|
90 STsBitmapPair( CFbsBitmap* aBitmap, CFbsBitmap* aMask ) |
|
91 : iBitmap( aBitmap ), iMask( aMask ) { } |
|
92 CFbsBitmap* iBitmap; |
|
93 CFbsBitmap* iMask; |
|
94 }; |
|
95 RHashMap<TInt, STsBitmapPair> iAppIcons; |
|
96 |
|
97 CGulIcon* iDefaultIcon; |
|
98 }; |
|
99 |
|
100 #endif |