author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 15 Sep 2010 11:51:19 +0300 | |
branch | RCL_3 |
changeset 62 | f0c0788c4de2 |
parent 57 | 2c87b2808fd7 |
child 67 | 756ad29ed18e |
permissions | -rw-r--r-- |
54 | 1 |
/* |
57
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
2 |
* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
54 | 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: Base class for all camera application containers |
|
15 |
*/ |
|
16 |
||
17 |
||
18 |
||
19 |
#ifndef CAMCONTAINERBASE_H |
|
20 |
#define CAMCONTAINERBASE_H |
|
21 |
||
22 |
||
23 |
||
24 |
// INCLUDES |
|
25 |
#include <coecntrl.h> |
|
26 |
#include <AknUtils.h> |
|
27 |
#include "CamAppUiBase.h" // For TCamAppViewIds |
|
28 |
||
29 |
// FORWARD DECLARATIONS |
|
30 |
class CCamAppController; |
|
31 |
class CAknView; |
|
32 |
class MAknsControlContext; |
|
33 |
||
34 |
class CEnhancedSoftKeys; |
|
35 |
||
36 |
class CCamNaviCounterControl; |
|
37 |
class CCamNaviProgressBarControl; |
|
38 |
class MActivePalette2UI; |
|
39 |
class CCamBackupContainer; |
|
40 |
||
41 |
const TInt KCamPreCaptureWindowOrdinalPos = 100; |
|
42 |
const TInt KCamPostCaptureWindowOrdinalPos = 101; |
|
43 |
||
44 |
||
45 |
// CLASS DECLARATION |
|
46 |
||
47 |
/** |
|
48 |
* Container base class |
|
49 |
*/ |
|
50 |
class CCamContainerBase : public CCoeControl |
|
51 |
{ |
|
52 |
// ======================================================= |
|
53 |
// Typenames |
|
54 |
public: |
|
55 |
||
56 |
// Was defined in multiple child classes, now moved here. |
|
57 |
enum TVfState // ViewFinder states |
|
58 |
{ |
|
59 |
EVfStateActive, |
|
60 |
EVfStateFrozenDimmed, |
|
61 |
EVfStateActiveMasked |
|
62 |
}; |
|
63 |
||
64 |
||
65 |
// Enumeration used to indicate the pane currently visible |
|
66 |
enum TCamActiveNaviPane |
|
67 |
{ |
|
68 |
ECamPaneUndefined, |
|
69 |
ECamPaneCounter, |
|
70 |
ECamPaneProgress |
|
71 |
}; |
|
72 |
||
73 |
// ======================================================= |
|
74 |
// Methods |
|
75 |
||
76 |
// Constructors and destructor |
|
77 |
public: |
|
78 |
||
79 |
/** |
|
80 |
* Destructor. |
|
81 |
* @since 2.8 |
|
82 |
*/ |
|
83 |
virtual ~CCamContainerBase(); |
|
84 |
||
85 |
// ------------------------------------------------------- |
|
86 |
// From CCoeControl |
|
87 |
public: |
|
88 |
||
89 |
/** |
|
90 |
* Return this controls window. |
|
91 |
* This is needed for direct viewfinding. |
|
92 |
* Protected in CCoeControl. (not virtual) |
|
93 |
*/ |
|
94 |
RWindow& Window() const; |
|
95 |
||
96 |
/** |
|
97 |
* Handle events sending app to foreground or background |
|
98 |
* @since 2.8 |
|
99 |
* @param aForeground whether the event brings the app to fore or background |
|
100 |
*/ |
|
101 |
virtual void HandleForegroundEventL( TBool aForeground ); |
|
102 |
||
103 |
/** |
|
104 |
* Gets an object whose type is encapsulated by the specified TTypeUid object. |
|
105 |
* @since 2.8 |
|
106 |
* @param aId Encapsulates the Uid that identifies the type of object required. |
|
107 |
* @return Encapsulates the pointer to the object provided. |
|
108 |
*/ |
|
109 |
TTypeUid::Ptr MopSupplyObject( TTypeUid aId ); |
|
110 |
||
111 |
/** |
|
112 |
* This method should change its client rect area and redraw properly. |
|
113 |
* @since 2.8 |
|
114 |
* @param aType resource change |
|
115 |
*/ |
|
116 |
virtual void HandleResourceChange( TInt aType ); |
|
117 |
||
118 |
/** |
|
119 |
* Handle application level event. |
|
120 |
* For example focus gained and lost are notified through this method. |
|
121 |
* Default implementation is empty, to be replaced in inherited classes. |
|
122 |
* @param aEvent Event type |
|
123 |
*/ |
|
124 |
virtual void HandleAppEvent( const TCamAppEvent& aEvent ); |
|
125 |
||
126 |
||
127 |
||
128 |
/** |
|
129 |
* @since 2.8 |
|
130 |
* @param aKeyEvent the key event |
|
131 |
* @param aType the type of the event |
|
132 |
* @return TKeyResponse key event was used by this control or not |
|
133 |
*/ |
|
134 |
TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
135 |
TEventCode aType ); |
|
136 |
||
137 |
// ------------------------------------------------------- |
|
138 |
// New functions |
|
139 |
public: |
|
140 |
||
141 |
/** |
|
142 |
* Passes the value of the previous view to the container |
|
143 |
* @since 2.8 |
|
144 |
* @param aId The ID of the previous view |
|
145 |
*/ |
|
146 |
void SetPreviousViewId( TCamAppViewIds aId ); |
|
147 |
||
148 |
/** |
|
149 |
* Sets up a navipane for use by this container |
|
150 |
* @param aNaviPane specifies which navipane to set up. |
|
151 |
* @since 3.0 |
|
152 |
*/ |
|
153 |
void SetupNaviPanesL( TCamActiveNaviPane aNaviPane ); |
|
154 |
||
155 |
/** |
|
156 |
* Will show the zoom pane for a set time |
|
157 |
* Only implemented by pre capture containers |
|
158 |
* @since 2.8 |
|
159 |
*/ |
|
160 |
virtual void ShowZoomPaneWithTimer(); |
|
161 |
||
162 |
/** |
|
163 |
* Create the ActivePalette control |
|
164 |
* @since 3.0 |
|
165 |
*/ |
|
166 |
void CreateActivePaletteL(); |
|
167 |
||
168 |
/** |
|
169 |
* Destroys the ActivePalette control |
|
170 |
* @since 3.0 |
|
171 |
*/ |
|
172 |
static void DestroyActivePalette(); |
|
173 |
||
174 |
/** |
|
175 |
* Requests that the camera application redraws the supplied area |
|
176 |
* @since 3.0 |
|
177 |
* @param aArea the area to redraw |
|
178 |
*/ |
|
179 |
virtual void Redraw(const TRect& aArea); |
|
180 |
||
181 |
||
182 |
/** |
|
183 |
* Load layouts for the text |
|
184 |
*/ |
|
185 |
void PrepareProcessingBackgroundL(); |
|
186 |
||
187 |
/** |
|
188 |
* Load processing image/video text from resources. |
|
189 |
*/ |
|
190 |
void PrepareProcessingTextL( TBool aStillMode ); |
|
191 |
||
192 |
/** |
|
193 |
* Delete and null processing text, after which |
|
194 |
* the text will no longer be drawn. |
|
195 |
*/ |
|
196 |
void DismissProcessingText(); |
|
197 |
||
198 |
/** |
|
199 |
* Load processing image text for burst from resources. |
|
200 |
*/ |
|
201 |
void PrepareBurstProcessingTextL(); |
|
202 |
||
203 |
/** |
|
204 |
* Update processing image text for burst. |
|
205 |
* @param aHandled number of imagedata received |
|
206 |
* @param aTotal number of snapshots received |
|
207 |
*/ |
|
208 |
void UpdateBurstProcessingTextL( TInt aHandled, TInt aTotal ); |
|
209 |
||
210 |
/** |
|
211 |
* Delete and null processing text, after which |
|
212 |
* the text will no longer be drawn. |
|
213 |
*/ |
|
214 |
void DismissBurstProcessingText(); |
|
215 |
||
216 |
/** |
|
217 |
* Viewfinder layout rect |
|
218 |
* @param aTargetMode target mode for which viewfinder rect is required. Default(ECamControllerIdle) corresponds to current active mode. |
|
219 |
* @return TRect viewfinder rect from layout |
|
220 |
*/ |
|
221 |
TRect ViewFinderFrameRect(TCamCameraMode aTargetMode = ECamControllerIdle) const; |
|
222 |
||
223 |
/** |
|
224 |
* We check for the file name whenever we call the UMP |
|
225 |
* or Properties view and come back. |
|
226 |
*/ |
|
227 |
virtual void CheckForFileName( TBool aDoCheck ); |
|
228 |
||
229 |
protected: |
|
230 |
||
231 |
/** |
|
232 |
* Whether or not this key is considered to be capture key |
|
233 |
* in the current context |
|
234 |
* @since 3.0 |
|
235 |
* @param aKeyEvent the key event |
|
236 |
* @param aType the type of event |
|
237 |
* @return ETrue if this is a capture key, otherwise EFalse |
|
238 |
*/ |
|
239 |
TBool IsCaptureKeyL( const TKeyEvent& aKeyEvent, |
|
240 |
TEventCode aType ) ; |
|
241 |
||
242 |
/** |
|
243 |
* Whether or not this key is considered to be shutter key |
|
244 |
* in the current context |
|
245 |
* @since 3.0 |
|
246 |
* @param aKeyEvent the key event |
|
247 |
* @param aType the type of event |
|
248 |
* @return ETrue if this is a shutter key, otherwise EFalse |
|
249 |
*/ |
|
250 |
TBool IsShutterKeyL( const TKeyEvent& aKeyEvent, |
|
251 |
TEventCode aType ) ; |
|
252 |
||
253 |
/** |
|
254 |
* Whether or not this key is considered to be zoom key |
|
255 |
* in the current context |
|
256 |
* @since 3.0 |
|
257 |
* @param aKeyEvent the key event |
|
258 |
* @param aType the type of event |
|
259 |
* @return ETrue if this is a zoom key, otherwise EFalse |
|
260 |
*/ |
|
261 |
TBool IsZoomKeyL( const TKeyEvent& aKeyEvent, |
|
262 |
TEventCode aType ) ; |
|
263 |
/** |
|
264 |
* Is zoom operation currently possible? |
|
265 |
* @since 3.0 |
|
266 |
*/ |
|
267 |
TBool ZoomAvailable(); |
|
268 |
||
269 |
/** |
|
270 |
* Is Primary Capture Key |
|
271 |
* @since 9.1 |
|
272 |
*/ |
|
273 |
TBool IsPrimaryCameraCaptureKey( const TKeyEvent& aKeyEvent ) const ; |
|
274 |
||
275 |
/** |
|
276 |
* Is Secondary Capture Key |
|
277 |
* @since 9.1 ( checking for scan codes ) |
|
278 |
*/ |
|
279 |
TBool IsSecondaryCameraCaptureKey( const TKeyEvent& aKeyEvent ) const ; |
|
280 |
/** |
|
281 |
* Enters viewfinder mode either in image or videomode |
|
282 |
* depending current visible view. Also starts idle timer. |
|
283 |
*/ |
|
284 |
void ReserveAndStartVF(); |
|
285 |
||
286 |
// ------------------------------------------------------- |
|
287 |
// Constructors |
|
288 |
protected: |
|
289 |
||
290 |
/** |
|
291 |
* C++ constructor |
|
292 |
* @since 2.8 |
|
293 |
* @param aController reference to CCamAppController instance |
|
294 |
* @param aView reference to the view containing this container |
|
295 |
*/ |
|
296 |
CCamContainerBase( CCamAppController& aController, |
|
297 |
CAknView& aView ); |
|
298 |
/** |
|
299 |
* Symbian OS 2nd phase constructor. |
|
300 |
* @since 2.8 |
|
301 |
* @param aRect Frame rectangle for container. |
|
302 |
*/ |
|
303 |
void BaseConstructL( const TRect& aRect ); |
|
304 |
||
305 |
protected: |
|
306 |
/** |
|
307 |
* Create background context (iBgContext). May be overridden by |
|
308 |
* derived classes. |
|
309 |
* @since S60 v5.0 |
|
310 |
*/ |
|
311 |
virtual void CreateBackgroundContextL(); |
|
312 |
||
313 |
public: |
|
314 |
||
315 |
/** |
|
316 |
* Returns the number of component controls |
|
317 |
* @since 3.0 |
|
318 |
* @return The number of owned controls to display |
|
319 |
*/ |
|
320 |
TInt CountComponentControls() const; |
|
321 |
||
322 |
/** |
|
323 |
* Returns the specified component control |
|
324 |
* @since 3.0 |
|
325 |
* @param aIndex The index of the control to return |
|
326 |
* @return Pointer to the specified control |
|
327 |
*/ |
|
328 |
CCoeControl* ComponentControl( TInt aIndex ) const; |
|
329 |
||
330 |
// ======================================================= |
|
331 |
private: |
|
332 |
/* |
|
333 |
* Checks for the zoom key with the mapped key's scan code |
|
334 |
*/ |
|
335 |
TBool CheckForZoomKey( const TKeyEvent& aKeyEvent ); |
|
336 |
||
337 |
/* |
|
338 |
* Checks for the zoom-in/out key from the mapped key's scan code |
|
339 |
* from the zoom array |
|
340 |
*/ |
|
341 |
TBool CheckInZoomKeyArray( const TKeyEvent& aKeyEvent ); |
|
342 |
||
343 |
// Data |
|
344 |
protected: |
|
345 |
||
346 |
CAknView& iView; |
|
347 |
CCamAppController& iController; |
|
348 |
||
349 |
// The ID of the previous view |
|
350 |
TCamAppViewIds iPrevViewId; |
|
351 |
||
352 |
// context for skin background drawing |
|
353 |
MAknsControlContext* iBgContext; |
|
354 |
||
355 |
// The current pane displayed in the Application Pane |
|
356 |
TCamActiveNaviPane iPaneInUse; |
|
357 |
||
358 |
// Instance of Navi Counter control (not owned) |
|
359 |
CCamNaviCounterControl* iNaviCounterControl; |
|
360 |
||
361 |
// Instance of Navi Progress control (not owned) |
|
362 |
CCamNaviProgressBarControl* iNaviProgressBarControl; |
|
363 |
||
364 |
// Instance of ActivePalette2 control (not owned) |
|
365 |
static MActivePalette2UI* iActivePalette; |
|
366 |
||
367 |
// ETrue if shutter key (half-press) has been made |
|
368 |
TBool iKeyShutter; |
|
369 |
||
370 |
// zoom keys for primary and secondary camera |
|
371 |
RArray<TInt> iPrimaryZoomInKeys; |
|
372 |
RArray<TInt> iPrimaryZoomOutKeys; |
|
373 |
RArray<TInt> iSecondaryZoomInKeys; |
|
374 |
RArray<TInt> iSecondaryZoomOutKeys; |
|
375 |
||
376 |
// capture keys |
|
377 |
RArray<TInt> iPrimaryCameraCaptureKeys; |
|
378 |
RArray<TInt> iSecondaryCameraCaptureKeys; |
|
379 |
||
380 |
// AF key or half capture key press scan codes |
|
381 |
RArray<TInt> iPrimaryCameraAFKeys; |
|
382 |
||
383 |
/// Remember current orientation, so we only redraw when necessary |
|
384 |
TCamOrientation iCamOrientation; |
|
385 |
||
386 |
TAknLayoutText iProcessingTextLayout; |
|
387 |
HBufC* iProcessingText; |
|
388 |
TAknLayoutText iBurstProcessingTextLayout; |
|
389 |
HBufC* iBurstProcessingText; |
|
390 |
||
391 |
//Backup child container to keep the background of viewfinder window always opaque |
|
392 |
CCamBackupContainer* iBackupContainer; |
|
393 |
}; |
|
394 |
||
395 |
#endif // CAMCONTAINERBASE_H |
|
396 |
||
397 |
// End of File |