|
1 /* |
|
2 * Copyright (c) 2006 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: MPX common container Alf Texture manager. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CMPXCOMMONCONTAINERTEXTUREMANAGER_H |
|
21 #define CMPXCOMMONCONTAINERTEXTUREMANAGER_H |
|
22 |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 #include <alf/alfbitmapprovider.h> |
|
27 #include <mpxitemid.h> |
|
28 #include "mpxcommoncontainer.h" |
|
29 |
|
30 // CONSTANTS |
|
31 const TInt KMPXFirstAlfThumbnailTextureId = 0x20000001; |
|
32 const TInt KMPXLastAlfThumbnailTextureId = 0x30000000; |
|
33 |
|
34 // FORWARD DECLARATIONS |
|
35 class CFbsBitmap; |
|
36 class CAlfTexture; |
|
37 class CAlfTextureManager; |
|
38 |
|
39 // CLASS DECLARATION |
|
40 |
|
41 /** |
|
42 * Texture manager for common container. |
|
43 * |
|
44 * @lib mpxcommoncontainer.lib |
|
45 * @since S60 v3.2 |
|
46 */ |
|
47 NONSHARABLE_CLASS( CMPXCommonContainerTextureManager ) |
|
48 : public CBase |
|
49 , public MAlfBitmapProvider |
|
50 { |
|
51 public: |
|
52 |
|
53 enum TMPXTextureType |
|
54 { |
|
55 EMPXTextureNone, |
|
56 EMPXTextureImage, |
|
57 EMPXTextureIcon |
|
58 }; |
|
59 |
|
60 /** |
|
61 * default C++ constructor. |
|
62 */ |
|
63 CMPXCommonContainerTextureManager( |
|
64 CAlfTextureManager& aTextureManager ); |
|
65 |
|
66 /** |
|
67 * Destructor. |
|
68 */ |
|
69 virtual ~CMPXCommonContainerTextureManager(); |
|
70 |
|
71 /** |
|
72 * Creates texture from the specified bitmap and mask |
|
73 * |
|
74 * @param aIndex container item index |
|
75 * @param aItemId container item id |
|
76 * @param aBitmap a bitmap |
|
77 * @param aMask a bitmap mask |
|
78 */ |
|
79 CAlfTexture& CreateTextureL( TInt aIndex, TMPXItemId aItemId, |
|
80 CFbsBitmap* aBitmap, CFbsBitmap* aMask ); |
|
81 |
|
82 /** |
|
83 * Creates icon texture from the specified bitmap and mask |
|
84 * (not cached) |
|
85 * |
|
86 * @param aBitmap a bitmap |
|
87 * @param aMask a bitmap mask |
|
88 */ |
|
89 CAlfTexture& CreateIconTextureL( TInt aIconIndex, CFbsBitmap* aBitmap, CFbsBitmap* aMask ); |
|
90 |
|
91 /** |
|
92 * Returns texture for the specified item |
|
93 * |
|
94 * @param aItemId container item id |
|
95 * @return Texture Id for the item, KErrNotFound if non-existent |
|
96 */ |
|
97 TInt TextureId( TMPXItemId aItemId ) const; |
|
98 |
|
99 /** |
|
100 * Returns texture for the specified icon |
|
101 * |
|
102 * @param aIconIndex container item id |
|
103 * @return Texture Id for the item, KErrNotFound if non-existent |
|
104 */ |
|
105 TInt IconTextureId( TInt aIconIndex ) const; |
|
106 |
|
107 /** |
|
108 * Removes the cached texture information |
|
109 * |
|
110 * @param aId container item id |
|
111 */ |
|
112 void ClearCache( TMPXTextureType aType=EMPXTextureNone ); |
|
113 |
|
114 private: |
|
115 |
|
116 // from base class MAlfBitmapProvider |
|
117 |
|
118 /** |
|
119 * Callback with texture id when a texture is created |
|
120 * |
|
121 * @param aId container item id |
|
122 * @param aBitmap a bitmap |
|
123 * @param aMask a bitmap mask |
|
124 */ |
|
125 void ProvideBitmapL( TInt aId, CFbsBitmap*& aBitmap, CFbsBitmap*& aBitmapMask); |
|
126 |
|
127 private: // data |
|
128 |
|
129 struct TMPXTextureItem |
|
130 { |
|
131 TMPXTextureType iType; |
|
132 TInt iItemIndex; |
|
133 TMPXItemId iItemId; |
|
134 TInt iTextureId; |
|
135 CFbsBitmap* iBitmap; |
|
136 CFbsBitmap* iMask; |
|
137 }; |
|
138 |
|
139 CAlfTextureManager& iTextureManager; // not owned |
|
140 MMPXCommonContainer* iCommonContainer; // not owned |
|
141 TMPXTextureItem iTextureItem; |
|
142 RArray<TMPXTextureItem> iTextureArray; // owned |
|
143 RArray<TMPXTextureItem> iIconTextureArray; // owned |
|
144 }; |
|
145 |
|
146 #endif // CMPXCOMMONCONTAINERTEXTUREMANAGER_H |
|
147 |
|
148 // End of File |