|
1 /* |
|
2 * Copyright (c) 2008-2009 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 : Class header for preview thumbnail in list view |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef _GLXPREVIEWTHUMBNAILBINDING_H_ |
|
20 #define _GLXPREVIEWTHUMBNAILBINDING_H_ |
|
21 |
|
22 |
|
23 #include "glxbinding.h" // The binding is created by the binding set factory. |
|
24 #include "glxmedialistiterator.h" // Interface for going through items in the list in a non-sequential order |
|
25 #include "mglxmedialistobserver.h" // Observes for changes in media list |
|
26 #include <memory> |
|
27 |
|
28 |
|
29 class GlxThumbnailVariantType; |
|
30 class CGlxThumbnailContext; // Fetch context to retrieve thumbnails |
|
31 |
|
32 /** |
|
33 * Observer interface |
|
34 */ |
|
35 class MPreviewTNObserver |
|
36 { |
|
37 public: |
|
38 virtual void PreviewTNReadyL(CFbsBitmap* aBitmap, CFbsBitmap* aMask, TInt aIndex) = 0; |
|
39 }; |
|
40 |
|
41 // CLASS DECLARATION |
|
42 /** |
|
43 * Implementation of preview thumbnail binding for the |
|
44 * list view. |
|
45 * |
|
46 */ |
|
47 |
|
48 NONSHARABLE_CLASS(CGlxPreviewThumbnailBinding) : public CBase, |
|
49 public MGlxMediaListObserver |
|
50 { |
|
51 public: |
|
52 |
|
53 /** |
|
54 * Two phase construction |
|
55 * @param aMulTag Mul field that the binding corresponds to |
|
56 */ |
|
57 static CGlxPreviewThumbnailBinding* NewL (MPreviewTNObserver& aObserver); |
|
58 |
|
59 /** |
|
60 * Two phase construction |
|
61 */ |
|
62 static CGlxPreviewThumbnailBinding* NewLC(MPreviewTNObserver& aObserver ); // takes ownership |
|
63 |
|
64 |
|
65 /** |
|
66 * Destructor |
|
67 */ |
|
68 ~CGlxPreviewThumbnailBinding(); |
|
69 |
|
70 /** |
|
71 * HasFirstThumbnail |
|
72 */ |
|
73 TBool HasFirstThumbnail( const RArray< TMPXAttribute >& aAttributes ); |
|
74 |
|
75 private: |
|
76 |
|
77 /** |
|
78 * Constructor |
|
79 */ |
|
80 CGlxPreviewThumbnailBinding(MPreviewTNObserver& aObserver); |
|
81 |
|
82 /** |
|
83 * Two phase construction |
|
84 */ |
|
85 void ConstructL(); |
|
86 |
|
87 public: |
|
88 void HandleItemChangedL(const CMPXCollectionPath& aPath, TBool aPopulateListTNs); |
|
89 void StartTimer(TBool aPopulateListTNs); |
|
90 |
|
91 // From MGlxMediaListObserver |
|
92 void HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); |
|
93 void HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); |
|
94 void HandleAttributesAvailableL( TInt aItemIndex, |
|
95 const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* aList ); |
|
96 void HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType, |
|
97 TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList ); |
|
98 void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList ); |
|
99 void HandleMessageL( const CMPXMessage& aMessage, MGlxMediaList* aList ); |
|
100 void HandleError( TInt aError ); |
|
101 void HandleCommandCompleteL( CMPXCommand* aCommandResult, TInt aError, |
|
102 MGlxMediaList* aList ); |
|
103 void HandleMediaL( TInt aListIndex, MGlxMediaList* aList ); |
|
104 void HandleItemModifiedL( const RArray<TInt>& aItemIndexes, MGlxMediaList* aList ); |
|
105 |
|
106 private: |
|
107 /** |
|
108 * IsTimeL |
|
109 */ |
|
110 static TInt IsTimeL( TAny* aSelf ); |
|
111 |
|
112 /** |
|
113 * TimerTickedL |
|
114 */ |
|
115 void TimerTickedL(); |
|
116 |
|
117 private: |
|
118 MPreviewTNObserver& iObserver; |
|
119 |
|
120 // Timer that checks for the time expiration |
|
121 CPeriodic* iTimer; |
|
122 |
|
123 //Medialist that holds the thumbnail information |
|
124 MGlxMediaList* iMediaList; |
|
125 |
|
126 // Thumbnail context |
|
127 CGlxThumbnailContext* iThumbnailContext; |
|
128 |
|
129 // for thumbnail context |
|
130 TGlxSequentialIterator iThumbnailIterator; |
|
131 |
|
132 // Preview thumbnail index |
|
133 TInt iProgressIndex; |
|
134 |
|
135 // flag that says whether timer has expired |
|
136 TBool iTimerTicked; |
|
137 |
|
138 //flag will be true, when initially the first thumbnails for all the |
|
139 //items in the list are populated. |
|
140 TBool iPopulateListTNs; |
|
141 |
|
142 //it holds the initial number of thumbnail to be displayed |
|
143 RArray<TInt> iPreviewItemCount; |
|
144 |
|
145 TSize iGridIconSize; |
|
146 |
|
147 // Holds the numbers of trials count,after which PreviewTNReady callback |
|
148 // has to be called |
|
149 TInt iTrialCount; |
|
150 |
|
151 TInt iTrial; |
|
152 }; |
|
153 |
|
154 |
|
155 #endif //_GLXPREVIEWTHUMBNAILBINDING_H_ |