|
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: Definition of CGlxZoomControl |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_GLXZOOMCONTROL_H |
|
20 #define C_GLXZOOMCONTROL_H |
|
21 |
|
22 // INCLUDES |
|
23 |
|
24 #include <w32std.h> // For TEventCode |
|
25 |
|
26 #include <alf/alfcontrol.h> |
|
27 #include <alf/ialfwidgeteventhandler.h> |
|
28 #include <gestureobserver.h> |
|
29 #include <gesturehelper.h> |
|
30 |
|
31 #include <mglxtextureobserver.h> |
|
32 #include <mglxmedialist.h> |
|
33 #include <mglxzoomeventhandlers.h> |
|
34 #include <glxfullscreenview.hrh> |
|
35 #include <glxzoomeventhandler.h> |
|
36 #include <mglxtvobserver.h> // for inteface MGlxTvObserver |
|
37 #include "glxrequestfreegoom.h" |
|
38 //Gesture Helper namespace |
|
39 namespace GestureHelper |
|
40 { |
|
41 class CGestureHelper; |
|
42 } |
|
43 |
|
44 |
|
45 namespace Alf |
|
46 { |
|
47 class IAlfViewWidget; |
|
48 class IMulSliderWidget; |
|
49 class IMulSliderModel; |
|
50 class IAlfWidgetEventHandler; |
|
51 } |
|
52 // FORWARD DECLARATIONS |
|
53 class CGlxDefaultAttributeContext; |
|
54 class CGlxUiUtility; |
|
55 class MGlxUiCommandHandler; |
|
56 class CAlfImageVisual; |
|
57 class CAlfViewportLayout; |
|
58 class TAlfImage; |
|
59 class CEikButtonGroupContainer; |
|
60 class CGlxTextureManager; |
|
61 class CGestureHelper; |
|
62 class MGestureObserver; |
|
63 |
|
64 class CGlxTv; |
|
65 using namespace Alf; |
|
66 |
|
67 // Commands sent to the view in response to zoom keys |
|
68 const TInt KGlxZoomInCommand = 1 ; |
|
69 const TInt KGlxZoomOutCommand = 2 ; |
|
70 const TInt KGlxZoomOrientationChange =3; |
|
71 const TInt KGlxVerticalImageOrientationThreshold = 4 ; |
|
72 |
|
73 /** |
|
74 * Control for zooming in the FullScreen view. |
|
75 * @ingroup glx_view_zoomed_view |
|
76 */ |
|
77 class CGlxZoomControl : public CAlfControl, |
|
78 public IAlfWidgetEventHandler, |
|
79 public MGlxTextureObserver, |
|
80 public MGlxZoomEventHandlers, |
|
81 public GestureHelper::MGestureObserver, |
|
82 public MGlxTvObserver, |
|
83 public MGoomNotifierObserver |
|
84 { |
|
85 public: |
|
86 // Constructors and destructor |
|
87 /** |
|
88 * Two-phased constructor. |
|
89 * @param aCommandHandler: Handler for commands. |
|
90 * @param aMediaList : Reference to media list. |
|
91 * @param aZoomKeys : Reference to Back Key. |
|
92 * @param aSliderWidget : Reference to slider widget created in fullscreen view. |
|
93 */ |
|
94 IMPORT_C static CGlxZoomControl* NewL( |
|
95 MGlxUiCommandHandler& aCommandHandler, |
|
96 MGlxMediaList& aMediaList,CEikButtonGroupContainer& aZoomKeys, |
|
97 IMulSliderWidget& aSliderWidget, GestureHelper::CGestureHelper* aGestureHelper); |
|
98 |
|
99 /** |
|
100 * Destructor. |
|
101 */ |
|
102 ~CGlxZoomControl(); |
|
103 |
|
104 /** |
|
105 * Show the control and begin zooming in. |
|
106 * @param aIntialZoomLevel:The Initial Zoom Level shown when zoom is active from full screen view. |
|
107 * @param aTap :if the zoom was launched by tapping or by pressing volume key. |
|
108 * @param aViewingMode :if the image is opened from imgviewer or not |
|
109 */ |
|
110 IMPORT_C void ActivateL(TInt aIntialZoomRatio,TZoomStartMode aStartMode,TInt aFocusIndex, |
|
111 TGlxMedia& aItem, TPoint* aZoomFocus = NULL |
|
112 ,TBool aViewingMode = EFalse); |
|
113 |
|
114 /** |
|
115 * Hide the control and disable zooming. |
|
116 */ |
|
117 IMPORT_C void Deactivate(); |
|
118 |
|
119 /** |
|
120 * to check if the zoom control is activated? |
|
121 */ |
|
122 IMPORT_C TBool Activated(); |
|
123 |
|
124 /** |
|
125 * Zoom Foreground event handling function |
|
126 * @param aForeground: value signify if it is in foreground or not. |
|
127 */ |
|
128 IMPORT_C void HandleZoomForegroundEvent(TBool aForeground); |
|
129 |
|
130 void UpdateViewPort( |
|
131 TPoint& aViewPortTopLeft , |
|
132 TInt aTransitionTime , |
|
133 TSize *apViewPortDimension = NULL, |
|
134 TInt aPrimarySliderLevel = -1); |
|
135 |
|
136 /** |
|
137 * Retrieve the UI State of the Zoom view |
|
138 */ |
|
139 IMPORT_C TUiState ZoomUiState(); |
|
140 |
|
141 private:// From MGlxTvObserver |
|
142 virtual void HandleTvStatusChangedL ( TTvChangeType aChangeType ); |
|
143 |
|
144 private: // From CAlfControl |
|
145 TBool OfferEventL(const TAlfEvent &aEvent); |
|
146 |
|
147 void VisualLayoutUpdated(CAlfVisual &aVisual); |
|
148 |
|
149 private: //From IAlfWidgetEventHandler |
|
150 AlfEventStatus offerEvent( CAlfWidgetControl& /*aControl*/, const TAlfEvent& aEvent ); |
|
151 |
|
152 bool accept( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ) const; |
|
153 |
|
154 void setEventHandlerData( const AlfWidgetEventHandlerInitData& aData ); |
|
155 |
|
156 AlfWidgetEventHandlerInitData* eventHandlerData(); |
|
157 |
|
158 void setActiveStates( unsigned int aStates ); |
|
159 |
|
160 IAlfInterfaceBase* makeInterface( const IfId& aType ); |
|
161 |
|
162 AlfEventHandlerType eventHandlerType() ; |
|
163 |
|
164 AlfEventHandlerExecutionPhase eventExecutionPhase() ; |
|
165 |
|
166 private: // From MGlxTextureObserver |
|
167 void TextureContentChangedL( TBool aHasContent , CAlfTexture* aNewTexture); |
|
168 |
|
169 private: // From MGlxZoomEventHandlers |
|
170 void HandleViewPortParametersChanged(TPoint& aViewPortTopLeft , |
|
171 TInt aTransitionTime , |
|
172 TSize *apViewPortDimension = NULL, |
|
173 TInt aPrimarySliderLevel = -1); |
|
174 |
|
175 void HandleShowUi(TBool aShow= EFalse) ; |
|
176 |
|
177 void HandleZoomOutL(TInt aCommandId); |
|
178 |
|
179 private: |
|
180 /* |
|
181 * Call back function for the CPeriodic |
|
182 */ |
|
183 static TInt TimeOut(TAny* aSelf); |
|
184 void ActivateFullscreen(); |
|
185 void StartZoomAnimation(TZoomStartMode aStartMode); |
|
186 |
|
187 private: |
|
188 /** |
|
189 * C++ default constructor. |
|
190 */ |
|
191 CGlxZoomControl(MGlxUiCommandHandler& aCommandHandler, |
|
192 MGlxMediaList& aMediaList,CEikButtonGroupContainer& aZoomKeys, |
|
193 IMulSliderWidget& aSliderWidget, GestureHelper::CGestureHelper* aGestureHelper); |
|
194 /** |
|
195 * Does the necessary Initialization of iUiUtility,control group and the Media list. |
|
196 */ |
|
197 void ConstructL(); |
|
198 /** |
|
199 * Creation of zoomvisual:creates the zoom visual and sets the Black Background behind the image |
|
200 * and also sets the ViewPort Layout. |
|
201 */ |
|
202 void CreateZoomVisualL(); |
|
203 /** |
|
204 * Turn the UI/Screen Furniture[Back Key/Slider] on |
|
205 */ |
|
206 void ShowUi(TBool aShow); |
|
207 |
|
208 /** |
|
209 * Cleanup function resets all the memeber variable on deactivating the ZoomControl |
|
210 */ |
|
211 void CleanUpVisual(); |
|
212 |
|
213 /* |
|
214 * Get Orientation of the file , |
|
215 * This code is DUPLICATE and second copy implemented in bitmapdecoder, |
|
216 * Got to plan for removing this duplicacy |
|
217 */ |
|
218 TUint16 GetOrientationL(const TDesC& aFileName) ; |
|
219 |
|
220 /* |
|
221 * This Function Shows/Hides the zoom |
|
222 * by setting the level of Opacity |
|
223 */ |
|
224 void ShowZoom(TBool aShow); |
|
225 |
|
226 /* |
|
227 * Retrieves the Screensize with the help of Alf utility |
|
228 */ |
|
229 TSize ScreenSize(); |
|
230 |
|
231 void HandleGestureL( const GestureHelper::MGestureEvent& aEvent ); |
|
232 |
|
233 TBool HandlePointerEventsL(const TAlfEvent &aEvent); |
|
234 |
|
235 TReal32 GetInitialZoomLevel(TSize& aSize ); |
|
236 |
|
237 /* |
|
238 * Does the zoom out on pinch released event |
|
239 */ |
|
240 void HandleHDMIGestureReleased(); |
|
241 |
|
242 /* |
|
243 * @ Notification from MGoomNotifierObserver |
|
244 */ |
|
245 void HandleGoomMemoryReleased(TInt aStatus); |
|
246 |
|
247 private: // Data |
|
248 CAlfEnv* iEnv; // AlfEnv |
|
249 MGlxMediaList& iMediaList; // Medialist (not owned) |
|
250 GestureHelper::CGestureHelper* iGestureHelper; // Attribute context for image dimensions |
|
251 IMulSliderModel* iZoomSliderModel; // Zoom slider model |
|
252 IMulSliderWidget& iZoomSliderWidget; // Zoom slider Widget |
|
253 CEikButtonGroupContainer* iZoomBackKey; // Back zoom soft key(not owned) |
|
254 CGlxDefaultAttributeContext* iAttributeContext; // Attribute context for image dimensions |
|
255 |
|
256 CAlfDisplay* iDisplay; // Alf Display |
|
257 CGlxUiUtility* iUiUtility; // UI utility |
|
258 CGlxTextureManager* iTextureMgr; // TextureManager |
|
259 CAlfControlGroup* iControlGroup; // Control group for the Zoom control |
|
260 |
|
261 CAlfViewportLayout* iViewPort; // Parent Layout for Zooming/Panning |
|
262 CAlfImageVisual* iImageVisual; // Child visual for normal image items (not owned) |
|
263 CAlfTexture* iImageTexture; // Texture to be zoomed |
|
264 |
|
265 TBool iIsdrag; // To determine if drag occured to evaluate the single tap |
|
266 TBool iZoomActive; // This variable is updated when Zoom is activated. |
|
267 TSize iOriginalDimensions; |
|
268 |
|
269 MGlxUiCommandHandler& iCommandHandler; // For Handling ZoomOut commands |
|
270 CGlxZoomPanEventHandler* iEventHandler; // The event handler for the Zoom Pan Engine |
|
271 |
|
272 TSize iScreenSize; |
|
273 TBool iMultiTouchGestureOngoing; |
|
274 CGlxTv* iGlxTvOut; |
|
275 CPeriodic* iTimer; |
|
276 TBool iZoomIn; |
|
277 CGlxRelaseGPUMemory* iGPUMemMonitor; |
|
278 }; |
|
279 |
|
280 #endif // C_GLXZOOMCONTROL_H |
|
281 |
|
282 // End of File |