|
1 /* |
|
2 * Copyright (c) 2003-2007 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: Chunk Lookup. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef AKNSSRVCHUNKLOOKUP_H |
|
20 #define AKNSSRVCHUNKLOOKUP_H |
|
21 |
|
22 // INCLUDES |
|
23 |
|
24 #include <e32std.h> |
|
25 #include <e32base.h> |
|
26 #include <AknsItemDef.h> |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 struct TAknsSrvItemDef; |
|
30 |
|
31 /** |
|
32 * A class for looking up and creating item definitions stored in the |
|
33 * shared memory chunk. |
|
34 * |
|
35 * @since 2.0 |
|
36 */ |
|
37 NONSHARABLE_CLASS(CAknsSrvChunkLookup) : public CBase |
|
38 { |
|
39 public: // Construction and destruction |
|
40 |
|
41 /** |
|
42 * SymbianOS two-phased constructor. |
|
43 * |
|
44 * @since 2.0 |
|
45 * |
|
46 * @return A new instance of CAknsSrvChunkLookup. |
|
47 * |
|
48 * @par Exceptions: |
|
49 * If the construction fails, the leaves with one of the system wide |
|
50 * error codes. |
|
51 */ |
|
52 static CAknsSrvChunkLookup* NewL(); |
|
53 |
|
54 /** |
|
55 * Default C++ destructor. |
|
56 */ |
|
57 virtual ~CAknsSrvChunkLookup(); |
|
58 |
|
59 public: // New methods |
|
60 |
|
61 /** |
|
62 * Returns item definition object matching the given item ID. |
|
63 * Performs lookup for the given item ID and returns an instance of one |
|
64 * of the subclasses of CAknsItemDef matching the given ID. If the call |
|
65 * is successfull, ownership of the item definition object is transferred |
|
66 * to the caller. |
|
67 * |
|
68 * @since 2.0 |
|
69 * |
|
70 * @param aID Item ID to be searched. |
|
71 * |
|
72 * @return Pointer to the item definition object now owned by the caller, |
|
73 * or @c NULL if there was no match for the given IID. |
|
74 * |
|
75 * @par Exceptions: |
|
76 * If construction of the item definition object failed, method leaves |
|
77 * with an error code. |
|
78 */ |
|
79 IMPORT_C CAknsItemDef* LookupAndCreateDefL( const TAknsItemID& aID ); |
|
80 |
|
81 /** |
|
82 * Returns stored scalable bitmaps and optionally its mask if it |
|
83 * was stored. The ownership of the returned bitmap (and mask, if any) |
|
84 * is transferred to the caller. |
|
85 * |
|
86 * Optionally, the caller can give the current copy of the bitmap and |
|
87 * mask as aBitmap and aMask parameters. If the currently stored |
|
88 * scalable bitmaps have the same handles, they are not re-duplicated. |
|
89 * The ownership of the given bitmaps is transferred to chunk lookup. |
|
90 * |
|
91 * @since 2.8 |
|
92 * |
|
93 * @param aID Item ID to be searched. |
|
94 * |
|
95 * @param aLayout The layout id type for the searhed item. |
|
96 * |
|
97 * @param aBitmap Current bitmap or @c NULL. Ownership is transferred. |
|
98 * After return, contains the newly duplicated bitmap, or @c NULL if |
|
99 * not found. Ownership is transferred. |
|
100 * |
|
101 * @param aMask Current mask or @c NULL. Ownership is transferred. |
|
102 * After return, contains the newly duplicated mask, or @c NULL if |
|
103 * not found. Ownership is transferred. |
|
104 */ |
|
105 IMPORT_C void LookupAndCreateScalableItemL( const TAknsItemID& aID, |
|
106 const TInt aLayout, const TSize& aLayoutSize, CFbsBitmap*& aBitmap, |
|
107 CFbsBitmap*& aMask, TInt& aMorphing); |
|
108 |
|
109 /** |
|
110 * Blocks write access to the shared memory chunk. |
|
111 * |
|
112 * @since 2.0 |
|
113 */ |
|
114 void BeginRead(); |
|
115 |
|
116 /** |
|
117 * Allows write access to the shared memory chunk. |
|
118 * |
|
119 * @since 2.0 |
|
120 */ |
|
121 void EndRead(); |
|
122 |
|
123 /** |
|
124 * Blocks all rendering. |
|
125 * |
|
126 * @since 2.8 |
|
127 */ |
|
128 IMPORT_C void BeginRender(); |
|
129 |
|
130 /** |
|
131 * Allows rendering. |
|
132 * |
|
133 * @since 2.8 |
|
134 */ |
|
135 IMPORT_C void EndRender(); |
|
136 |
|
137 private: // Reserved exports |
|
138 |
|
139 /** |
|
140 * Reserved for future use. |
|
141 * |
|
142 * @since 2.0 |
|
143 * |
|
144 * @return Always returns zero. |
|
145 */ |
|
146 IMPORT_C TInt Reserved(); |
|
147 |
|
148 protected: // New methods |
|
149 |
|
150 /** |
|
151 * Creates an item definition object (or leaves) based on the given |
|
152 * item definition structure. |
|
153 * |
|
154 * Note that this method does not use the semaphore, and is therefore |
|
155 * unprotected. |
|
156 * |
|
157 * @param aID Item ID of the item. |
|
158 * |
|
159 * @param aType Type of the definition. |
|
160 * |
|
161 * @param aDef Pointer to the definition. |
|
162 * |
|
163 * @param aBasePtr Chunk base pointer. |
|
164 * |
|
165 * @return Newly construction item definition object, or @c NULL if |
|
166 * aDef was @c NULL. |
|
167 * |
|
168 * @since 2.0 |
|
169 */ |
|
170 CAknsItemDef* CreateUnprotectedL( const TAknsItemID& aID, |
|
171 const TAny* aDef, const TAknsItemType aType, |
|
172 const TAny* aBasePtr ); |
|
173 |
|
174 /** |
|
175 * Returns stored scalable bitmaps and optionally its mask if it |
|
176 * was stored. |
|
177 * |
|
178 * Note that this method does not use the semaphore, and is therefore |
|
179 * unprotected. |
|
180 * |
|
181 * @since 2.8 |
|
182 */ |
|
183 void LookupAndCreateScalableItemUnprotectedL( const TAknsItemID& aID, |
|
184 const TInt aLayout, const TSize& aLayoutSize, CFbsBitmap*& aBitmap, |
|
185 CFbsBitmap*& aMask, TInt& aMorphing); |
|
186 |
|
187 /** |
|
188 * |
|
189 * @since 3.0 |
|
190 */ |
|
191 CAknsEffectQueueItemDef* CreateEffectQueueL( const TAknsItemID& aID, |
|
192 const TAny* aDefPtr, const TAny* aBasePtr ); |
|
193 |
|
194 /** |
|
195 * |
|
196 * @since 3.0 |
|
197 */ |
|
198 CAknsAnimationItemDef* CreateAnimationL( const TAknsItemID& aID, |
|
199 const TAny* aDefPtr, const TAny* aBasePtr ); |
|
200 |
|
201 /** |
|
202 * @since 3.0 |
|
203 */ |
|
204 CAknsEffectItemDef* CreateEffectL( const TUint8* aData, |
|
205 const TBool aIsAnimationCommand, const TAny* aBasePtr ); |
|
206 |
|
207 /** |
|
208 * @since 3.0 |
|
209 */ |
|
210 CAknsEffectParamDef* CreateParameterL( const TUint8* aData, const TAny* aBasePtr ); |
|
211 |
|
212 /** |
|
213 * @since 3.0 |
|
214 */ |
|
215 TUint32 CreateParameterL( CAknsEffectParamDef*& aDef, |
|
216 const TUint32 aOffset, |
|
217 const TAny* aDefPtr, |
|
218 const TAny* aBasePtr ); |
|
219 |
|
220 /** |
|
221 * @since 3.0 |
|
222 */ |
|
223 TUint32 CreateEffectL( CAknsEffectItemDef*& aDef, |
|
224 const TUint32 aOffset, |
|
225 const TAny* aDefPtr, |
|
226 const TAny* aBasePtr, |
|
227 const TBool aIsAnimationCommand ); |
|
228 |
|
229 protected: // Protected constructors |
|
230 |
|
231 /** |
|
232 * Default C++ constructor |
|
233 */ |
|
234 CAknsSrvChunkLookup(); |
|
235 |
|
236 /** |
|
237 * Second-phase constructor. |
|
238 */ |
|
239 void ConstructL(); |
|
240 |
|
241 private: // Data |
|
242 |
|
243 RChunk iSharedChunk; |
|
244 RSemaphore iWaitSema; |
|
245 RMutex iRenderMutex; |
|
246 |
|
247 }; |
|
248 |
|
249 #endif // AKNSSRVCHUNKLOOKUP_H |
|
250 |
|
251 // End of file. |