|
1 |
|
2 |
|
3 /* |
|
4 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
5 * All rights reserved. |
|
6 * This component and the accompanying materials are made available |
|
7 * under the terms of "Eclipse Public License v1.0" |
|
8 * which accompanies this distribution, and is available |
|
9 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
10 * |
|
11 * Initial Contributors: |
|
12 * Nokia Corporation - initial contribution. |
|
13 * |
|
14 * Contributors: |
|
15 * |
|
16 * Description: Thumbnail loader |
|
17 * |
|
18 */ |
|
19 |
|
20 #ifndef MPXCOLLECTIONVIEWHGTNLOADER_H_ |
|
21 #define MPXCOLLECTIONVIEWHGTNLOADER_H_ |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <thumbnailmanager.h> // needs to be included here because of a bug in thumbnailmanagerobserver.h |
|
25 #include <thumbnailmanagerobserver.h> |
|
26 |
|
27 class CThumbnailManager; |
|
28 class CFbsBitmap; |
|
29 class CAsyncCallBack; |
|
30 |
|
31 /** |
|
32 * Observer iface |
|
33 */ |
|
34 class MMpxTNLoaderObserver |
|
35 { |
|
36 public: |
|
37 virtual void TNReadyL(TInt aError, CFbsBitmap* aBitmap, CFbsBitmap* aMask, TInt aIndex) = 0; |
|
38 }; |
|
39 |
|
40 /** |
|
41 * TN Loader |
|
42 */ |
|
43 NONSHARABLE_CLASS( CMpxTNLoader ) : public CBase, public MThumbnailManagerObserver |
|
44 { |
|
45 public: // CONSTRUCTORS & DESCTRUCTOR |
|
46 |
|
47 static CMpxTNLoader* NewL(MMpxTNLoaderObserver& aObserver, TThumbnailSize aSize ); |
|
48 virtual ~CMpxTNLoader(); |
|
49 |
|
50 public: // NEW FUNCTIONS |
|
51 |
|
52 void LoadThumbL(TInt aIndex, const TDesC& aFileName ); |
|
53 void CancelThumb( TInt aIndex ); |
|
54 void CancelAll(); |
|
55 void SetSizeL( TThumbnailSize aSize ); |
|
56 |
|
57 private: // From MThumbnailManagerObserver |
|
58 |
|
59 void ThumbnailPreviewReady( MThumbnailData& aThumbnail, |
|
60 TThumbnailRequestId aId ); |
|
61 void ThumbnailReady( TInt aError, MThumbnailData& aThumbnail, |
|
62 TThumbnailRequestId aId ); |
|
63 |
|
64 private: // CONSTRUCTORS |
|
65 |
|
66 CMpxTNLoader(MMpxTNLoaderObserver& aObserver, |
|
67 TThumbnailSize aSize ); |
|
68 void ConstructL(); |
|
69 |
|
70 private: // NEW FUNCTIONS |
|
71 |
|
72 TInt FindLoadingById(TThumbnailRequestId aId, TBool aRemove = EFalse); |
|
73 TInt FindLoadingByIndex(TInt aIndex, TBool aRemove = EFalse); |
|
74 static TInt LoadThumbnail( TAny* aSelf ); |
|
75 void LoadNextTN(); |
|
76 |
|
77 private: // DATA |
|
78 |
|
79 MMpxTNLoaderObserver& iObserver; |
|
80 CThumbnailManager* iTnEngine; // Own |
|
81 |
|
82 // Loading information |
|
83 class TLoadingTN |
|
84 { |
|
85 public: |
|
86 TLoadingTN(TThumbnailRequestId aId, TInt aIndex, const TDesC& aFileName ) |
|
87 : iId(aId), iIndex(aIndex), iFileName( aFileName ) |
|
88 { |
|
89 } |
|
90 |
|
91 TThumbnailRequestId iId; |
|
92 TInt iIndex; |
|
93 TFileName iFileName; |
|
94 }; |
|
95 |
|
96 RPointerArray<TLoadingTN> iLoading; // Loading Thubmbs |
|
97 CAsyncCallBack* iAsyncCallBack; |
|
98 TThumbnailSize iSize; |
|
99 }; |
|
100 |
|
101 #endif // MPXCOLLECTIONVIEWHGTNLOADER_H_ |