|
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: Grid view control class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef CGLXGRIDVIEWCONTROL_H |
|
22 #define CGLXGRIDVIEWCONTROL_H |
|
23 |
|
24 #include <coecntrl.h> |
|
25 // Ganes observerers |
|
26 #include <ganes/HgScrollBufferObserverIface.h> |
|
27 #include <ganes/HgSelectionObserverIface.h> |
|
28 #include <ganes/HgMarkingObserverIface.h> |
|
29 |
|
30 // Photos Headers |
|
31 #include <mglxmedialistprovider.h> |
|
32 #include <glxmedialistiterator.h> // Interface for going through items in |
|
33 #include <glxmedialistfactory.h> // MGlxMediaListFactory |
|
34 |
|
35 #include <glxthumbnailcontext.h> |
|
36 #include <glxuistd.h> |
|
37 #include <glxprogressindicator.h> |
|
38 |
|
39 #include "glxgridvieweventobserver.h" |
|
40 #include "glxmmcnotifier.h" |
|
41 |
|
42 class CHgGrid; |
|
43 class CGlxUiUtility; |
|
44 class CGlxGridViewMLObserver; |
|
45 class CGlxActiveMediaListRegistry; |
|
46 class CGlxThumbnailContext; |
|
47 class CGlxDRMUtility; |
|
48 class CAknsBasicBackgroundControlContext; |
|
49 class CGlxNavigationalState; |
|
50 |
|
51 //class declaration |
|
52 |
|
53 class CGlxGridViewContainer : public CCoeControl, |
|
54 public MHgScrollBufferObserver, |
|
55 public MHgSelectionObserver, |
|
56 public MHgMarkingObserver, |
|
57 public MStorageNotifierObserver |
|
58 { |
|
59 public: |
|
60 /** |
|
61 * Two-phased constructor. |
|
62 * |
|
63 * @since 3.0 |
|
64 * @return Pointer to newly created object. |
|
65 */ |
|
66 static CGlxGridViewContainer *NewL(MGlxMediaList *aMediaList,CGlxUiUtility* aUiUtility,MGlxGridEventObserver& aObserver,CAknToolbar* aToolbar ); |
|
67 |
|
68 /** |
|
69 * Two-phased constructor. |
|
70 * |
|
71 * @since 3.0 |
|
72 * @return Pointer to newly created object. |
|
73 */ |
|
74 static CGlxGridViewContainer *NewLC(MGlxMediaList *aMediaList,CGlxUiUtility* aUiUtility,MGlxGridEventObserver& aObserver,CAknToolbar* aToolbar); |
|
75 |
|
76 //destructor |
|
77 ~CGlxGridViewContainer(); |
|
78 |
|
79 |
|
80 TBool HandleViewCommandL(TInt aCommand); |
|
81 protected: // from MHgScrollBufferObserver |
|
82 void Request(TInt aRequestStart, TInt aRequestEnd, THgScrollDirection aDirection); |
|
83 void Release(TInt aReleaseStart, TInt aReleaseEnd); |
|
84 |
|
85 protected: // from MHgSelectionObserver |
|
86 void HandleSelectL( TInt aIndex ); |
|
87 void HandleOpenL( TInt aIndex ); |
|
88 |
|
89 protected: // from MHgMarkingObserver |
|
90 |
|
91 void HandleMarkingL( TInt aIndex, TBool aMarked ); |
|
92 |
|
93 public: // From CCoeControl |
|
94 |
|
95 TTypeUid::Ptr MopSupplyObject(TTypeUid aId); |
|
96 TKeyResponse OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType); |
|
97 |
|
98 //handle orientaion realted changes |
|
99 void HandleResourceChange(TInt aType); |
|
100 |
|
101 private: |
|
102 /** |
|
103 * C++ default constructor. |
|
104 */ |
|
105 CGlxGridViewContainer(MGlxMediaList *aMediaList,CGlxUiUtility* aUiUtility,MGlxGridEventObserver& aObserver,CAknToolbar* aToolbar); |
|
106 /** |
|
107 * By default Symbian 2nd phase constructor is private. |
|
108 */ |
|
109 void ConstructL(); |
|
110 |
|
111 void RequestL(TInt aRequestStart, TInt aRequestEnd); |
|
112 |
|
113 //create grid |
|
114 void CreateGridL(); |
|
115 |
|
116 /** |
|
117 * Set grid thumbnail context with BlokyIterator to fetch |
|
118 * grid thumbnails |
|
119 */ |
|
120 void SetGridThumbnailContextL(); |
|
121 |
|
122 // Create HG Grid widget |
|
123 void CreateHgGridWidgetL(); |
|
124 |
|
125 // Create an observer and pass MediaList and HGGrid objects |
|
126 void CreateGridMediaListObserverL(); |
|
127 |
|
128 // Create Grid once again after returning from FS as No calls for handleItem added. |
|
129 void CreateGridAfterFSDeactivatedL(); |
|
130 /** |
|
131 /** |
|
132 * Handle Multiple marking |
|
133 */ |
|
134 void HandleMultipleMarkingL(TInt aIndex , TBool aMarked ); |
|
135 /** |
|
136 * Set the Icons |
|
137 */ |
|
138 void SetIconsL(TInt index); |
|
139 |
|
140 //handle enterkey realted events |
|
141 void HandleEnterKeyEventL(TInt aCommand); |
|
142 |
|
143 /** |
|
144 * Checks the availability of relevant thumbnail(Quality or Speed) attribute |
|
145 * @param aIndex Media index to check the thumbnail attribute |
|
146 * @return ETrue if relevant thumbnail available |
|
147 * EFalse if relevant thumbnail not available |
|
148 */ |
|
149 TBool HasRelevantThumbnail(TInt aIndex); |
|
150 /** |
|
151 * Calculate and return the client rect for HGgrid |
|
152 * Required as the tool bar is dynamically created. |
|
153 */ |
|
154 TRect GetHgGridRect(); |
|
155 /** |
|
156 * handle mmc insertion event |
|
157 */ |
|
158 void HandleMMCInsertionL(); |
|
159 /** |
|
160 * handle mmc removal event |
|
161 */ |
|
162 void HandleMMCRemovalL(); |
|
163 |
|
164 /** |
|
165 * SetIconL - Sets the grid cell icon with the given parameters |
|
166 * @param aItemIndex - The grid cell index |
|
167 * @param aBitmapId - The bitmap id |
|
168 * @param aMaskId - The mask id |
|
169 */ |
|
170 void SetIconL(TInt aItemIndex, TInt aBitmapId, TInt aMaskId); |
|
171 |
|
172 private: |
|
173 //medialist |
|
174 MGlxMediaList* iMediaList; // MGlxMedialist , to Create MediaList |
|
175 |
|
176 //Drmutility |
|
177 CGlxUiUtility* iUiUtility; |
|
178 |
|
179 //No of visible items in a page/view |
|
180 TInt iItemsPerPage; |
|
181 |
|
182 // HG Grid instance |
|
183 CHgGrid* iHgGrid; |
|
184 |
|
185 // Medialist observer for Grid view |
|
186 CGlxGridViewMLObserver* iGlxGridMLObserver; |
|
187 |
|
188 // Thumbnail context |
|
189 CGlxThumbnailContext* iThumbnailContext; |
|
190 |
|
191 // Iterators for Grid and FS |
|
192 TGlxFromManualIndexBlockyIterator iBlockyIterator; |
|
193 |
|
194 // Grid Icon size from FS view |
|
195 TSize iGridIconSize; |
|
196 |
|
197 // Hg Grid preferred image size |
|
198 TSize iHgGridImageSize; |
|
199 |
|
200 // The Resource file name from which icons to be read |
|
201 TFileName iIconsFileName; |
|
202 |
|
203 // Bool to check backward navigation |
|
204 TBool iBackwardActivation; |
|
205 |
|
206 // Provides DRM related functionality |
|
207 CGlxDRMUtility* iDRMUtility; |
|
208 |
|
209 // Background context for the themes to be used in MopSupplyObject |
|
210 CAknsBasicBackgroundControlContext* iBgContext; //Own |
|
211 |
|
212 //Grid Thumbnail Attribs |
|
213 TMPXAttribute iQualityTnAttrib; |
|
214 TMPXAttribute iSpeedTnAttrib; |
|
215 |
|
216 // Making the default FSActivation as false |
|
217 TBool iFullscreenViewActivated; |
|
218 |
|
219 // Navigational state need to be changed while launching fullscreen |
|
220 CGlxNavigationalState* iNavigationalstate; |
|
221 |
|
222 // making the default mode of marking as false |
|
223 TBool iMultipleMarkingActive ; |
|
224 |
|
225 //flag to prevent call to HandleOpen( ) on multiple tap for video |
|
226 TBool iIsFSVideoViewActivating; |
|
227 |
|
228 //observer |
|
229 MGlxGridEventObserver& iGlxGridViewObserver; |
|
230 //toolbar - created dynamically. |
|
231 CAknToolbar* iToolbar; |
|
232 CGlxProgressIndicator* iProgressIndicator; |
|
233 CGlxMMCNotifier* iMMCNotifier; |
|
234 TBool iIsDialogLaunched; |
|
235 TBool iIsMMCRemoved; |
|
236 }; |
|
237 |
|
238 #endif // CGLXGRIDVIEWCONTROL_H |
|
239 |