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: Setup pane handler/controller class. |
|
15 * |
|
16 * Copyright © 2007 Nokia. All rights reserved. |
|
17 * This material, including documentation and any related computer |
|
18 * programs, is protected by copyright controlled by Nokia. All |
|
19 * rights are reserved. Copying, including reproducing, storing, |
|
20 * adapting or translating, any or all of this material requires the |
|
21 * prior written consent of Nokia. This material also contains |
|
22 * confidential information which may not be disclosed to others |
|
23 * without the prior written consent of Nokia. |
|
24 |
|
25 * |
|
26 * |
|
27 */ |
|
28 |
|
29 |
|
30 #ifndef CAMMODESETUPPANEHANDLER_H |
|
31 #define CAMMODESETUPPANEHANDLER_H |
|
32 |
|
33 // INCLUDES |
|
34 #include <E32Base.h> |
|
35 #include <w32std.h> |
|
36 #include "CamSetupPaneModel.h" |
|
37 #include "CamLastCaptureHelper.h" |
|
38 |
|
39 // FORWARD DECLARATIONS |
|
40 class CCamAppController; |
|
41 class CCoeControl; |
|
42 class CCamSetupPaneItemArray; |
|
43 class CCamSetupPane; |
|
44 |
|
45 |
|
46 // CLASS DECLARATION |
|
47 |
|
48 /** |
|
49 * Mode setup pane controller class. |
|
50 */ |
|
51 class CCamModeSetupPaneHandler : public CBase, |
|
52 public MCamSetupPaneModel |
|
53 { |
|
54 public: |
|
55 enum TEvent |
|
56 { |
|
57 EEventLeft, |
|
58 EEventRight, |
|
59 EEventSelect, |
|
60 EEventCancel, |
|
61 EEventEditUser |
|
62 }; |
|
63 public: |
|
64 /** |
|
65 * Two-phase class constructor. |
|
66 * @since 3.0 |
|
67 * @param aController - A ref to a base app controller. |
|
68 * @return The new object. |
|
69 */ |
|
70 static CCamModeSetupPaneHandler* NewLC( CCamAppController& aController ); |
|
71 |
|
72 /** |
|
73 * Two-phase class constructor. |
|
74 * @since 3.0 |
|
75 * @param aController - A ref to a base app controller. |
|
76 * @return The new object. |
|
77 */ |
|
78 static CCamModeSetupPaneHandler* NewL( CCamAppController& aController ); |
|
79 |
|
80 /** |
|
81 * C++ class destructor. |
|
82 * @since 3.0 |
|
83 */ |
|
84 ~CCamModeSetupPaneHandler(); |
|
85 |
|
86 public: |
|
87 /** |
|
88 * Creates and returns a new pane control. |
|
89 * @since |
|
90 * @param aParent - The parent (container) control. |
|
91 * @param aRect - the rectangle this control is to occupy. |
|
92 * @return The new pane control. |
|
93 */ |
|
94 CCoeControl* CreatePaneControlL( CCoeControl* aParent, const TRect& aRect ); |
|
95 |
|
96 /** |
|
97 * Handles events forwarded from the pane control. |
|
98 * @since 3.0 |
|
99 * @param aEvent - The event to handle |
|
100 */ |
|
101 void HandleEvent( TEvent aEvent ); |
|
102 |
|
103 /** |
|
104 * Moves the current highlight item. |
|
105 * @since 3.0 |
|
106 */ |
|
107 void MoveToPreviousItem(); |
|
108 |
|
109 /** |
|
110 * Moves the current highlight item. |
|
111 * @since 3.0 |
|
112 */ |
|
113 void MoveToNextItem(); |
|
114 |
|
115 /** |
|
116 * Sets the context of the Setup Pane, based on the mode it is in |
|
117 * @since 3.0 |
|
118 * @param aFirstCamera ETrue if first camera in use, else EFalse |
|
119 * @param aPhoto ETrue if in photo mode, else EFalse if in video |
|
120 * @param aUserSceneSetup ETrue if in user scene setup mode. |
|
121 */ |
|
122 void SetMenuContextL( TBool aFirstCamera, TBool aPhoto, TBool aUserSceneSetup = EFalse ); |
|
123 |
|
124 /** |
|
125 * Activates a particular sub-menu. |
|
126 * @since 3.0 |
|
127 * @param aMenuItem The id of the submenu to activate. |
|
128 */ |
|
129 void ActivateMenuItem( TInt aMenuItem ); |
|
130 |
|
131 /** |
|
132 * Set whether SetupPane control is in foreground or not |
|
133 * @since 3.0 |
|
134 * @param aForeground ETrue if in foreground, EFalse if in background |
|
135 */ |
|
136 void SetForeground( TBool aForeground ); |
|
137 |
|
138 public: |
|
139 /** |
|
140 * From MCamSetupPaneModel |
|
141 * @since 3.0 |
|
142 * @return The number of items in the model. |
|
143 */ |
|
144 TInt NumberOfItems() const; |
|
145 |
|
146 /** |
|
147 * From MCamSetupPaneModel |
|
148 * @since 3.0 |
|
149 * @return The title text in the model. |
|
150 */ |
|
151 const TDesC& TitleText() const; |
|
152 |
|
153 /** |
|
154 * From MCamSetupPaneModel |
|
155 * @since 3.0 |
|
156 * @return The descriptor text in the model. |
|
157 */ |
|
158 const TDesC& DescriptorText() const; |
|
159 |
|
160 /** |
|
161 * From MCamSetupPaneModel |
|
162 * @since 3.0 |
|
163 * @param aItemIndex - The model item index to get an icon for. |
|
164 * @return The corresponding icon. |
|
165 */ |
|
166 CGulIcon& Icon( TInt aItemIndex ); |
|
167 |
|
168 /** |
|
169 * From MCamSetupPaneModel |
|
170 * @since 3.0 |
|
171 * @return The index of the highlighted model item. |
|
172 */ |
|
173 TInt HighlightedItemIndex() const; |
|
174 |
|
175 /** |
|
176 * From MCamSetupPaneModel |
|
177 * @since 3.0 |
|
178 * @return The id of the highlighted model item. |
|
179 */ |
|
180 TInt HighlightedItemId() const; |
|
181 |
|
182 /** |
|
183 * From MCamSetupPaneModel |
|
184 * @since 3.0 |
|
185 * @param aItemIndex Index of the SetupPane menu item |
|
186 * @return ETrue if this item is the LastCaptured thumbnail, else EFalse |
|
187 */ |
|
188 TBool IconIsThumbnail( TInt aItemIndex ) const; |
|
189 |
|
190 /** |
|
191 * From MCamSetupPaneModel |
|
192 * @since 3.0 |
|
193 * @param aSmall Whether requesting the small (ETrue) or large (EFalse) thumbnail icon |
|
194 * @return The number of items in the model. |
|
195 */ |
|
196 CGulIcon& Thumbnail( TBool aSmall ); |
|
197 |
|
198 /** |
|
199 * From MCamSetupPaneModel |
|
200 * @since 3.0 |
|
201 */ |
|
202 void Refresh(); |
|
203 |
|
204 private: |
|
205 /** |
|
206 * C++ constructor. |
|
207 * @since 3.0 |
|
208 * @param aController - A ref to a base app controller object. |
|
209 */ |
|
210 CCamModeSetupPaneHandler( CCamAppController& aController ); |
|
211 |
|
212 /** |
|
213 * Carriers out two-phase class construction. |
|
214 * @since 3.0 |
|
215 */ |
|
216 void ConstructL(); |
|
217 |
|
218 /** |
|
219 * Handles a pane highlighted item change. |
|
220 * @since 3.0 |
|
221 */ |
|
222 void HandlePaneItemChanged(); |
|
223 |
|
224 /** |
|
225 * Handles a pane highlighted item change. |
|
226 * @since 3.0 |
|
227 */ |
|
228 void HandlePaneItemLevelItemChanged(); |
|
229 |
|
230 /** |
|
231 * Handles a pane highlighted menu item selection. |
|
232 * @since 3.0 |
|
233 * @param aValueToBeHighlighted The value of the selected pane to be highlighted. |
|
234 */ |
|
235 void HandlePaneMenuLevelSelection( TInt aValueToBeHighlighted ); |
|
236 |
|
237 /** |
|
238 * Handles user selection of the "LastCapture" thumbnail where available |
|
239 * @since 3.0 |
|
240 */ |
|
241 void HandleLastCaptureSelection(); |
|
242 |
|
243 /** |
|
244 * Handles a pane highlighted item-level selection. |
|
245 * @since 3.0 |
|
246 */ |
|
247 void HandlePaneItemLevelSelection(); |
|
248 |
|
249 /** |
|
250 * Handles a pane highlighted item-level selection. |
|
251 * @since 3.0 |
|
252 */ |
|
253 void HandlePaneCancel(); |
|
254 |
|
255 /** |
|
256 * Updates the setup pane based on the specified resource |
|
257 * @since 3.0 |
|
258 * @param aResource The resource specifying the new pane contents |
|
259 */ |
|
260 void UpdateFromResourceL( TInt aResource ); |
|
261 |
|
262 /** |
|
263 * Deletes the contents of the array, and resets internal state |
|
264 * @since 3.0 |
|
265 */ |
|
266 void ResetArray(); |
|
267 |
|
268 /** |
|
269 * Switches to the User Scene Setup view. |
|
270 * @since 3.0 |
|
271 */ |
|
272 void SwitchToUserSceneView(); |
|
273 |
|
274 |
|
275 private: |
|
276 // Setup pane modes - top ('menu') level, or bottom ('item') level. |
|
277 enum TSetupPaneLevel |
|
278 { |
|
279 EMenuLevel, |
|
280 EItemLevel |
|
281 }; |
|
282 |
|
283 // Various definitions: |
|
284 enum |
|
285 { |
|
286 KSettingsArrayCount = 6, // Number of settings arrays. |
|
287 KItemArrayGranularity = 4, // Granularity of item arrays. |
|
288 KMaxTitleCharLength = 32 // Max character length of title text. |
|
289 }; |
|
290 |
|
291 private: |
|
292 // The app controller object (gives access to settings). |
|
293 CCamAppController& iController; |
|
294 |
|
295 // The current level that the pane is at (menu or item level). |
|
296 TSetupPaneLevel iPaneLevel; |
|
297 |
|
298 // The zero-based index of the currently highlighted item. |
|
299 TInt iHighlightedItemIndex; |
|
300 |
|
301 // Zero-based index of the current settings array (=the selected menu item). |
|
302 TInt iCurrentSettingsArrayIndex; |
|
303 |
|
304 // IDs of the pane menu items (+ one dynamic item). |
|
305 TInt iMenuItemIds[KSettingsArrayCount + 1]; |
|
306 |
|
307 // Title text for each menu item (+ one dynamic item) |
|
308 TBuf<KMaxTitleCharLength> iMenuTitles[KSettingsArrayCount + 1]; |
|
309 |
|
310 // 'Item-level' settings item arrays. |
|
311 CCamSetupPaneItemArray* iSettingItems[KSettingsArrayCount]; |
|
312 |
|
313 // Pointer to a pane control object (not owned). |
|
314 CCamSetupPane* iPaneControl; |
|
315 |
|
316 // Pointer to the owning object (not owned) |
|
317 CCoeControl* iParent; |
|
318 |
|
319 // Number of settings in the iSettingItems array |
|
320 TInt iNoOfSettingsItems; |
|
321 |
|
322 // Specifies whether the user scene setup is currently being edited. |
|
323 TBool iUserSceneSetupMode; |
|
324 |
|
325 // Helper class to get the last-captured thumbnails where available. |
|
326 CCamLastCaptureHelper* iLastCaptureHelper; |
|
327 |
|
328 // The current mode. ETrue if Photo mode, EFalse if video mode |
|
329 TBool iPhotoMode; |
|
330 |
|
331 // Whether the SetupPane is currently in foreground or not. |
|
332 TBool iForeground; |
|
333 |
|
334 // Title to use for the LastCapture selection |
|
335 HBufC16* iLastCapTitle; |
|
336 |
|
337 // Filename of last capture |
|
338 TFileName iLastCapName; |
|
339 }; |
|
340 |
|
341 #endif |
|