|
1 /* |
|
2 * Copyright (c) 2002-2006 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: |
|
15 * A compound control class. It is responsible for owning CVRButtonPanel |
|
16 * and CVRStateInfoPanel. It also handles the changing of softkeys, menubar |
|
17 * and volume control. |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 #ifndef __CVRRECVIEWCONTAINER_H__ |
|
23 #define __CVRRECVIEWCONTAINER_H__ |
|
24 |
|
25 // INCLUDES |
|
26 #include <bldvariant.hrh> |
|
27 #include <coecntrl.h> |
|
28 #include "MVRObserver.h" |
|
29 #include "MVRVolumeEventObserver.h" |
|
30 #include <AknUtils.h> |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class CVRButtonPanel; |
|
34 class CVRStateInfoPanel; |
|
35 class MVRButtonPanelModel; |
|
36 class MVRDecoratorModel; |
|
37 class MVRStateInfoModel; |
|
38 class MVRKeyObserver; |
|
39 class MVRVolumeChangeObserver; |
|
40 class MVRVolumeEventObserver; |
|
41 class CVRRecView; |
|
42 class CAknNavigationDecorator; |
|
43 class CAknNavigationControlContainer; |
|
44 class MAknsSkinInstance; |
|
45 class CAknsBasicBackgroundControlContext; |
|
46 class CVRRemConObserver; |
|
47 |
|
48 |
|
49 // CLASS DEFINITION |
|
50 /** |
|
51 * A compound control class. It is responsible for owning CVRButtonPanel |
|
52 * and CVRStateInfoPanel. It also handles the changing of softkeys, menubar, |
|
53 * volume control and navipane. It also observers volume changes through |
|
54 * MRemConCoreApiTargetObserver interface. |
|
55 */ |
|
56 NONSHARABLE_CLASS( CVRRecViewContainer ) |
|
57 : public CCoeControl, |
|
58 public MVRObserver, |
|
59 public MVRVolumeEventObserver, |
|
60 public MCoeControlObserver |
|
61 { |
|
62 public: // Constructors and destructor |
|
63 |
|
64 /** |
|
65 * Default constructor. |
|
66 */ |
|
67 CVRRecViewContainer(); |
|
68 |
|
69 /** |
|
70 * Destructor |
|
71 */ |
|
72 ~CVRRecViewContainer(); |
|
73 |
|
74 /** |
|
75 * 2nd phase constructor |
|
76 * @param aRect The screen rectangle for this component |
|
77 * @param aButtonModelPointer to a button panel observer (or NULL) |
|
78 * @param aDecoratorModel Pointer to a decorator observer (or NULL) |
|
79 * @param aStateInfoModel Pointer to a state info observer (or NULL) |
|
80 * @param aOwningView Pointer to the view that owns us. |
|
81 */ |
|
82 void ConstructL( const TRect& aRect, |
|
83 MVRButtonPanelModel* aButtonModel, |
|
84 MVRDecoratorModel* aDecoratorModel, |
|
85 MVRStateInfoModel* aStateInfoModel, |
|
86 CVRRecView* aOwningView ); |
|
87 |
|
88 public: // from CCoeControl |
|
89 |
|
90 /** |
|
91 * Specifies the help context for this form. |
|
92 * @param aContext the context IDs are placed here |
|
93 */ |
|
94 void GetHelpContext( TCoeHelpContext& aContext ) const; |
|
95 |
|
96 public: |
|
97 // from CCoeControl |
|
98 |
|
99 /** |
|
100 * Called by the framework to get the number of sub-components |
|
101 * contained in this component. |
|
102 * @return The number of component controls contained by this control |
|
103 */ |
|
104 TInt CountComponentControls() const; |
|
105 |
|
106 /** |
|
107 * Called by the framework to get a specified sub-component |
|
108 * of this component. |
|
109 * @param aIndex The index of the component to get. |
|
110 * @return The component control with an index of aIndex. |
|
111 */ |
|
112 CCoeControl* ComponentControl( TInt aIndex ) const; |
|
113 |
|
114 /** |
|
115 * When a key event occurs, the control framework calls this function |
|
116 * for each control on the control stack, until one of them can process |
|
117 * the key event (and returns EKeyWasConsumed). |
|
118 * @param aKeyEvent The key event. |
|
119 * @param aType The type of key event: EEventKey, EEventKeyUp |
|
120 * or EEventKeyDown |
|
121 * @return Indicates whether or not the key event was used by this |
|
122 * control |
|
123 */ |
|
124 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
125 TEventCode aType ); |
|
126 |
|
127 private: // from CCoeControl |
|
128 |
|
129 /* |
|
130 * From CCoeControl |
|
131 * @see CCoeControl |
|
132 */ |
|
133 void SizeChanged(); |
|
134 |
|
135 /** |
|
136 * Draws this control. |
|
137 * @param aRect The area that needs updating. Ignored. |
|
138 */ |
|
139 void Draw( const TRect& aRect ) const; |
|
140 |
|
141 /* |
|
142 * From CCoeControl |
|
143 * @see CCoeControl |
|
144 */ |
|
145 TTypeUid::Ptr MopSupplyObject(TTypeUid aId); |
|
146 |
|
147 /* |
|
148 * From CCoeControl |
|
149 * @see CCoeControl |
|
150 */ |
|
151 void HandlePointerEventL( const TPointerEvent& aPointerEvent ); |
|
152 |
|
153 /** |
|
154 *From MCoeControlObserver. To handle the volume events for touch UI. |
|
155 */ |
|
156 void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType ); |
|
157 |
|
158 |
|
159 |
|
160 public: // from MVRObserver |
|
161 |
|
162 /** |
|
163 * Called to notify a change in the observed subject's state. |
|
164 */ |
|
165 void Update( TVRUpdateCommand aCommand = EVRUpdate ); |
|
166 |
|
167 public: // from MVRVolumeEventObserver |
|
168 |
|
169 /** |
|
170 * Handles volume change event received from either side volume |
|
171 * keys or left-right rocker presses. |
|
172 * @param aKeyEvent The key event. Will be forwarded to CAknVolumeControl |
|
173 * @param aType The type of key event: EEventKey, EEventKeyUp |
|
174 * or EEventKeyDown. Will be forwarded to CAknVolumeControl |
|
175 */ |
|
176 |
|
177 TInt HandleVolumeChangeL( const TKeyEvent& aKeyEvent, |
|
178 TEventCode aType ); |
|
179 |
|
180 |
|
181 public: // new methods |
|
182 |
|
183 /** |
|
184 * Registers an observer for receiving |
|
185 * key event notifications from this class. |
|
186 * @param aObserver The observer object. |
|
187 */ |
|
188 void SetKeyObserver( MVRKeyObserver* aObserver ); |
|
189 |
|
190 /** |
|
191 * Registers an observer for receiving |
|
192 * audio volume change notifications from this class. |
|
193 * @param aObserver The observer object. |
|
194 */ |
|
195 void SetVolumeChangeObserver( MVRVolumeChangeObserver* aObserver ); |
|
196 |
|
197 /** |
|
198 * Updates the layout of all child controls to current active |
|
199 * layout (Euro, Apac, Arabic/Hebrew) |
|
200 */ |
|
201 void UpdateLayoutL(); |
|
202 |
|
203 /** |
|
204 * Handles a change to the application's resources |
|
205 * @param aType The type of changed resource |
|
206 */ |
|
207 void HandleResourceChangeL( TInt aType ); |
|
208 |
|
209 /** |
|
210 * Returns the currently focused button index in Button Panel |
|
211 * @return The focused button index |
|
212 */ |
|
213 TInt FocusedButton() const; |
|
214 |
|
215 /** |
|
216 * Gives the update command to Button Panel |
|
217 * @param Update command |
|
218 */ |
|
219 void UpdateButtonPanel( TVRUpdateCommand aCommand ); |
|
220 |
|
221 |
|
222 private: |
|
223 |
|
224 /** |
|
225 * Tells the volume observer to update the volume |
|
226 */ |
|
227 void UpdateVolumeObserver(); |
|
228 |
|
229 /** |
|
230 * Updates the navipane according to the current IHF setting |
|
231 */ |
|
232 void UpdateVolumeControlL(); |
|
233 |
|
234 /** |
|
235 * Updates the CBA Buttons (LSK, RSK, MSK) |
|
236 */ |
|
237 void UpdateCBA(); |
|
238 |
|
239 private: // data |
|
240 |
|
241 /** |
|
242 * The ihf volume control (in navi pane), |
|
243 */ |
|
244 CAknNavigationDecorator* iIhfVolumeControl; |
|
245 |
|
246 /** |
|
247 * The ear piece volume control (in navi pane), |
|
248 */ |
|
249 CAknNavigationDecorator* iEarPieceVolumeControl; |
|
250 |
|
251 /** |
|
252 * A pointer to the active volume control (ihf or ear piece) |
|
253 */ |
|
254 CAknNavigationDecorator* iActiveVolumeControl; |
|
255 |
|
256 /** |
|
257 * Pointer to the navi pane, |
|
258 * used as a short cut. Not owned. |
|
259 */ |
|
260 CAknNavigationControlContainer* iNaviPane; |
|
261 |
|
262 /** |
|
263 * Pointer to the button panel component. Owned. |
|
264 */ |
|
265 CVRButtonPanel* iButtonPanel; |
|
266 |
|
267 /** |
|
268 * Pointer to the state info panel component. Owned. |
|
269 */ |
|
270 CVRStateInfoPanel* iStateInfoPanel; |
|
271 |
|
272 /** |
|
273 * Pointer to the view that owns us. Not owned. |
|
274 */ |
|
275 CVRRecView* iOwningView; |
|
276 |
|
277 /** |
|
278 * Pointer to the decorator data model. Not owned. |
|
279 */ |
|
280 MVRDecoratorModel* iModel; |
|
281 |
|
282 /** |
|
283 * Pointer to the key event observer (or NULL). Not owned. |
|
284 */ |
|
285 MVRKeyObserver* iKeyObserver; |
|
286 |
|
287 /** |
|
288 * Pointer to the audio volume change observer (or NULL). Not owned. |
|
289 */ |
|
290 MVRVolumeChangeObserver* iVolumeChangeObserver; |
|
291 |
|
292 TRect iHorizontalLine; |
|
293 TRect iVerticalLine; |
|
294 |
|
295 TAknLayoutRect iHorizontalLineRect; |
|
296 TAknLayoutRect iVerticalLineRect; |
|
297 TAknLayoutRect iButtonPanelRect; |
|
298 |
|
299 /** |
|
300 * Skin instance from AknsUtils. Not owned. |
|
301 */ |
|
302 MAknsSkinInstance* iSkinInstance; |
|
303 |
|
304 /** |
|
305 * Background context for clearing screen. Owned. |
|
306 */ |
|
307 CAknsBasicBackgroundControlContext* iBackgroundSkinContext; |
|
308 |
|
309 /** |
|
310 * Notifier for side volume key events. Owned. |
|
311 */ |
|
312 CVRRemConObserver* iRemConObserver; |
|
313 }; |
|
314 |
|
315 #endif // __CVRRECVIEWCONTAINER_H__ |