|
1 /* |
|
2 * Copyright (c) 2004,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 "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: SVGT UI Dialog implements a custom dialog used to display |
|
15 * SVGT content. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef __SVGTUIDIALOG_H__ |
|
21 #define __SVGTUIDIALOG_H__ |
|
22 #include <AknDialog.h> |
|
23 #include <aknnavide.h> |
|
24 #include <SVGTCustControl.h> |
|
25 #include <SvgtApplicationExitObserver.h> |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CSVGTCustControl; |
|
29 class MSvgtAppObserver; |
|
30 class MSVGTProgressBarDrawImpl; |
|
31 class TCoeHelpContext; |
|
32 |
|
33 /** |
|
34 * Provides the dialog functionality for viewing SVGT files. |
|
35 * @lib SVGTUIControl.lib |
|
36 * @since 3.0 |
|
37 */ |
|
38 |
|
39 class CSVGTUIDialog : public CAknDialog, |
|
40 public MSVGTProgressBarDrawImpl, |
|
41 public MSVGTMSKImpl, //Added since 3.2 interface for MSK label impl |
|
42 public MSvgtApplicationExitObserver, |
|
43 public MSvgAudioMuteListener, |
|
44 public MCustControlPointerEventHandler |
|
45 { |
|
46 public: // Constructors and destructor |
|
47 /** |
|
48 * Two-phased constructor. |
|
49 */ |
|
50 IMPORT_C static CSVGTUIDialog* NewL(); |
|
51 |
|
52 /** |
|
53 * Two-phased constructor. |
|
54 */ |
|
55 IMPORT_C static CSVGTUIDialog* NewLC(); |
|
56 |
|
57 |
|
58 |
|
59 // Destructor |
|
60 virtual ~CSVGTUIDialog(); |
|
61 public: // New functions |
|
62 public: // Functions from base classes |
|
63 /** |
|
64 * From CAknDialog Executes the dialog and deletes the dialog on exit. |
|
65 * @since 3.0 |
|
66 * @param aFileHandle File handle to the SVGT content. |
|
67 * @param aAppObs Implementation Class provided by application that |
|
68 * uses this dialog |
|
69 * Note: The ownership of the file handle is not transferred. |
|
70 * It is the responsibility of the caller to close this file |
|
71 * after deleting this dialog. |
|
72 * @return Integer - Indicates Exit Reason. |
|
73 */ |
|
74 virtual TInt ExecuteLD( RFile& aFileHandle, |
|
75 MSvgtAppObserver *ptr ); |
|
76 |
|
77 /** |
|
78 * From CAknDialog - Called by framework to process commands invoked by |
|
79 * the user. |
|
80 */ |
|
81 virtual void ProcessCommandL( TInt aCommandId ); |
|
82 |
|
83 public: //From MSvgtApplicationExitObserver |
|
84 void HandleApplicationExitL( TInt aExitCommand ); |
|
85 IMPORT_C void AssignImageData( const TDesC& aUri, HBufC8* aData ); |
|
86 |
|
87 public:// From MSvgAudioMuteListener |
|
88 /** |
|
89 * This method is to remove the muted icon |
|
90 * @since 5.0 |
|
91 * @param aIsVolumeMuted: indicates if volume is to be muted |
|
92 * @return none. |
|
93 */ |
|
94 void VolumeMuted(TBool aIsVolumeMuted); |
|
95 public: |
|
96 |
|
97 |
|
98 /** |
|
99 * This function is called by the application to check whether the |
|
100 * loading of the svg content is done. |
|
101 * @since 3.0 |
|
102 * @return TBool iIsLoadingDone |
|
103 */ |
|
104 virtual TBool IsLoadingDone(); |
|
105 /** |
|
106 * Function used by the application to handle background/foreground |
|
107 * events. When the application goes to background the presentation |
|
108 * needs to be paused. When application comes back to foreground, |
|
109 * the user would need to start the paused presentation. |
|
110 * @param aForeground: ETrue: Foreground event, |
|
111 * EFalse: Background event. |
|
112 * @since 3.0 |
|
113 */ |
|
114 virtual void HandleApplicationForegroundEvent( TBool aForeground ); |
|
115 |
|
116 /** |
|
117 * Function used by the client to indicate the filehandle is |
|
118 * no longer going to be valid. e.g. In Move operation of the |
|
119 * file, client could close old file and open new one after |
|
120 * move is over. |
|
121 * @since 3.0 |
|
122 */ |
|
123 virtual void StopUsingContentFileHandle(); |
|
124 /** |
|
125 * Function used by the client to indicate the filehandle is |
|
126 * going to be valid now. e.g. In Move operation of the |
|
127 * file, client could close old file and open new one after |
|
128 * move is over. |
|
129 * @since 3.0 |
|
130 */ |
|
131 virtual void StartUsingContentFileHandle(); |
|
132 |
|
133 /** |
|
134 * Function used by the client to check if text in the content |
|
135 * was modified, to check if save is needed. |
|
136 * @since 3.1 |
|
137 */ |
|
138 virtual TBool IsTextContentChanged(); |
|
139 |
|
140 /** |
|
141 * Function used by the client to save the modified svg content |
|
142 * @since 3.1 |
|
143 */ |
|
144 virtual TInt SaveSvgDom( const TDesC& aFileName ); |
|
145 |
|
146 /** |
|
147 * Function used by the client to notify dialog that save is complete |
|
148 * @since 3.1 |
|
149 */ |
|
150 virtual void SaveComplete( TInt aError ); |
|
151 |
|
152 protected: // New functions |
|
153 /** |
|
154 * Convert a time given in milliseconds to a descriptor. |
|
155 * The format depends on how big the given duration is. |
|
156 * Durations of less than an hour are formatted using |
|
157 * the short format (02:24). Longer durations are formatted |
|
158 * using the long format (1:02:04). Maximum duration is 10 hours. |
|
159 * |
|
160 * @since 3.0 |
|
161 * @param aDuration duration in seconds |
|
162 * @param aBuf descriptor to hold the converted string |
|
163 * |
|
164 */ |
|
165 void FormatTimeL( const TUint& aDuration, |
|
166 TDes& aBuf ) const; |
|
167 |
|
168 /** |
|
169 * This function is called when the user presses back or Exit. |
|
170 * prompts a confirmation query to the user and then calls DoSaveL |
|
171 * @param aButtonId |
|
172 * @since 3.0 |
|
173 */ |
|
174 TBool SaveNeededL( TInt aButtonId ); |
|
175 |
|
176 /** |
|
177 * This function prompts a save confirmation query to the user |
|
178 * @since 3.0 |
|
179 */ |
|
180 TBool LaunchSaveQueryDialogL() const; |
|
181 |
|
182 /** |
|
183 * This function changes the layout of the dialog to full screen mode |
|
184 * @since 3.0 |
|
185 */ |
|
186 void SwitchDialogLayoutL( TBool aIsFullScreen ); |
|
187 |
|
188 protected: // Functions from base classes |
|
189 // From CEikDialog |
|
190 // From CAknDialog |
|
191 |
|
192 /** |
|
193 * From CAknDialog - Called by framework to dynamically manipulate |
|
194 * the menu for the dialog. |
|
195 */ |
|
196 void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); |
|
197 |
|
198 /** |
|
199 * From CAknDialog - Framework method to determine if it OK |
|
200 * to exit the dialog. |
|
201 */ |
|
202 TBool OkToExitL( TInt aButtonId ); |
|
203 |
|
204 /** |
|
205 * From CAknDialog - Called by framework to add custom control to the |
|
206 * dialog when specified in resource. |
|
207 */ |
|
208 SEikControlInfo CreateCustomControlL( TInt aControlType ); |
|
209 |
|
210 /** |
|
211 * From CAknDialog - Called by framework to notify resize of dialog. |
|
212 */ |
|
213 void SizeChanged(); |
|
214 |
|
215 /** |
|
216 * From CCoeControl Key Handling Method for control. |
|
217 * @since 3.0 |
|
218 * @param aKeyEvent Key Event. |
|
219 * @param aType Type of Key Event. |
|
220 * @return TKeyResponse - EKeyWasConsumed/EKeyWasNotConsumed. |
|
221 */ |
|
222 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
223 TEventCode aType ); |
|
224 |
|
225 #ifdef __SERIES60_HELP |
|
226 /** |
|
227 * From CCoeControl Context Sensitive Help ID retrieving function. |
|
228 * @since 3.0 |
|
229 * @see CCoeControl |
|
230 */ |
|
231 void GetHelpContext( TCoeHelpContext& aContext ) const; |
|
232 #endif |
|
233 /** |
|
234 * From CCoeControl |
|
235 * @see CCoeControl::HandleResourceChange |
|
236 */ |
|
237 void HandleResourceChange( TInt aType ); |
|
238 |
|
239 /** |
|
240 * From MSVGTProgressBarDrawImpl. This function is called in |
|
241 * order to render the progress indicator. |
|
242 * @since 3.0 |
|
243 * @param aTimeElapsed - Contains the time elapsed in seconds. |
|
244 * @param aTotalTime - Contains the total time in seconds |
|
245 */ |
|
246 void DrawProgressBarL( TUint aTimeElapsed, TUint aTotalTime ); |
|
247 |
|
248 /** |
|
249 * Sets the mute icon & text to the navi pane . |
|
250 * @since 3.2 |
|
251 * @param aIsVolumeMuted whether to show the the mute icon. |
|
252 * @param aText The text show the progress info. |
|
253 */ |
|
254 void SetNaviPaneInfoL(TBool aIsVolumeMuted, const TDesC& aText); |
|
255 |
|
256 private: |
|
257 |
|
258 static TInt ButtonContainerTimerCallBack(TAny* aAny); |
|
259 virtual TBool HandleCustControlPointerEventL(const TPointerEvent& aPointerEvent); |
|
260 |
|
261 /** |
|
262 * From MSVGTMSKImpl. This function is called to draw the MSK label by |
|
263 * pushing the command to position button's stack. |
|
264 * @since 3.2 |
|
265 * @param aResourceID - The MSK label resourceID |
|
266 * @param aCommandID - The command associated with that label |
|
267 */ |
|
268 void DrawMSKLabelL(TInt aResourceID,TInt aCommandID); |
|
269 |
|
270 /** |
|
271 * From MSVGTMSKImpl. This function is called to remove MSK label from |
|
272 * button group's stack |
|
273 * @since 3.2 |
|
274 */ |
|
275 void RemoveMSKLabel(); |
|
276 |
|
277 /** |
|
278 * C++ default constructor. |
|
279 */ |
|
280 CSVGTUIDialog(); |
|
281 |
|
282 /** |
|
283 * Second Phase constructor. |
|
284 */ |
|
285 void ConstructL(); |
|
286 |
|
287 private: // Data |
|
288 CPeriodic* iBtnCntrTimer; |
|
289 |
|
290 TBool iIsButtonContainerVisible; |
|
291 |
|
292 TSize iBtnGrpSize; |
|
293 TPoint iBtnGrpPos; |
|
294 // Descriptor that contains the path to the SVGT file. |
|
295 RFile* iFileHandlePtr; |
|
296 |
|
297 // Is the Content file handle valid. |
|
298 TBool iIsFileHandleValid; |
|
299 |
|
300 // Integer storing resource offset to DLL resource file |
|
301 TInt iResourceOffset; |
|
302 |
|
303 // Pointer to Custom CCoeControl. |
|
304 CSVGTCustControl *iCustControl; |
|
305 |
|
306 // Pointer to application implementation of callbacks. |
|
307 MSvgtAppObserver *iAppObserver; |
|
308 |
|
309 // Boolean Indicating whether Save functionality is required. |
|
310 TBool iSaveEnable; |
|
311 |
|
312 // Boolean to store whether the content is preview or not |
|
313 TBool iPreview; |
|
314 |
|
315 // Navigation Pane - for progress indicator display |
|
316 CAknNavigationDecorator* iNaviDecorator; |
|
317 // Application Title Text |
|
318 HBufC* iAppTitleText; |
|
319 |
|
320 // Short Time format - initialised from resource |
|
321 HBufC* iTimeFormatShort; |
|
322 |
|
323 // Long Time format string - initialised from resource |
|
324 HBufC* iTimeFormatLong; |
|
325 //Button group container - for MSK label updation |
|
326 CEikButtonGroupContainer* iCbaGroup; |
|
327 |
|
328 HBufC* iProgressText; |
|
329 |
|
330 TBool iIsVolumeMuted; |
|
331 |
|
332 TInt iLastCommandID; |
|
333 TBool iQuietExitWhenOrientationChange; |
|
334 }; |
|
335 |
|
336 #endif // __SVGTUIDIALOG_H__ |
|
337 // End of File |