|
1 /* |
|
2 * Copyright (c) 2002 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 * Manager for the statuspane, include navi pane and title pane |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef CPHONESTATUSPANE_H |
|
21 #define CPHONESTATUSPANE_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <coemain.h> |
|
26 #include <aknnavi.h> // for CAknNavigationControlContainer & |
|
27 // CAknNavigationDecorator |
|
28 |
|
29 #include "mphonestatuspane.h" |
|
30 #include "phoneconstants.h" |
|
31 |
|
32 // CONSTANTS |
|
33 |
|
34 // FORWARD DECLARATIONS |
|
35 class CAknTitlePane; |
|
36 class CEikStatusPane; |
|
37 class TPhoneCommandParam; |
|
38 class CAknIndicatorContainer; |
|
39 |
|
40 // CLASS DECLARATION |
|
41 |
|
42 class THandlerTag |
|
43 { |
|
44 public: |
|
45 MPhoneStatusPaneObserver* iObserver; |
|
46 TInt iLayer; |
|
47 }; |
|
48 /** |
|
49 * Manager for the statuspane, include navi pane and title pane |
|
50 * Usage: |
|
51 * Every client in phone application that will change the title pane should |
|
52 * use status pane manager, to avoid confliction. |
|
53 * - Always use iStatusPaneManager.TitlePane() to get the reference of status |
|
54 * pane. |
|
55 * - in ConstructL() insert a new handler to status pane manager by |
|
56 * AddTitlePaneHandlerL( *this ) |
|
57 * - Reserve the title pane before you change the title pane by |
|
58 * ReserveTitlePane( *this ) |
|
59 * - Before changing the status pane, always check if I'm the topmost handler |
|
60 * of the manager, by iStatusPaneManager->IsTitlePaneVisible() |
|
61 * - release the title pane after the change |
|
62 * |
|
63 */ |
|
64 class CPhoneStatusPane : |
|
65 public CCoeStatic, |
|
66 public MPhoneStatusPane |
|
67 { |
|
68 public: // Constructors and destructor |
|
69 |
|
70 /** |
|
71 * First call initializes the singleton object. Subsequent calls return |
|
72 * instance. |
|
73 * @return the created instance. |
|
74 */ |
|
75 static CPhoneStatusPane* Instance(); |
|
76 |
|
77 /** |
|
78 * Destructor. |
|
79 */ |
|
80 virtual ~CPhoneStatusPane(); |
|
81 |
|
82 public: // from MPAStatusPane |
|
83 |
|
84 /** |
|
85 * Returns ETrue if status pane is visible. |
|
86 */ |
|
87 TBool IsVisible() const; |
|
88 |
|
89 /** |
|
90 * Get the reference of the title pane |
|
91 * @return the reference of the title pane |
|
92 */ |
|
93 CAknTitlePane& TitlePane() const; |
|
94 |
|
95 /** |
|
96 * Get the reference of the title pane |
|
97 * @return the reference of the title pane |
|
98 */ |
|
99 CEikStatusPane& StatusPane() const; |
|
100 |
|
101 /** |
|
102 * Get the reference of the navi pane |
|
103 * @return the reference of the navi pane |
|
104 */ |
|
105 CAknNavigationControlContainer& NaviPane() const; |
|
106 |
|
107 /** |
|
108 * Get the reference of the navi decorator |
|
109 * @return the reference of the navi decorator |
|
110 */ |
|
111 CAknNavigationDecorator& NaviDecorator() const; |
|
112 |
|
113 /** |
|
114 * Add title pane handler, returns reserve id |
|
115 * @return reservatoin id |
|
116 */ |
|
117 void AddTitlePaneHandlerL( MPhoneStatusPaneObserver& aObserver ); |
|
118 |
|
119 /** |
|
120 * Reserve the title pane |
|
121 * @param the reserve id for release and get the visibility status |
|
122 */ |
|
123 void ReserveTitlePane( MPhoneStatusPaneObserver& aObserver ); |
|
124 |
|
125 /** |
|
126 * Release title pane that has been reserved |
|
127 * @param aReserveId the reserve id |
|
128 */ |
|
129 void ReleaseTitlePane( MPhoneStatusPaneObserver& aObserver ); |
|
130 |
|
131 /** |
|
132 * Remove the handler |
|
133 */ |
|
134 void RemoveTitlePaneHandler( MPhoneStatusPaneObserver& aObserver ); |
|
135 |
|
136 /** |
|
137 * Check if the title pane is visible |
|
138 * @param aReserveId the reservation id |
|
139 * @return ETrue if the title pane is visible |
|
140 */ |
|
141 TBool IsTitlePaneVisible( |
|
142 MPhoneStatusPaneObserver& aObserver ) const; |
|
143 |
|
144 /** |
|
145 * Gets status pane shape. |
|
146 * @param aRegion shape of the status pane. |
|
147 */ |
|
148 void GetShape( TRegion& aRegion ); |
|
149 |
|
150 public: |
|
151 |
|
152 /** |
|
153 * Update the title pane. |
|
154 */ |
|
155 void UpdateTitlePane(); |
|
156 |
|
157 |
|
158 void SetTitlePaneContentL( const TDesC& aMessage ); |
|
159 |
|
160 void SetTitlePanePictureL( TPhoneCommandParam* aCommandParam ); |
|
161 |
|
162 /** |
|
163 * Handle update of volume leven in naviPane |
|
164 */ |
|
165 void SetVolumeLevel( |
|
166 TPhoneCommandParam* aCommandParam ); |
|
167 |
|
168 void ActivateVoiceVolumeControl( |
|
169 TPhoneCommandParam* aCommandParam); |
|
170 |
|
171 void DeactivateVoiceVolumeControl(); |
|
172 |
|
173 TInt DoSwitchVolumeControlL( |
|
174 TPhoneCommandParam* aCommandParam ); |
|
175 |
|
176 /** |
|
177 * Creates title pane containing text. |
|
178 * |
|
179 * When instance is deleted, then text is removed from title pane. |
|
180 * |
|
181 * @param aTextResourceId text resorce. |
|
182 * @return instance, also put to cleanup stack. |
|
183 */ |
|
184 CBase* CreateTextTitlePaneLC( TInt aTextResourceId ); |
|
185 |
|
186 /** |
|
187 * Creates empty indicator pane. |
|
188 * @return the pointer of empty indicator pane. |
|
189 */ |
|
190 CAknIndicatorContainer* CreateEmptyIndicatorContainerL(); |
|
191 |
|
192 private: |
|
193 |
|
194 /** |
|
195 * Update the title pane within recovery system |
|
196 */ |
|
197 void DoUpdateTitlePaneL(); |
|
198 /** |
|
199 * Callback funciton for recovery system to update title pane. |
|
200 */ |
|
201 static TInt UpdateTitlePaneCallBackL( TAny* aAny ); |
|
202 |
|
203 /** |
|
204 * Pushes new decorator to navi pane replacing the |
|
205 * previous one. |
|
206 * @param aNew new to replace the old one. |
|
207 */ |
|
208 void PushL( CAknNavigationDecorator& aNew ); |
|
209 |
|
210 private: |
|
211 |
|
212 /** |
|
213 * Two-phased constructor. |
|
214 * @return new instance. |
|
215 */ |
|
216 static CPhoneStatusPane* NewL(); |
|
217 |
|
218 /** |
|
219 * C++ default constructor. |
|
220 */ |
|
221 CPhoneStatusPane(); |
|
222 |
|
223 /** |
|
224 * By default Symbian OS constructor is private. |
|
225 */ |
|
226 void ConstructL(); |
|
227 |
|
228 private: |
|
229 |
|
230 /** |
|
231 * Get the largest layer in the title pane list |
|
232 */ |
|
233 TInt LargestLayerInTitlePaneList() const; |
|
234 |
|
235 /** |
|
236 * Get the pointer to the title pane hander by reserve id |
|
237 */ |
|
238 THandlerTag* FindTitlePaneHandler( |
|
239 MPhoneStatusPaneObserver& aObserver ) const; |
|
240 |
|
241 /** |
|
242 * Get the current active title pane user |
|
243 */ |
|
244 THandlerTag* FindTopmostTitlePaneHandler() const; |
|
245 |
|
246 /** |
|
247 * Notify handler on activation event |
|
248 */ |
|
249 void NotifyHandlerOnActivation( |
|
250 THandlerTag& aHandlerTag, |
|
251 TBool aActive ); |
|
252 |
|
253 /** |
|
254 * Call back function for recovery system to switch the layout to idle |
|
255 */ |
|
256 static TInt RecoverySwitchLayoutToIdleL( TAny* aAny ); |
|
257 |
|
258 // By default, prohibit copy constructor |
|
259 CPhoneStatusPane( const CPhoneStatusPane& ); |
|
260 |
|
261 // Prohibit assigment operator |
|
262 CPhoneStatusPane& operator= ( const CPhoneStatusPane& ); |
|
263 |
|
264 /** |
|
265 * Function for statuspane if there is a operatorpicture |
|
266 */ |
|
267 void RenderBitmapOnTitlePaneL(); |
|
268 |
|
269 private: // Data |
|
270 |
|
271 //Recovery id for switch layout to idle state |
|
272 TInt iSwitchLayoutIdleRecoveryId; |
|
273 |
|
274 // Recovery id for update title pane |
|
275 TInt iUpdateTitlePaneRecoveryId; |
|
276 |
|
277 /** |
|
278 * Array of PhoneStatusPane observers |
|
279 * Own. |
|
280 */ |
|
281 CArrayFixFlat< THandlerTag > *iTitlePaneList; |
|
282 |
|
283 /** |
|
284 * Pointer to Eikon status pane. |
|
285 * Not own. |
|
286 */ |
|
287 CEikStatusPane* iStatusPane; |
|
288 |
|
289 /** |
|
290 * Pointer the Avkon title pane. |
|
291 * Not own. |
|
292 */ |
|
293 CAknTitlePane* iTitlePane; |
|
294 |
|
295 /** |
|
296 * Title pane bitmap. |
|
297 * Own. |
|
298 */ |
|
299 CFbsBitmap* iTitlePanePicture; |
|
300 |
|
301 /** |
|
302 * Title pane bitmap mask |
|
303 * Own. |
|
304 */ |
|
305 CFbsBitmap* iTitlePanePictureMask; |
|
306 |
|
307 /** |
|
308 * ETrue if title pane text is displayed; otherwise, display the bitmap |
|
309 */ |
|
310 TBool iTitlePaneTextIsDisplayed; |
|
311 |
|
312 /* |
|
313 * The pointer to the navi pane. |
|
314 * Not own. |
|
315 */ |
|
316 CAknNavigationControlContainer* iNaviPane; |
|
317 |
|
318 /** |
|
319 * The pointer to the navi decorator |
|
320 * Own. |
|
321 */ |
|
322 CAknNavigationDecorator* iNaviDecorator; |
|
323 |
|
324 // Title Pane Text |
|
325 TBuf< KPhoneTitlePaneTextSize > iTitleText; |
|
326 }; |
|
327 |
|
328 #endif // CPhoneStatusPane_H |
|
329 |
|
330 // End of File |