|
1 /* |
|
2 * Copyright (c) 2005 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 the License "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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CMINIMAP_H |
|
21 #define CMINIMAP_H |
|
22 |
|
23 // INCLUDES |
|
24 #include "pagescaler.h" |
|
25 |
|
26 #include <e32base.h> |
|
27 #include <gdi.h> |
|
28 #include <w32std.h> |
|
29 |
|
30 // CONSTANTS |
|
31 |
|
32 // MACROS |
|
33 |
|
34 // DATA TYPES |
|
35 |
|
36 // FUNCTION PROTOTYPES |
|
37 |
|
38 // FORWARD DECLARATIONS |
|
39 |
|
40 class CWindowGc; |
|
41 class CMinimapGenerator; |
|
42 class CFbsBitGc; |
|
43 class CFbsBitmap; |
|
44 class CFbsBitmapDevice; |
|
45 class CMinimapTimer; |
|
46 |
|
47 |
|
48 // CLASS DECLARATION |
|
49 |
|
50 /** |
|
51 * |
|
52 * |
|
53 * @lib pagescaler.dll |
|
54 * @since 3.1 |
|
55 */ |
|
56 class CMinimap : public CPageScaler |
|
57 { |
|
58 public: // Constructors and destructor |
|
59 |
|
60 /** |
|
61 * Two-phased constructor. |
|
62 */ |
|
63 static CMinimap* NewL(MPageScalerCallback& aCallback, TDisplayMode aMode, TBool aLowQuality ); |
|
64 |
|
65 /** |
|
66 * Destructor. |
|
67 */ |
|
68 virtual ~CMinimap(); |
|
69 |
|
70 public: // New functions |
|
71 |
|
72 |
|
73 /** |
|
74 * |
|
75 * @since 3.1 |
|
76 * @param |
|
77 * @return |
|
78 */ |
|
79 void SetVisibleUntil(TTimeIntervalMicroSeconds32 aUntil); |
|
80 |
|
81 /** |
|
82 * |
|
83 * @since 3.1 |
|
84 * @param |
|
85 * @return |
|
86 */ |
|
87 void SetVisible(TBool aVisible); |
|
88 |
|
89 /** |
|
90 * |
|
91 * @since 3.1 |
|
92 * @param |
|
93 * @return |
|
94 */ |
|
95 inline TBool Visible() const; |
|
96 |
|
97 /** |
|
98 * |
|
99 * @since 3.1 |
|
100 * @param |
|
101 * @return |
|
102 */ |
|
103 inline void SetZoomOutLevel(TInt aPercent); |
|
104 |
|
105 /** |
|
106 * |
|
107 * @since 3.1 |
|
108 * @param |
|
109 * @return |
|
110 */ |
|
111 inline TInt ZoomOutLevel() const; |
|
112 |
|
113 /** |
|
114 * |
|
115 * @since 3.1 |
|
116 * @param |
|
117 * @return |
|
118 */ |
|
119 void SetPercentSize(TInt aWidthPercent, TInt aHeightPercent); |
|
120 |
|
121 /** |
|
122 * |
|
123 * @since 3.1 |
|
124 * @param |
|
125 * @return |
|
126 */ |
|
127 void SetTransparency(TInt aPercent); |
|
128 |
|
129 /** |
|
130 * |
|
131 * @since 3.1 |
|
132 * @param |
|
133 * @return |
|
134 */ |
|
135 inline TInt Transparency() const; |
|
136 |
|
137 /** |
|
138 * |
|
139 * @since 3.1 |
|
140 * @param |
|
141 * @return |
|
142 */ |
|
143 TRect Rect() const; |
|
144 |
|
145 /** |
|
146 * |
|
147 * @since 3.1 |
|
148 * @param |
|
149 * @return |
|
150 */ |
|
151 TRect MinimapRect() const; |
|
152 |
|
153 |
|
154 /** |
|
155 * |
|
156 * @since 3.1 |
|
157 * @param |
|
158 * @return |
|
159 */ |
|
160 TRect IndicatorRect() const; |
|
161 |
|
162 /** |
|
163 * |
|
164 * @since 3.1 |
|
165 * @param |
|
166 * @return |
|
167 */ |
|
168 void SetRelativePosition(TInt aXDist, TInt aYDist, TPosition aPosition); |
|
169 |
|
170 /** |
|
171 * |
|
172 * @since 3.1 |
|
173 * @param |
|
174 * @return |
|
175 */ |
|
176 void DocumentStarted(); |
|
177 |
|
178 /** |
|
179 * |
|
180 * @since 3.1 |
|
181 * @param |
|
182 * @return |
|
183 */ |
|
184 void DocumentChangedL(); |
|
185 |
|
186 /** |
|
187 * |
|
188 * @since 3.1 |
|
189 * @param |
|
190 * @return |
|
191 */ |
|
192 void DocumentCompleted(); |
|
193 |
|
194 /** |
|
195 * |
|
196 * @since 3.1 |
|
197 * @param |
|
198 * @return |
|
199 */ |
|
200 void DocumentViewportMoved(); |
|
201 |
|
202 /** |
|
203 * @since 3.1 |
|
204 * @param |
|
205 * @return |
|
206 */ |
|
207 void Draw(CWindowGc& aGc, const TRect& aRect) const; |
|
208 |
|
209 /** |
|
210 * |
|
211 * @since 3.1 |
|
212 * @param |
|
213 * @return |
|
214 */ |
|
215 TRect ViewportOnDocument() const; |
|
216 |
|
217 |
|
218 /** |
|
219 * @since 3.1 |
|
220 * @param |
|
221 * @return the scaled copy of the page |
|
222 */ |
|
223 CFbsBitmap* ScaledPage() const; |
|
224 |
|
225 /** |
|
226 * @since 3.1 |
|
227 * @return |
|
228 */ |
|
229 TRect ContainerRect() const; |
|
230 |
|
231 /** |
|
232 * @since 3.1 |
|
233 * @return |
|
234 */ |
|
235 void SetContainerRect(const TRect& aRect); |
|
236 |
|
237 /** |
|
238 * @since 3.1 |
|
239 * @return |
|
240 */ |
|
241 TBool FullScreenMode() const; |
|
242 |
|
243 /** |
|
244 * @since 3.1 |
|
245 * @return |
|
246 */ |
|
247 void SetFullScreenMode(TBool aFullScreen); |
|
248 |
|
249 |
|
250 /** |
|
251 * @since 3.1 |
|
252 * @return |
|
253 */ |
|
254 void UpdateNow(); |
|
255 |
|
256 #ifdef __OOM__ |
|
257 void DeleteMinimapBitmap(); |
|
258 #endif |
|
259 |
|
260 TBool LowQuality() const { return iLowQuality; } |
|
261 |
|
262 protected: |
|
263 |
|
264 /** |
|
265 * C++ constructor. |
|
266 */ |
|
267 CMinimap(MPageScalerCallback& aCallback, TDisplayMode aMode, TBool aLowQuality); |
|
268 |
|
269 /** |
|
270 * By default Symbian 2nd phase constructor is private. |
|
271 */ |
|
272 void ConstructL(); |
|
273 |
|
274 private: |
|
275 friend class CMinimapGenerator; |
|
276 |
|
277 TRect FromDocCoords(const TRect& aFrom) const; |
|
278 TPoint FromDocCoords(const TPoint& aFrom) const; |
|
279 TSize FromDocCoords(const TSize& aFrom) const; |
|
280 TRect ToDocCoords(const TRect& aFrom) const; |
|
281 TPoint ToDocCoords(const TPoint& aFrom) const; |
|
282 TSize ToDocCoords(const TSize& aFrom) const; |
|
283 |
|
284 void CheckAndCreateMinimapBitmapsL(); |
|
285 TBool CheckAndCreateBitmapL(TSize aSize, CFbsBitmap*& aBm, CFbsBitmapDevice*& aDev, CFbsBitGc*& aGc); |
|
286 |
|
287 void InitColoringL(const TSize aSize); |
|
288 |
|
289 inline MPageScalerCallback& Callback() const; |
|
290 |
|
291 TSize CalcSize() const; |
|
292 TRect CalcViewportOnDocument() const; |
|
293 |
|
294 void DocumentChangedCbL(); |
|
295 void UpdateCbTimerCbL(); |
|
296 void UpdateTimerCbL(); |
|
297 void VisibilityTimerCbL(); |
|
298 |
|
299 void UpdateTransparency(); |
|
300 |
|
301 TRect ViewportOnMinimap() const; |
|
302 |
|
303 template<class GC> void DrawT(GC& aGc, const TRect& aRect) const; |
|
304 |
|
305 TInt BorderWidth() const; |
|
306 |
|
307 void ConstructSprite(); |
|
308 |
|
309 public: |
|
310 |
|
311 TBool IsDocumentComplete() const { return iDocumentComplete; } |
|
312 |
|
313 private: // Data |
|
314 |
|
315 // callbacks |
|
316 MPageScalerCallback* iCallback; |
|
317 |
|
318 // generator |
|
319 CMinimapGenerator* iGenerator; // owned |
|
320 |
|
321 // zoom level of the minimap in percent |
|
322 TInt iZoomOutLevel; |
|
323 |
|
324 // transparency in percent |
|
325 TInt iTransparency; |
|
326 |
|
327 // distance from the viewport edges (d<0 => right, bottom) |
|
328 TInt iXDist; |
|
329 TInt iYDist; |
|
330 |
|
331 // is it visible |
|
332 TBool iVisible; |
|
333 |
|
334 TDisplayMode iDisplayMode; |
|
335 |
|
336 CFbsBitmap* iMinimapBitmap; //owned |
|
337 CFbsBitmapDevice* iMinimapBitmapDevice; //owned |
|
338 CFbsBitGc* iMinimapBitmapGc; //owned |
|
339 |
|
340 CFbsBitmap* iMinimapMaskBitmap; //owned |
|
341 CFbsBitmapDevice* iMinimapMaskBitmapDevice; //owned |
|
342 CFbsBitGc* iMinimapMaskBitmapGc; //owned |
|
343 |
|
344 // Minimap coloring |
|
345 CFbsBitmap *iMinimapColoringBitmap; // owned |
|
346 CFbsBitmap *iMinimapColoringBitmapMask; // owned |
|
347 CFbsBitmapDevice* iMinimapColoringBitmapMaskDevice; //owned |
|
348 CFbsBitGc* iMinimapColoringBitmapMaskGc; //owned |
|
349 |
|
350 |
|
351 TRect iViewportOnDocument; |
|
352 |
|
353 TBool iNeedsUpdate; |
|
354 |
|
355 CMinimapTimer* iUpdateTimer; //owned |
|
356 CMinimapTimer* iUpdateCbTimer; //owned |
|
357 CMinimapTimer* iVisibilityTimer; //owned |
|
358 |
|
359 CMinimapTimer* iFadeTimer; //owned |
|
360 TBool iFadeDirection; //owned |
|
361 |
|
362 TBool iDocumentComplete; |
|
363 |
|
364 TInt iWidthPercent; |
|
365 TInt iHeightPercent; |
|
366 |
|
367 TRect iContainerRect; |
|
368 |
|
369 TBool iFullScreenMode; |
|
370 TBool iMinimapUpdating; |
|
371 |
|
372 TBool iLowQuality; |
|
373 |
|
374 RWsSprite iSprite; |
|
375 }; |
|
376 |
|
377 #include "minimap.inl" |
|
378 |
|
379 #endif // CMINIMAP_H |
|
380 |
|
381 // End of File |