|
1 /* |
|
2 * Copyright (c) 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: View Manager |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef XNVIEWMANAGER_H |
|
19 #define XNVIEWMANAGER_H |
|
20 |
|
21 // System includes |
|
22 #include <e32base.h> |
|
23 |
|
24 // User includes |
|
25 |
|
26 // Forward declarations |
|
27 class CXnUiEngine; |
|
28 class CXnComposer; |
|
29 class CXnODTParser; |
|
30 class CXnEditor; |
|
31 class CXnEcomHandler; |
|
32 class CXnRootData; |
|
33 class CXnViewData; |
|
34 class CXnPluginData; |
|
35 class CXnNode; |
|
36 class CXnODT; |
|
37 class CXnResource; |
|
38 class CXnControlAdapter; |
|
39 class CXnAppUiAdapter; |
|
40 class CHsContentInfo; |
|
41 class CXnViewAdapter; |
|
42 class CXnOomSysHandler; |
|
43 |
|
44 namespace hspswrapper |
|
45 { |
|
46 class CHspsWrapper; |
|
47 } |
|
48 |
|
49 using namespace hspswrapper; |
|
50 |
|
51 // Classe declaration |
|
52 /** |
|
53 * Notifies view changes |
|
54 * |
|
55 * @ingroup group_xnlayoutengine |
|
56 * @lib xn3layoutengine.lib |
|
57 * @since S60 5.0 |
|
58 */ |
|
59 NONSHARABLE_CLASS( MXnViewObserver ) |
|
60 { |
|
61 public: |
|
62 // new functions |
|
63 virtual void NotifyViewActivatedL( const CXnViewData& aViewData ) = 0; |
|
64 |
|
65 virtual void NotifyViewDeactivatedL( const CXnViewData& aViewData ) = 0; |
|
66 |
|
67 virtual void NotifyConfigureWidgetL( |
|
68 const CHsContentInfo& aContentInfo, |
|
69 CXnPluginData& aPluginData ) = 0; |
|
70 |
|
71 virtual void NotifyWidgetAdditionL( const CXnPluginData& aPluginData ) = 0; |
|
72 |
|
73 virtual void NotifyWidgetRemovalL( const CXnPluginData& aPluginData ) = 0; |
|
74 |
|
75 virtual void NotifyViewAdditionL( const CXnPluginData& aPluginData ) = 0; |
|
76 |
|
77 virtual void NotifyViewRemovalL( const CXnPluginData& aPluginData ) = 0; |
|
78 |
|
79 virtual void NotifyAllViewsLoadedL() = 0; |
|
80 |
|
81 virtual void NotifyContainerActivatedL( const CXnViewData& aViewData ) = 0; |
|
82 }; |
|
83 |
|
84 /** |
|
85 * Manages views in UiEngine. |
|
86 * |
|
87 * @ingroup group_xnlayoutengine |
|
88 * @lib xn3layoutengine.lib |
|
89 * @since S60 5.0 |
|
90 */ |
|
91 NONSHARABLE_CLASS( CXnViewManager ) : public CBase |
|
92 { |
|
93 public: |
|
94 /** |
|
95 * Two-phased constructor. |
|
96 */ |
|
97 static CXnViewManager* NewL( |
|
98 CXnAppUiAdapter& aAdapter ); |
|
99 |
|
100 /** |
|
101 * Two-phased constructor. |
|
102 */ |
|
103 static CXnViewManager* NewLC( |
|
104 CXnAppUiAdapter& aAdapter ); |
|
105 |
|
106 /** |
|
107 * Destructor |
|
108 */ |
|
109 ~CXnViewManager(); |
|
110 |
|
111 private: |
|
112 // constructors |
|
113 |
|
114 /** |
|
115 * C++ constructor |
|
116 */ |
|
117 CXnViewManager( CXnAppUiAdapter& aAdapter ); |
|
118 |
|
119 /** |
|
120 * 2nd phase constructor |
|
121 */ |
|
122 void ConstructL(); |
|
123 |
|
124 public: |
|
125 // New functions |
|
126 |
|
127 inline void SetUiEngine( CXnUiEngine& aUiEngine ); |
|
128 |
|
129 inline CXnUiEngine& UiEngine() const; |
|
130 |
|
131 inline CXnComposer& Composer() const; |
|
132 |
|
133 inline CXnEditor& Editor() const; |
|
134 |
|
135 inline CXnAppUiAdapter& AppUiAdapter() const; |
|
136 |
|
137 CXnODT* ODT() const; |
|
138 |
|
139 CXnNode* RootNode() const; |
|
140 |
|
141 CXnNode* ViewNode() const; |
|
142 |
|
143 CXnODTParser& Parser() const; |
|
144 |
|
145 CXnEcomHandler& EcomHandler() const; |
|
146 |
|
147 const RPointerArray< CXnControlAdapter >& Controls() const; |
|
148 |
|
149 RPointerArray< CXnNode >& PluginNodes() const; |
|
150 |
|
151 void PluginDataL( RPointerArray< CXnPluginData >& aList, |
|
152 TBool aGlobal = EFalse ) const; |
|
153 |
|
154 TInt PluginDataL( const TDesC8& aParentId, |
|
155 RPointerArray< CXnPluginData >& aList ) const; |
|
156 |
|
157 RPointerArray< CXnNode >& AppearanceNodes() const; |
|
158 |
|
159 CArrayPtrSeg< CXnResource >& Resources() const ; |
|
160 |
|
161 void LoadUiL(); |
|
162 |
|
163 void ReloadUiL(); |
|
164 |
|
165 TInt LoadWidgetToPluginL( |
|
166 const CHsContentInfo& aContentInfo, |
|
167 CXnPluginData& aPluginData ); |
|
168 |
|
169 TInt UnloadWidgetFromPluginL( |
|
170 CXnPluginData& aPluginData, TBool aForce = EFalse ); |
|
171 |
|
172 TInt ReplaceWidgetToPluginL( |
|
173 const CHsContentInfo& aContentInfo, |
|
174 CXnPluginData& aPluginData ); |
|
175 |
|
176 void ActivateNextViewL( TInt aEffectId = 0 ); |
|
177 |
|
178 void ActivatePreviousViewL( TInt aEffectId = 0 ); |
|
179 |
|
180 TInt AddViewL( const CHsContentInfo& aInfo ); |
|
181 |
|
182 void AddViewL( TInt aEffectId = 0 ); |
|
183 |
|
184 TInt RemoveFaultyView( CXnViewData* aViewData ); |
|
185 |
|
186 TInt RemoveViewL( const CHsContentInfo& aInfo ); |
|
187 |
|
188 void RemoveViewL( TInt aEffectId = 0 ); |
|
189 |
|
190 void AddObserver( const MXnViewObserver& aObserver ); |
|
191 |
|
192 void RemoveObserver( const MXnViewObserver& aObserver ); |
|
193 |
|
194 CXnRootData& ActiveAppData() const; |
|
195 |
|
196 CXnViewData& ActiveViewData() const; |
|
197 |
|
198 TInt ActivateAppL( const TDesC8& aPluginUid ); |
|
199 TInt ActivateViewL( const TDesC8& aPluginId ); |
|
200 |
|
201 TInt ViewAmount() const; |
|
202 |
|
203 TInt ViewIndex() const; |
|
204 |
|
205 TInt MaxPages() const; |
|
206 |
|
207 CXnOomSysHandler& OomSysHandler() const; |
|
208 |
|
209 void UpdatePageManagementInformationL(); |
|
210 |
|
211 void ShowErrorL( TInt aResource ) const; |
|
212 |
|
213 void HandleErrorNotes( const TInt aError ) const; |
|
214 |
|
215 void PublishersReadyL( CXnViewData& aViewData, TInt aResult ); |
|
216 |
|
217 void NotifyAllViewsLoadedL(); |
|
218 |
|
219 private: |
|
220 // new functions |
|
221 |
|
222 void NotifyContainerChangedL( CXnViewData& aViewToActivate ); |
|
223 |
|
224 void NotifyViewActivatedL( const CXnViewData& aViewData ); |
|
225 |
|
226 void NotifyViewDeactivatedL( const CXnViewData& aViewData ); |
|
227 |
|
228 void NotifyViewAdditionL( const CXnViewData& aViewData ); |
|
229 |
|
230 void NotifyViewRemovalL( const CXnViewData& aViewData ); |
|
231 |
|
232 void NotifyConfigureWidgetL( |
|
233 const CHsContentInfo& aContentInfo, |
|
234 CXnPluginData& aPluginData ); |
|
235 |
|
236 void NotifyWidgetAdditionL( const CXnPluginData& aPluginData ); |
|
237 |
|
238 void NotifyWidgetRemovalL( const CXnPluginData& aPluginData ); |
|
239 |
|
240 void NotifyContainerActivatedL( const CXnViewData& aViewData ); |
|
241 |
|
242 CXnViewData* ViewData( CXnNode& aNode ) const; |
|
243 |
|
244 CXnViewData& PreviousViewData() const; |
|
245 |
|
246 CXnViewData& NextViewData() const; |
|
247 |
|
248 void UpdateCachesL(); |
|
249 |
|
250 void ReportWidgetAmountL( const CXnViewData& aViewData ); |
|
251 |
|
252 TInt ResolveIconIndex( TInt aPageCount, TInt aPageNum ) const; |
|
253 |
|
254 /** |
|
255 * Callback for stability timer |
|
256 * |
|
257 * @param aAny Pointer to CViewManager object |
|
258 * @return TInt System wide error code. |
|
259 */ |
|
260 static TInt SystemStabileTimerCallback( TAny* aAny ); |
|
261 |
|
262 /** |
|
263 * Reset crash count |
|
264 */ |
|
265 void ResetCrashCount(); |
|
266 |
|
267 void DoRobustnessCheckL(); |
|
268 |
|
269 static TInt ContainerActivated( TAny* aAny ); |
|
270 |
|
271 private: |
|
272 // data |
|
273 |
|
274 /** |
|
275 * AppUi adapter. |
|
276 * Not own. |
|
277 */ |
|
278 CXnAppUiAdapter& iAppUiAdapter; |
|
279 |
|
280 /** |
|
281 * Application uid |
|
282 */ |
|
283 TUid iApplicationUid; |
|
284 |
|
285 /** |
|
286 * HSPS wrapper. |
|
287 * Not own. |
|
288 */ |
|
289 CHspsWrapper* iHspsWrapper; |
|
290 |
|
291 /** |
|
292 * UiEngine. |
|
293 * Not own. |
|
294 */ |
|
295 CXnUiEngine* iUiEngine; |
|
296 |
|
297 /** |
|
298 * Comopser. |
|
299 * Own. |
|
300 */ |
|
301 CXnComposer* iComposer; |
|
302 |
|
303 /** |
|
304 * Editor. |
|
305 * Own. |
|
306 */ |
|
307 CXnEditor* iEditor; |
|
308 |
|
309 /** |
|
310 * Application configuration root data. |
|
311 * Own. |
|
312 */ |
|
313 CXnRootData* iRootData; |
|
314 |
|
315 /** |
|
316 * Widget amount trigger. |
|
317 * Own. |
|
318 */ |
|
319 CXnNode* iWidgetAmountTrigger; |
|
320 |
|
321 /** |
|
322 * Resources for current view. |
|
323 * Own. |
|
324 */ |
|
325 mutable CArrayPtrSeg< CXnResource >* iResources; |
|
326 |
|
327 /** |
|
328 * Controls for current view. |
|
329 * Own. |
|
330 */ |
|
331 mutable RPointerArray< CXnControlAdapter > iControls; |
|
332 |
|
333 /** |
|
334 * Appearance nodes. This array needs to be updated when UI furniture |
|
335 * is changed. |
|
336 * Own. |
|
337 */ |
|
338 mutable RPointerArray< CXnNode > iAppearanceNodes; |
|
339 |
|
340 /** |
|
341 * View observers. |
|
342 * Own. |
|
343 */ |
|
344 RPointerArray< MXnViewObserver > iObservers; |
|
345 |
|
346 /** |
|
347 * OOM system handler. |
|
348 * Own. |
|
349 */ |
|
350 CXnOomSysHandler* iOomSysHandler; |
|
351 |
|
352 /** |
|
353 * Timer for system stability. |
|
354 * Own. |
|
355 */ |
|
356 CPeriodic* iStabilityTimer; |
|
357 |
|
358 /** |
|
359 * Flag to indicate first view activation |
|
360 */ |
|
361 TBool iUiReady; |
|
362 |
|
363 /** |
|
364 * Async callback |
|
365 * Own. |
|
366 */ |
|
367 CPeriodic* iAsyncCb; |
|
368 |
|
369 private: |
|
370 // Friend classes |
|
371 |
|
372 friend class CXnViewAdapter; |
|
373 }; |
|
374 |
|
375 // Inline functions |
|
376 #include "xnviewmanager.inl" |
|
377 |
|
378 #endif |