|
1 /* |
|
2 * Copyright (c) 2007-2008 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: Handler for Active Palette in Camera application |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CAMACTIVEPALETTEHANDLER_H |
|
20 #define CAMACTIVEPALETTEHANDLER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <eikenv.h> |
|
25 |
|
26 #include <activepalette2observer.h> |
|
27 |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CCamAppController; |
|
31 class CCamViewBase; |
|
32 class TActivePalette2EventData; |
|
33 class MActivePalette2UI; |
|
34 |
|
35 // CLASS DECLARATION |
|
36 |
|
37 class TCamActivePaletteItem |
|
38 { |
|
39 public: |
|
40 TInt iItemId; |
|
41 TInt iCmdId; |
|
42 TInt iPosition; |
|
43 TInt iIsVisible; |
|
44 TInt iType; |
|
45 }; |
|
46 |
|
47 class TCamAPPreCaptureItem |
|
48 { |
|
49 public: |
|
50 TInt iSettingValue; |
|
51 TInt iBitMapId; |
|
52 }; |
|
53 |
|
54 // struct holding setting item and value |
|
55 class TCamAPSettingsItem |
|
56 { |
|
57 public: |
|
58 TInt iSettingItem; |
|
59 TInt iSettingVal; |
|
60 }; |
|
61 |
|
62 /** |
|
63 * Handler for Active Palette in Camera application |
|
64 * |
|
65 * @since 3.0 |
|
66 */ |
|
67 class CCamActivePaletteHandler : public CBase, public MActivePalette2Observer |
|
68 { |
|
69 public: // Constructors and destructor |
|
70 |
|
71 /** |
|
72 * Two-phased constructor. |
|
73 */ |
|
74 static CCamActivePaletteHandler* NewL( CCamAppController& aController, TBool aCreatePalette ); |
|
75 |
|
76 /** |
|
77 * Destructor. |
|
78 */ |
|
79 virtual ~CCamActivePaletteHandler(); |
|
80 |
|
81 public: // New functions |
|
82 |
|
83 /** |
|
84 * Return handle to Active Palette |
|
85 * @since 3.0 |
|
86 * @return Reference to Active Palette |
|
87 */ |
|
88 MActivePalette2UI* ActivePalette() const; |
|
89 |
|
90 /** |
|
91 * Install Active Palette items from resource |
|
92 * @since 3.0 |
|
93 * @param aResId resource id for Active Palette items |
|
94 */ |
|
95 void InstallAPItemsL( TInt aResId ); |
|
96 |
|
97 /** |
|
98 * Inform active palette handler that returned from pretend exit |
|
99 * so that it can deal with it. |
|
100 * @since 3.0 |
|
101 */ |
|
102 void ReturnedFromPretendExitL(); |
|
103 |
|
104 /** |
|
105 * Resets highlight to the first AP item |
|
106 * @since 3.1 |
|
107 */ |
|
108 void ResetToFirstItem(); |
|
109 |
|
110 /** |
|
111 * Resets highlight to the default AP item |
|
112 * @since 3.1 |
|
113 */ |
|
114 void ResetToDefaultItem(); |
|
115 |
|
116 |
|
117 /** |
|
118 * Force Active Palette update |
|
119 * @since 3.0 |
|
120 */ |
|
121 void UpdateActivePaletteL(); |
|
122 |
|
123 /** |
|
124 * Set current view for Active Palette |
|
125 * @since 3.0 |
|
126 * @param aView - pointer to current view |
|
127 */ |
|
128 void SetView( CCamViewBase* aView ); |
|
129 |
|
130 /** |
|
131 * Set visibility of Active Palette |
|
132 * @since 3.0 |
|
133 * @param aVisibility - ETrue to set visible, EFalse to set invisible |
|
134 */ |
|
135 void SetVisibility( TBool aVisibility ); |
|
136 |
|
137 /** |
|
138 * Visibility of Active Palette |
|
139 * @since 3.0 |
|
140 * @return ETrue if AP is visible |
|
141 */ |
|
142 TBool IsVisible() const; |
|
143 |
|
144 /** |
|
145 * Whether current item was accessed via Active Palette |
|
146 * @since 3.0 |
|
147 * @return ETrue if AP launched current item |
|
148 */ |
|
149 TBool AccessedViaAP() const; |
|
150 |
|
151 /** |
|
152 * Inform AP handler AP launched item has completed |
|
153 * @since 3.0 |
|
154 */ |
|
155 void APOperationComplete(); |
|
156 |
|
157 /** |
|
158 * Pass keys events to Active Palette |
|
159 * @since 3.0 |
|
160 * @param aKeyEvent - key event |
|
161 * @param aType - key type |
|
162 */ |
|
163 void HandleAPKeyEventL( const TKeyEvent& aKeyEvent, |
|
164 TEventCode aType); |
|
165 |
|
166 /** |
|
167 * Create the Active Palette |
|
168 * @since 3.0 |
|
169 */ |
|
170 void CreateActivePaletteL(const CCoeControl &aContainerWindow, |
|
171 MObjectProvider *aMopParent); |
|
172 |
|
173 /** |
|
174 * Destroys the Active Palette |
|
175 * @since 3.0 |
|
176 */ |
|
177 void DestroyActivePalette(); |
|
178 |
|
179 /** |
|
180 * Load post-capture view resources |
|
181 * @since 3.0 |
|
182 * @param aItem id of resource to load |
|
183 */ |
|
184 void LoadPostCaptureResourcesL( TInt aItem ); |
|
185 |
|
186 /** |
|
187 * Get the resource id for the current setting |
|
188 * @since 3.0 |
|
189 * @param aSettingItem Setting we need resource for |
|
190 * @return Id of array resource containing icons for this setting |
|
191 */ |
|
192 TInt PreCaptureArrayId( TInt aSettingItem ); |
|
193 |
|
194 /** |
|
195 * Get bitmap for specfic value of settings item and sets its tooltip |
|
196 * @since 3.0 |
|
197 * @param aItem the setting value to map to a bitmap id |
|
198 * @return bitmap id for specified settings val |
|
199 */ |
|
200 TInt GetBitmapIdFromValueL( TCamAPSettingsItem& aItem ); |
|
201 |
|
202 /** |
|
203 * Get resource for for specific post-capture item |
|
204 * @since 3.0 |
|
205 * @param aCommandId the command ID value to map to an item ID |
|
206 * @return resource ID for post capture item |
|
207 */ |
|
208 TInt PostCaptureItemId( TInt aCommandId ); |
|
209 |
|
210 /** |
|
211 * Sets an icons visability |
|
212 * @since 3.0 |
|
213 * @param aCommandId the command ID for the icon |
|
214 * @param aIsVisible the visability of the icon |
|
215 */ |
|
216 TInt SetItemVisible( const TInt aCommandId, const TBool aIsVisible ); |
|
217 |
|
218 /** |
|
219 * Disables/enables active palette updates. |
|
220 * This can be used to avoid redrawing and re-initalizing active object |
|
221 * contents multiple times, when several settings are updated to the engine |
|
222 * at once. |
|
223 * @since 3.0 |
|
224 * @param aUpdatesDisabled |
|
225 */ |
|
226 void DisableUpdates( TBool aUpdatesDisabled ); |
|
227 |
|
228 /** |
|
229 * Update tooltip text for one-click upload item. This method needs to be |
|
230 * called before InstallAPItemsL is called. |
|
231 * |
|
232 * @since S60 v5.1 |
|
233 * @param aToolTip Tooltip text for one-click upload item |
|
234 */ |
|
235 void SetOneClickUploadTooltipL( const TDesC& aToolTip ); |
|
236 |
|
237 public: // Functions from base classes |
|
238 |
|
239 /** |
|
240 * Notification of AP item focus change |
|
241 * @since 3.0 |
|
242 * @param aPrevItem index of item we are moving from |
|
243 * @param aFocusedItem index of item we are moving to |
|
244 */ |
|
245 void NotifyItemFocused(TInt aPrevItem, TInt aFocusedItem); |
|
246 |
|
247 /** |
|
248 * Notification of AP item selection |
|
249 * @since 3.0 |
|
250 * @param aEvent Event data from active palette |
|
251 */ |
|
252 void NotifyItemSelected(const TActivePalette2EventData& aEvent); |
|
253 |
|
254 /** |
|
255 * Notification of active palette item completion |
|
256 * @since 3.0 |
|
257 * @param aEvent Event data from active palette |
|
258 * @param aDataDes - descriptor containing packaged data |
|
259 * @param aDataInt - data from AP event |
|
260 */ |
|
261 void NotifyItemComplete(const TActivePalette2EventData& aEvent, |
|
262 const TDesC8& aDataDes, TInt aDataInt); |
|
263 |
|
264 /** |
|
265 * Notification message received from Active Palette |
|
266 * @since 3.0 |
|
267 * @param aMessageID - id of message received from Active Palette |
|
268 * @param aEvent Event data from active palette |
|
269 * @param aDataDes - descriptor containing packaged data |
|
270 * @param aDataInt - data from AP event |
|
271 */ |
|
272 void NotifyMessage(const TActivePalette2EventData& aEvent, |
|
273 TInt aMessageID, const TDesC8& aDataDes, TInt aDataInt); |
|
274 |
|
275 /** |
|
276 * Requests that the camera application redraws the supplied area |
|
277 * @since 3.0 |
|
278 * @param aArea the area to redraw |
|
279 */ |
|
280 void Redraw(const TRect& aArea); |
|
281 |
|
282 /** |
|
283 * Informs us that the Active Palette has been updated |
|
284 * @since 3.0 |
|
285 */ |
|
286 void ActivePaletteUpdated(void); |
|
287 |
|
288 |
|
289 private: |
|
290 |
|
291 /** |
|
292 * C++ default constructor. |
|
293 */ |
|
294 CCamActivePaletteHandler( CCamAppController& aController ); |
|
295 |
|
296 /** |
|
297 * By default Symbian 2nd phase constructor is private. |
|
298 */ |
|
299 void ConstructL( TBool aCreatePalette ); |
|
300 |
|
301 /** |
|
302 * Determine Non-Setting State of a Pre-Capture Non-Setting item |
|
303 * @since 3.0 |
|
304 * @param aItem - The activepalette item to initialise |
|
305 * @return the current "setting value" of the item |
|
306 */ |
|
307 TInt DetermineNonSettingState(const TCamActivePaletteItem& aItem) const; |
|
308 |
|
309 /** |
|
310 * Set the tooltip of a pre-capture non-setting item |
|
311 * @since 3.0 |
|
312 * @param aItem - The activepalette item to initialise |
|
313 */ |
|
314 void SetNonSettingItemTooltipL(const TCamActivePaletteItem& aItem); |
|
315 |
|
316 /** |
|
317 * Clears items from the Active Palette Control |
|
318 * @since 3.0 |
|
319 */ |
|
320 void ClearActivePalette(); |
|
321 |
|
322 |
|
323 void InstallOneAPItemL( const TCamActivePaletteItem& aItem, |
|
324 const TUid& aPluginUid, |
|
325 const TDesC& aToolTipText, |
|
326 const TDesC& aIconFileName, |
|
327 TInt aIconId, |
|
328 TInt aMaskId ); |
|
329 |
|
330 void CheckFlashItemVisibilityL(); |
|
331 |
|
332 /** |
|
333 * Read toolbar items resource content to aItems |
|
334 * @param aResId Toolbar item resource id |
|
335 * @param aItems Item array |
|
336 */ |
|
337 void ReadToolbarItemsFromResourceL( TInt aResId, |
|
338 RArray<TCamActivePaletteItem>& aItems ); |
|
339 |
|
340 |
|
341 /** |
|
342 * Calculate the active palette dimension according to resolution |
|
343 * param aLength the length to be converted |
|
344 */ |
|
345 TPoint APScreenLocation( TPoint aQvgaPoint ); |
|
346 |
|
347 /* |
|
348 * To check if a specific feature is supported, to append or show in AP |
|
349 */ |
|
350 TBool IsAPItemFeatureSupportedL( const TInt aItemId ) const; |
|
351 |
|
352 private: |
|
353 CEikonEnv* iEnv; |
|
354 |
|
355 MActivePalette2UI* iActivePalette; |
|
356 |
|
357 CCamAppController& iController; |
|
358 |
|
359 CCamViewBase* iView; |
|
360 |
|
361 // array of items for active palette |
|
362 RArray<TCamActivePaletteItem> iItemArray; |
|
363 |
|
364 // AP visibility flag |
|
365 TBool iVisible; |
|
366 |
|
367 public: |
|
368 // flag indicating whether AP has launched an item |
|
369 TBool iItemAccessedViaAP; |
|
370 |
|
371 private: |
|
372 // array of pre-capture items |
|
373 RArray<TCamAPPreCaptureItem> iPreCaptureItems; |
|
374 |
|
375 // The current tooltip text |
|
376 HBufC* iToolTipText; |
|
377 |
|
378 // Icon file name. |
|
379 HBufC* iIconFileName; |
|
380 |
|
381 // Current icon id. |
|
382 TInt iIconId; |
|
383 |
|
384 // store resoure id for EV cmp |
|
385 TInt iEvCompRes; |
|
386 |
|
387 TBool iUpdatesDisabled; |
|
388 |
|
389 TBool iStarted; |
|
390 |
|
391 // Set to true, if items for the toolbar were initialised dynamically |
|
392 TBool iDynamicToolbar; |
|
393 |
|
394 // Tooltip text for one-click upload item. |
|
395 // Own. |
|
396 HBufC* iOneClickUploadTooltip; |
|
397 |
|
398 RArray<TCamAPSettingsItem> iCurrentValSettingsItem; |
|
399 }; |
|
400 |
|
401 #endif // CAMACTIVEPALETTEHANDLER_H |
|
402 |
|
403 // End of File |