1 /* |
|
2 * Copyright (c) 2007 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: Container for still pre capture view* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 #ifndef CAMSTILLPRECAPTURECONTAINER_H |
|
20 #define CAMSTILLPRECAPTURECONTAINER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include "CamPreCaptureContainerBase.h" |
|
24 |
|
25 #include "camflashstatus.h" // MFlashStatusObserver |
|
26 |
|
27 class CFbsBitmap; |
|
28 |
|
29 |
|
30 |
|
31 // CLASS DECLARATION |
|
32 |
|
33 /** |
|
34 * Container for still image pre capture view |
|
35 */ |
|
36 class CCamStillPreCaptureContainer : public CCamPreCaptureContainerBase |
|
37 ,public MFlashStatusObserver |
|
38 { |
|
39 public: // Constructors and destructor |
|
40 |
|
41 /** |
|
42 * Symbian OS two-phased constructor |
|
43 * @since 2.8 |
|
44 * @param aController reference to CCamAppControllerBase instance |
|
45 * @param aView reference to the view containing this container |
|
46 * @param aSetupPaneHandler handle to horizontal setup pane (product specific) |
|
47 * @param aRect Frame rectangle for container. |
|
48 * @return Pointer to newly constructed CCamStillPreCaptureContainer object |
|
49 */ |
|
50 static CCamStillPreCaptureContainer* NewL( CCamAppController& aController, |
|
51 CAknView& aView, |
|
52 const TRect& aRect ); |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 virtual ~CCamStillPreCaptureContainer(); |
|
58 |
|
59 /** |
|
60 * From MCamControllerObserver |
|
61 * @since 2.8 |
|
62 * @param aEvent The specific event which occurred |
|
63 * @param aError The error code associated with the event |
|
64 */ |
|
65 void HandleControllerEventL( TCamControllerEvent aEvent, TInt aError ); |
|
66 |
|
67 public: // Functions from base classes |
|
68 |
|
69 /** |
|
70 * From CCoeControl |
|
71 * @since 2.8 |
|
72 * @param aKeyEvent the key event |
|
73 * @param aType the type of the event |
|
74 * @return TKeyResponse key event was used by this control or not |
|
75 */ |
|
76 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
77 TEventCode aType ); |
|
78 |
|
79 |
|
80 /** |
|
81 * From CCoeControl |
|
82 * @since 3.0 |
|
83 */ |
|
84 void SizeChanged(); |
|
85 |
|
86 |
|
87 /** |
|
88 * From CCamContainerBase |
|
89 * Handle events sending app to foreground or background |
|
90 * @since 2.8 |
|
91 * @param aForeground whether the event brings the app to fore or background |
|
92 */ |
|
93 void HandleForegroundEventL( TBool aForeground ); |
|
94 |
|
95 |
|
96 /** |
|
97 * Gets notification of the container being enabled / disabled |
|
98 * @param aVisible, true->enabled and visible and vice versa |
|
99 */ |
|
100 void MakeVisible( TBool aVisible ); |
|
101 |
|
102 |
|
103 public: // From MFlashStatusObserver |
|
104 /* |
|
105 * Flash icon visibility has changed. |
|
106 * @param aVisible new visibility status |
|
107 */ |
|
108 virtual void FlashIconVisible( TBool aVisible ); |
|
109 |
|
110 /** |
|
111 * Called every time when camera driver reports error in |
|
112 * flash recharging. |
|
113 */ |
|
114 virtual void FlashError(); |
|
115 |
|
116 // support for creating long running AO to create AP |
|
117 static TInt BackgroundAPL( TAny *aparam ); |
|
118 TBool SetupActivePaletteCallbackL(); |
|
119 |
|
120 private: |
|
121 |
|
122 /** |
|
123 * Symbian OS 2nd phase constructor. |
|
124 * @since 2.8 |
|
125 * @param aRect Frame rectangle for container. |
|
126 */ |
|
127 void ConstructL( const TRect& aRect ); |
|
128 |
|
129 /** |
|
130 * Symbian OS 2nd phase constructor. |
|
131 * @param aRect Frame rectangle for container. |
|
132 */ |
|
133 void BaseConstructL( const TRect& aRect ); |
|
134 |
|
135 /** |
|
136 * C++ constructor |
|
137 * @since 2.8 |
|
138 * @param aController reference to CCamAppControllerBase instance |
|
139 * @param aSetupPaneHandler handle to horizontal setup pane (product specific) |
|
140 * @param aView reference to the view containing this container |
|
141 */ |
|
142 CCamStillPreCaptureContainer( CCamAppController& aController, |
|
143 CAknView& aView ); |
|
144 |
|
145 private: // Methods from base classes |
|
146 |
|
147 /** |
|
148 * From CCamPreCaptureContainerBase |
|
149 * Return the id of the layout resource for the viewfinder frame |
|
150 * @since 2.8 |
|
151 * @param aViewFinderLayoutId on return this contains the resource id |
|
152 * of the viewfinder layout |
|
153 * @param aReticuleLayoutId on return this contains the resource id |
|
154 * of the reticule layout if used, otherwise 0 |
|
155 */ |
|
156 void ViewFinderLayoutResourceIds( TInt& aViewFinderLayoutId, |
|
157 TInt& aReticuleLayoutId ) const; |
|
158 |
|
159 /** |
|
160 * From CCamPreCaptureContainerBase |
|
161 * Sets the resolution indicator to the required icon |
|
162 * @since 2.8 |
|
163 */ |
|
164 void SetResolutionIndicator(); |
|
165 |
|
166 /** |
|
167 * Sets the location indicator icon if the setting is enabled |
|
168 */ |
|
169 void SetLocationIndicatorVisibility(); |
|
170 |
|
171 /** |
|
172 * From CCamPreCaptureContainerBase |
|
173 * Move up through the flash settings |
|
174 * @since 3.0 |
|
175 */ |
|
176 void IncreaseFlashSettingL(); |
|
177 |
|
178 /** |
|
179 * From CCamPreCaptureContainerBase |
|
180 * Move down through the flash settings |
|
181 * @since 3.0 |
|
182 */ |
|
183 void DecreaseFlashSettingL(); |
|
184 |
|
185 /** |
|
186 * From CCamPreCaptureContainerBase |
|
187 * Process a key event that should change the current capture state |
|
188 * E.g. start/pause recording, start/stop capture |
|
189 * @since 3.0 |
|
190 * @param aKeyEvent the key press that initiates the capture |
|
191 * @return whether or not the key was consumed |
|
192 */ |
|
193 TKeyResponse HandleCaptureKeyEventL( const TKeyEvent& aKeyEvent ); |
|
194 |
|
195 /** |
|
196 * Process a key event that could change the current capture state |
|
197 * E.g. start autofocus, revert from post-capture to pre-capture views |
|
198 * @since 3.0 |
|
199 * @param aKeyEvent the key press that initiates the capture |
|
200 * @param aType the key type for the event |
|
201 * @return whether or not the key was consumed |
|
202 */ |
|
203 TKeyResponse HandleShutterKeyEventL( const TKeyEvent& aKeyEvent, |
|
204 TEventCode aType ); |
|
205 |
|
206 /** |
|
207 * Allows additional mode-specific icons to be drawn |
|
208 * @param aGc The context to draw with |
|
209 */ |
|
210 virtual void DrawAdditionalIcons(CBitmapContext& aGc) const; |
|
211 |
|
212 /** |
|
213 * Returns the ID of the array containing the resolution indicator icons |
|
214 * @return The array ID |
|
215 * @since 3.0 |
|
216 */ |
|
217 virtual TCamPsiKey ResolutionIndicatorIconPsiKey() const; |
|
218 |
|
219 /** |
|
220 * Gets the resource id of AP items. |
|
221 * Resource is selected based on embedded status and user mode. |
|
222 */ |
|
223 virtual TInt GetAPResourceId() const; |
|
224 |
|
225 /** |
|
226 * Init the viewfinder grid. |
|
227 * Creates the grid drawer if not done yet. |
|
228 * Set drawing rectangle and visibility. |
|
229 */ |
|
230 virtual void InitVfGridL( const TRect& aRect ); |
|
231 |
|
232 private: // New functions |
|
233 /** |
|
234 * Loads the flash icon file and subscribes to blink events |
|
235 */ |
|
236 void InitFlashIconL(); |
|
237 |
|
238 /** |
|
239 * Loads flash icon layout from resources, and sets icon size |
|
240 */ |
|
241 void LayoutFlashIcon(); |
|
242 |
|
243 /** |
|
244 * Draws the flash icon to select |
|
245 * @param aGc |
|
246 */ |
|
247 void DrawFlashIcon( CBitmapContext& aGc ) const; |
|
248 |
|
249 /** |
|
250 * Utility function to subscribe / unsubscribe from flash related events |
|
251 * @param aSubscribe, true->subscribe, else unsubscribe |
|
252 */ |
|
253 void SubscribeFlashEvents( TBool aSubscribe ); |
|
254 |
|
255 |
|
256 private: // Data |
|
257 TBool iFlashIconVisible; |
|
258 TRect iFlashIconRect; |
|
259 // Xenon flash bitmap |
|
260 CFbsBitmap* iFlashBitmap; |
|
261 CFbsBitmap* iFlashBitmapMask; |
|
262 |
|
263 TBool iXenonFlashSupported; |
|
264 |
|
265 CIdle* iAPCreateAO; |
|
266 |
|
267 }; |
|
268 |
|
269 #endif // CAMSTILLPRECAPTURECONTAINER_H |
|
270 |
|
271 // End of File |
|