1 coemain.h |
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __COEMAIN_H__ |
|
17 #define __COEMAIN_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <w32std.h> |
|
21 #include <barsc.h> |
|
22 #include <badesca.h> |
|
23 #include <basched.h> |
|
24 #include <coemop.h> |
|
25 #include <coetextdrawer.h> |
|
26 |
|
27 #if defined(USE_IH_RAISE_EVENT) |
|
28 #include <systemmonitor/raiseevent.h> |
|
29 #include <test/testinstrumentation.h> |
|
30 #endif |
|
31 |
|
32 class CVwsSessionWrapper; |
|
33 class MVwsSessionWrapperObserver; |
|
34 class TCoeInputCapabilities; // forward declaration of class defined in COEINPUT.H |
|
35 class CCoeAppUi; |
|
36 class CCoeEnv; |
|
37 class TResourceReader; |
|
38 class RGenericPointerArray; |
|
39 class CCoeFep; // must derive from CBase |
|
40 class CCoeFontProvider; |
|
41 class CCoeEnvExtra; |
|
42 class CCoeStatic; |
|
43 |
|
44 |
|
45 /** UI Control framework active object priorities. |
|
46 These are in addition to the values contained in the TPriority enum in class CActive. |
|
47 |
|
48 @publishedAll |
|
49 @released */ |
|
50 enum TActivePriority |
|
51 { |
|
52 /** 300 */ |
|
53 EActivePriorityClockTimer=300, |
|
54 /** 200 */ |
|
55 EActivePriorityIpcEventsHigh=200, |
|
56 /** 150 */ |
|
57 EActivePriorityFepLoader=150, |
|
58 /** 100 */ |
|
59 EActivePriorityWsEvents=100, |
|
60 /** 50 */ |
|
61 EActivePriorityRedrawEvents=50, |
|
62 /** 0 */ |
|
63 EActivePriorityDefault=0, |
|
64 /** 10 */ |
|
65 EActivePriorityLogonA=-10 |
|
66 }; |
|
67 |
|
68 |
|
69 /** Interface providing notification when there is a change in the currently |
|
70 loaded FEP. |
|
71 |
|
72 This happens either on application start-up, or as a result of a different |
|
73 front end processor having been installed. |
|
74 |
|
75 Anyone requiring this notification should derive from this class and implement |
|
76 its pure virtual function. Derived classes also need to call CCoeEnv::AddObserverOfLoadedFepL() |
|
77 during construction, and CCoeEnv::RemoveObserverOfLoadedFep() in their destructor. |
|
78 |
|
79 @publishedAll |
|
80 @released */ |
|
81 class MCoeObserverOfLoadedFep |
|
82 { |
|
83 public: |
|
84 /** Handles a change in the loaded FEP. |
|
85 |
|
86 The function is called if a new FEP is loaded, or if the current one is unloaded. */ |
|
87 virtual void HandleChangeInLoadedFep()=0; |
|
88 protected: |
|
89 IMPORT_C MCoeObserverOfLoadedFep(); |
|
90 |
|
91 private: |
|
92 IMPORT_C virtual void MCoeObserverOfLoadedFep_Reserved_1(); |
|
93 IMPORT_C virtual void MCoeObserverOfLoadedFep_Reserved_2(); |
|
94 private: |
|
95 TInt iMCoeObserverOfLoadedFep_Reserved1; |
|
96 }; |
|
97 |
|
98 |
|
99 /** Interface providing notification if any control gains or loses focus or is |
|
100 destroyed. |
|
101 |
|
102 The FEP framework uses this class to observe when a target control changes |
|
103 for reasons unrelated to the FEP. |
|
104 |
|
105 Anything that needs such notification should derive from this class and implement |
|
106 its two pure virtual functions. |
|
107 |
|
108 In addition, derived classes need to call CCoeEnv::AddFocusObserverL() during |
|
109 construction, and CCoeEnv::RemoveFocusObserver() in their destructors. |
|
110 |
|
111 @publishedAll |
|
112 @released |
|
113 @see CCoeFep */ |
|
114 class MCoeFocusObserver |
|
115 { |
|
116 public: |
|
117 /** Handles changes in focus. The function is called if any control gains or loses |
|
118 focus. */ |
|
119 virtual void HandleChangeInFocus()=0; |
|
120 /** Handles the destruction of any control. It is called by the framework if any |
|
121 control is destroyed. */ |
|
122 virtual void HandleDestructionOfFocusedItem()=0; |
|
123 protected: |
|
124 IMPORT_C MCoeFocusObserver(); |
|
125 private: |
|
126 IMPORT_C virtual void MCoeFocusObserver_Reserved_1(); |
|
127 IMPORT_C virtual void MCoeFocusObserver_Reserved_2(); |
|
128 private: |
|
129 TInt iMCoeFocusObserver_Reserved1; |
|
130 }; |
|
131 |
|
132 /** An interface which enables message windows to observe resource changes. |
|
133 |
|
134 Resource change observers should be added to the control environment using |
|
135 CCoeEnv::AddResourceChangeObserverL(). |
|
136 |
|
137 @publishedAll |
|
138 @released */ |
|
139 class MCoeResourceChangeObserver |
|
140 { |
|
141 public: |
|
142 /** Handles a change to the application's resources. */ |
|
143 virtual void HandleResourceChange()=0; |
|
144 protected: |
|
145 IMPORT_C MCoeResourceChangeObserver(); |
|
146 private: |
|
147 IMPORT_C virtual void MCoeResourceChangeObserver_Reserved_1(); |
|
148 IMPORT_C virtual void MCoeResourceChangeObserver_Reserved_2(); |
|
149 private: |
|
150 TInt iMCoeResourceChangeObserver_Reserved1; |
|
151 }; |
|
152 |
|
153 /** Interface providing notification of foreground/background changes. |
|
154 |
|
155 The FEP framework class, CCoeFep, derives from MCoeForegroundObserver, which |
|
156 enables FEPs to receive notification when the target application (which receives |
|
157 the FEP's output) goes into the foreground or background. |
|
158 |
|
159 Anything that needs this notification should derive from this class and override |
|
160 its two pure virtual functions. |
|
161 |
|
162 In addition, derived classes also need to call CCoeEnv::AddForegroundObserverL() |
|
163 during construction, and CCoeEnv::RemoveForegroundObserver() in their destructors. |
|
164 |
|
165 @publishedAll |
|
166 @released |
|
167 @see CCoeFep */ |
|
168 class MCoeForegroundObserver |
|
169 { |
|
170 public: |
|
171 /** Handles the application coming to the foreground. */ |
|
172 virtual void HandleGainingForeground()=0; |
|
173 /** Handles the application going into the background. */ |
|
174 virtual void HandleLosingForeground()=0; |
|
175 protected: |
|
176 IMPORT_C MCoeForegroundObserver(); |
|
177 private: |
|
178 IMPORT_C virtual void MCoeForegroundObserver_Reserved_1(); |
|
179 IMPORT_C virtual void MCoeForegroundObserver_Reserved_2(); |
|
180 private: |
|
181 TInt iMCoeForegroundObserver_Reserved1; |
|
182 }; |
|
183 |
|
184 |
|
185 /** Interface for handling incoming window server messages. |
|
186 |
|
187 This interface is used to enable FEPs to keep their settings synchronised |
|
188 across all running instances. |
|
189 |
|
190 Anything that needs to be notified of messages that get sent by the window server's |
|
191 message-sending service should derive from this class and override its pure |
|
192 virtual function. |
|
193 |
|
194 In addition, derived classes also need to call CCoeEnv::AddMessageObserverL() |
|
195 during construction and CCoeEnv::RemoveMessageObserver() in their destructors. |
|
196 |
|
197 @publishedAll |
|
198 @released */ |
|
199 class MCoeMessageObserver |
|
200 { |
|
201 public: |
|
202 /** Message response flags. */ |
|
203 enum TMessageResponse |
|
204 { |
|
205 /** Message not handled. */ |
|
206 EMessageNotHandled, |
|
207 /** Message handled. */ |
|
208 EMessageHandled |
|
209 }; |
|
210 public: |
|
211 /** Handles window server messages. |
|
212 |
|
213 Implementations should return EMessageHandled if they are able to handle the |
|
214 message, or EMessageNotHandled if the message is not appropriate to this observer. |
|
215 |
|
216 @param aClientHandleOfTargetWindowGroup The window group that the message |
|
217 was sent to. Many implementations will not need this information. |
|
218 @param aMessageUid The message UID. |
|
219 @param aMessageParameters The message parameters. |
|
220 @return Indicates whether the message was handled or not handled |
|
221 by the function. */ |
|
222 virtual TMessageResponse HandleMessageL(TUint32 aClientHandleOfTargetWindowGroup, TUid aMessageUid, const TDesC8& aMessageParameters)=0; |
|
223 protected: |
|
224 IMPORT_C MCoeMessageObserver(); |
|
225 private: |
|
226 IMPORT_C virtual void MCoeMessageObserver_Reserved_1(); |
|
227 IMPORT_C virtual void MCoeMessageObserver_Reserved_2(); |
|
228 }; |
|
229 |
|
230 /** Mix-in interface for handling window visibility messages. |
|
231 |
|
232 @publishedAll |
|
233 @released */ |
|
234 class MCoeMessageMonitorObserver |
|
235 { |
|
236 public: |
|
237 /** Received windows messages for monitoring. |
|
238 @param aEvent The windows server event data.*/ |
|
239 virtual void MonitorWsMessage(const TWsEvent& aEvent)=0; |
|
240 private: |
|
241 IMPORT_C virtual void MCoeMessageMonitorObserver_Reserved_1(); |
|
242 IMPORT_C virtual void MCoeMessageMonitorObserver_Reserved_2(); |
|
243 }; |
|
244 |
|
245 // classes defined in FEPBASE, declared here |
|
246 class MCoeFepObserver; |
|
247 |
|
248 /** |
|
249 @publishedAll |
|
250 @released |
|
251 */ |
|
252 typedef void (*TCoeFepObserverFunction)(MCoeFepObserver& aFepObserver); |
|
253 |
|
254 /** |
|
255 @publishedAll |
|
256 @released |
|
257 */ |
|
258 class CCoeFepParameters : public CBase |
|
259 { |
|
260 public: |
|
261 static CCoeFepParameters* NewLC(); |
|
262 private: |
|
263 inline CCoeFepParameters() {} |
|
264 }; |
|
265 |
|
266 |
|
267 /** Implements the active scheduler presupposed by the control environment. |
|
268 |
|
269 @publishedPartner |
|
270 @deprecated |
|
271 */ |
|
272 class CCoeScheduler : public CBaActiveScheduler |
|
273 { |
|
274 public: |
|
275 IMPORT_C CCoeScheduler(CCoeEnv* aCoeEnv); |
|
276 IMPORT_C virtual void WaitForAnyRequest(); |
|
277 IMPORT_C virtual void DisplayError(TInt aError) const; |
|
278 /** Gets the control environment. |
|
279 |
|
280 @return A pointer to the control environment. */ |
|
281 inline CCoeEnv* CoeEnv() {return iCoeEnv;} |
|
282 TBool Flush() const; // not to be called from outside CONE |
|
283 void SetFlush(TBool aFlush); // not to be called from outside CONE |
|
284 private: |
|
285 // from CBaActiveScheduler |
|
286 IMPORT_C virtual void Reserved_1(); |
|
287 IMPORT_C virtual void Reserved_2(); |
|
288 private: |
|
289 CCoeEnv* iCoeEnv; |
|
290 TBool iFlush; |
|
291 }; |
|
292 |
|
293 |
|
294 |
|
295 /** Control environment. |
|
296 |
|
297 CCoeEnv provides an active environment for creating controls. It implements |
|
298 active objects and an active scheduler, which provide access to the window |
|
299 server, simplifying the API for application programs. It also provides utility |
|
300 functions that are useful to many applications. |
|
301 |
|
302 When a standard event occurs, the active scheduler calls CCoeEnv::RunL(). |
|
303 When a redraw event occurs, it calls CCoeRedrawer::RunL(). Priority key events |
|
304 must be accessed using the Window Server API directly. |
|
305 |
|
306 Note: standard events are all events except redraw events and priority key events. |
|
307 |
|
308 @publishedAll |
|
309 @released */ |
|
310 class CCoeEnv : public CActive, public MObjectProvider |
|
311 { |
|
312 public: |
|
313 // Properties |
|
314 IMPORT_C static TVersion Version(); |
|
315 IMPORT_C static CCoeEnv* Static(); |
|
316 // Construction and destruction |
|
317 IMPORT_C CCoeEnv(); |
|
318 IMPORT_C ~CCoeEnv(); |
|
319 IMPORT_C void ConstructL(); |
|
320 IMPORT_C void ConstructL(TBool aInitialFocusState); |
|
321 IMPORT_C void ConstructL(TBool aInitialFocusState, TInt aDefaultScreenNumber); |
|
322 IMPORT_C void ConstructL(TBool aInitialFocusState, TInt aDefaultScreenNumber, TInt aWindowGroupID); |
|
323 IMPORT_C CCoeAppUi* SetAppUi(CCoeAppUi* aAppUi); |
|
324 IMPORT_C void ExecuteD(); |
|
325 IMPORT_C void Execute(); |
|
326 IMPORT_C void RunL(); |
|
327 IMPORT_C void DoCancel(); |
|
328 IMPORT_C void PrepareToExit(); |
|
329 IMPORT_C virtual void DestroyEnvironment(); |
|
330 IMPORT_C void DisableExitChecks(TBool aDisable); |
|
331 IMPORT_C virtual void HandleError(TInt aError); |
|
332 // System resources |
|
333 inline CCoeAppUi* AppUi() const; |
|
334 inline RFs& FsSession() const; |
|
335 inline RWsSession& WsSession() const; |
|
336 inline RWindowGroup& RootWin() const; |
|
337 inline CWsScreenDevice* ScreenDevice() const; |
|
338 inline CWindowGc& SystemGc() const; |
|
339 inline const CFont* NormalFont() const; |
|
340 inline const TWsEvent& LastEvent() const; |
|
341 inline TBool IsSchedulerRunning() const; |
|
342 // Graphics |
|
343 IMPORT_C CWindowGc* CreateGcL(); |
|
344 IMPORT_C CWindowGc* SwapSystemGc(CWindowGc* aGc); |
|
345 IMPORT_C void Flush(TTimeIntervalMicroSeconds32 aDelay=0); |
|
346 IMPORT_C void SuppressNextFlush(); |
|
347 IMPORT_C TBool IsWservEventPending() const; |
|
348 IMPORT_C TBool IsRedrawEventPending() const; |
|
349 // Fonts (legacy API) |
|
350 IMPORT_C CFbsFont* CreateDeviceFontL(CGraphicsDevice* aDevice,const TFontSpec& aFontSpec); |
|
351 IMPORT_C CFbsFont* CreateScreenFontL(const TFontSpec& aFontSpec); |
|
352 IMPORT_C void ReleaseScreenFont(CFont* aFont) const; |
|
353 // Font provider |
|
354 IMPORT_C const CCoeFontProvider& DefaultFontProvider() const; |
|
355 // Text drawer |
|
356 IMPORT_C CCoeTextDrawerBase& DefaultTextDrawer() const; |
|
357 // Zooming |
|
358 IMPORT_C TZoomFactor ZoomFactor() const; |
|
359 IMPORT_C void SetZoomFactor(const TZoomFactor& aZoomFactor); |
|
360 // Resource reading |
|
361 IMPORT_C TInt AddResourceFileL(const TDesC& aFileName); |
|
362 IMPORT_C void DeleteResourceFile(TInt aOffset); |
|
363 IMPORT_C TBool IsResourceAvailableL(TInt aResourceId) const; |
|
364 IMPORT_C void CreateResourceReaderLC(TResourceReader& aReader,TInt aResourceId) const; |
|
365 inline void ReadResource(TDes& aDes,TInt aResourceId) const; |
|
366 inline void ReadResourceL(TDes& aDes,TInt aResourceId) const; |
|
367 inline HBufC* AllocReadResourceL(TInt aResourceId) const; |
|
368 inline HBufC* AllocReadResourceLC(TInt aResourceId) const; |
|
369 inline CDesCArrayFlat* ReadDesCArrayResourceL(TInt aResourceId); |
|
370 IMPORT_C void ReadResourceAsDes8(TDes8& aDes,TInt aResourceId) const; /** @deprecated 7.0*/ |
|
371 IMPORT_C void ReadResourceAsDes8L(TDes8& aDes,TInt aResourceId) const; |
|
372 IMPORT_C HBufC8* AllocReadResourceAsDes8L(TInt aResourceId) const; |
|
373 IMPORT_C HBufC8* AllocReadResourceAsDes8LC(TInt aResourceId) const; |
|
374 IMPORT_C CDesC8ArrayFlat* ReadDesC8ArrayResourceL(TInt aResourceId); |
|
375 IMPORT_C void ReadResourceAsDes16(TDes16& aDes,TInt aResourceId) const; /** @deprecated 7.0*/ |
|
376 IMPORT_C void ReadResourceAsDes16L(TDes16& aDes,TInt aResourceId) const; |
|
377 IMPORT_C HBufC16* AllocReadResourceAsDes16L(TInt aResourceId) const; |
|
378 IMPORT_C HBufC16* AllocReadResourceAsDes16LC(TInt aResourceId) const; |
|
379 IMPORT_C CDesC16ArrayFlat* ReadDesC16ArrayResourceL(TInt aResourceId); |
|
380 IMPORT_C void Format128(TDes& aDes,TInt aResourceId,...); |
|
381 IMPORT_C void Format256(TDes& aDes,TInt aResourceId,...); |
|
382 // Error handling |
|
383 IMPORT_C void LeaveWithErrorText(const TDesC& aMsg,const TDesC* aContextText=NULL); |
|
384 // Key handling |
|
385 IMPORT_C void SimulateKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
|
386 // FEP handling |
|
387 IMPORT_C void AddObserverOfLoadedFepL(MCoeObserverOfLoadedFep& aObserverOfLoadedFep); |
|
388 IMPORT_C void RemoveObserverOfLoadedFep(MCoeObserverOfLoadedFep& aObserverOfLoadedFep); |
|
389 IMPORT_C void AddFepObserverL(MCoeFepObserver& aFepObserver); |
|
390 IMPORT_C void RemoveFepObserver(MCoeFepObserver& aFepObserver); |
|
391 IMPORT_C void ForEachFepObserverCall(TCoeFepObserverFunction aFepObserverFunction); |
|
392 void EnsureCorrectFepIsLoadedL(); |
|
393 void EnsureSpecifiedFepIsLoadedL(TUid aFepUid); |
|
394 IMPORT_C void InstallFepL(TUid aFepUid); |
|
395 IMPORT_C void InstallFepL(TUid aFepUid, const TBool aLeave); |
|
396 IMPORT_C void AvailableFepsL(RArray<TUid>& aUids, CDesCArray* aDisplayNames); |
|
397 IMPORT_C void ExecuteFepSettingsDialogL(TUid aFepUid); |
|
398 IMPORT_C CCoeFep* Fep() const; |
|
399 IMPORT_C TUid FepUid() const; |
|
400 IMPORT_C void InputCapabilitiesChanged(); |
|
401 // Control focus handling |
|
402 IMPORT_C void AddFocusObserverL(MCoeFocusObserver& aFocusObserver); |
|
403 IMPORT_C void RemoveFocusObserver(MCoeFocusObserver& aFocusObserver); |
|
404 IMPORT_C void SyncNotifyFocusObserversOfChangeInFocus(); |
|
405 void NotifyFocusObserversOfDestructionOfFocusedItem(); |
|
406 // Application focus (foreground) handling |
|
407 IMPORT_C void BringOwnerToFront(); |
|
408 IMPORT_C void AddForegroundObserverL(MCoeForegroundObserver& aForegroundObserver); |
|
409 IMPORT_C void RemoveForegroundObserver(MCoeForegroundObserver& aForegroundObserver); |
|
410 void NotifyForegroundObserversOfGainingForeground(); |
|
411 void NotifyForegroundObserversOfLosingForeground(); |
|
412 // Resource change handling |
|
413 IMPORT_C void AddResourceChangeObserverL(MCoeResourceChangeObserver& aResourceChangeObserver); |
|
414 IMPORT_C void RemoveResourceChangeObserver(MCoeResourceChangeObserver& aResourceChangeObserver); |
|
415 void NotifyResourceObserversOfChangeInResource(); |
|
416 // Window server message handling |
|
417 IMPORT_C void AddMessageObserverL(MCoeMessageObserver& aMessageObserver); |
|
418 IMPORT_C void RemoveMessageObserver(MCoeMessageObserver& aMessageObserver); |
|
419 IMPORT_C void AddMessageMonitorObserverL(MCoeMessageMonitorObserver& aMessageMonitorObserver); |
|
420 IMPORT_C void RemoveMessageMonitorObserver(MCoeMessageMonitorObserver& aMessageMonitorObserver); |
|
421 void NotifyMessageMonitorObserversOfEvent(const TWsEvent& aEvent); |
|
422 // Singleton access |
|
423 IMPORT_C static CCoeStatic* Static(TUid aUid); |
|
424 IMPORT_C CCoeStatic* FindStatic(TUid aUid); |
|
425 #if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS) |
|
426 //multiple screens |
|
427 IMPORT_C CWsScreenDevice* ScreenDevice(TInt aScreenNumber) const; |
|
428 IMPORT_C RWindowGroup* RootWin(TInt aScreenNumber) const; |
|
429 #endif |
|
430 public: // *** Do not use! API liable to change *** |
|
431 TInt AppStartupInstrumentationEventIdBase(); |
|
432 public: // Internal to Symbian |
|
433 IMPORT_C void GetMessageNotifyingObserversLC(TUint32 aClientHandleOfTargetWindowGroup, TUid& aMessageUid, TPtr8& aMessageParameters, const TWsEvent& aMessageEvent); |
|
434 IMPORT_C TBool DisableShutdownChecks() const; |
|
435 protected: // Internal to Symbian |
|
436 IMPORT_C void SetAppStartupInstrumentationEventIdBaseL(TInt aAppStartupInstrumentationEventIdBase); |
|
437 IMPORT_C void DestroyEnvironmentStatic(); |
|
438 IMPORT_C void DestroyEnvironmentEnd(); |
|
439 IMPORT_C TInt CoeEnvConstructorError() const; |
|
440 private: // reserved virtual function space |
|
441 IMPORT_C virtual void Reserved_1(); |
|
442 IMPORT_C virtual void Reserved_2(); |
|
443 private: // from CActive |
|
444 IMPORT_C TInt RunError(TInt aError); |
|
445 protected: // from MObjectProvider |
|
446 IMPORT_C TTypeUid::Ptr MopSupplyObject(TTypeUid aId); |
|
447 protected: |
|
448 IMPORT_C virtual void DestroyScreen(); |
|
449 inline TDes& ErrorText(); |
|
450 inline TDes& ErrorContextText(); |
|
451 public: // but not exported |
|
452 void ReadEvent(); |
|
453 CVwsSessionWrapper* InitViewServerSessionL(MVwsSessionWrapperObserver& aObserver); |
|
454 void AddStatic(CCoeStatic* aStatic); |
|
455 void QueueNotificationToFocusObserversOfChangeInFocus(); |
|
456 TInt FocusObserverNotificationIdentifier() const; |
|
457 TBool FocusObserverNotificationIsStillPending(TInt aFocusObserverNotificationIdentifier) const; |
|
458 void RefetchPixelMappingL(); |
|
459 TBool ControlStateChange(); |
|
460 private: |
|
461 void CreateActiveSchedulerL(); |
|
462 void ConnectToFileServerL(); |
|
463 void ConnectToWindowServerL(); |
|
464 void InitScreenL( TInt aDefaultScreenNumber ); |
|
465 void InitRootWindowL(TBool aInitialFocusState, TInt aWindowGroupID=0); |
|
466 void InitSystemGcL(); |
|
467 IMPORT_C virtual void InitSystemFontsL(); |
|
468 IMPORT_C virtual TInt ResourceFileVersionNumber() const; |
|
469 RResourceFile& ResourceFileForId(TInt aResourceId) const; |
|
470 void DestroyAllResourceFiles(); |
|
471 void AddObserverL(TAny* aObserver, RGenericPointerArray& aArray); |
|
472 void RemoveObserver(TAny* aObserver, RGenericPointerArray& aArray); |
|
473 void UpdateStatic(CCoeAppUi* aNewAppUi); |
|
474 void SetInitialHandleCount(); |
|
475 TUint InitialHandleCount() const; |
|
476 RResourceFile* DoResourceFileForIdL(TInt aResourceId) const; |
|
477 #if defined(SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS) |
|
478 void PopulateArrayOfScreenItemsL(); |
|
479 void DeleteArrayOfScreensItems(); |
|
480 #endif |
|
481 protected: |
|
482 CCoeAppUi* iAppUi; |
|
483 RFs iFsSession; |
|
484 RWsSession iWsSession; |
|
485 RWindowGroup iRootWin; |
|
486 CWindowGc* iSystemGc; |
|
487 const CFont* iNormalFont; |
|
488 CWsScreenDevice* iScreen; |
|
489 TWsEvent iLastEvent; |
|
490 CArrayFix<RResourceFile>* iResourceFileArray; |
|
491 private: |
|
492 enum TFlags // used in the bottom 16 bits only of iEnvFlags |
|
493 { |
|
494 ENoShutdownChecks =0x0001, |
|
495 EExtraPointerIsErrorCode =0x0002, |
|
496 ESchedulerIsRunning =0x0004 |
|
497 }; |
|
498 private: |
|
499 TDes* iErrorText; |
|
500 TDes* iErrorContextText; |
|
501 CCoeEnvExtra* iExtra; |
|
502 CTrapCleanup* iCleanup; |
|
503 TUint iEnvFlags; |
|
504 }; |
|
505 |
|
506 /** Base class for creating singleton objects that will be stored by CCoeEnv. |
|
507 |
|
508 Each object must have a unique TUid. |
|
509 |
|
510 Symbian OS does not provide writeable global static data. Singleton objects |
|
511 provide its equivalent in thread local storage, which is supported. |
|
512 |
|
513 This behaviour is useful for objects in which only one copy is ever needed |
|
514 in the thread or application, e.g. in alert windows. |
|
515 |
|
516 @publishedAll |
|
517 @released */ |
|
518 class CCoeStatic : public CBase |
|
519 { |
|
520 public: |
|
521 /** Scope of access to the singleton object. */ |
|
522 enum TScope |
|
523 { |
|
524 /** Access from the entire thread. */ |
|
525 EThread, |
|
526 /** Access from an appUi in that thread. */ |
|
527 EApp, |
|
528 }; |
|
529 /** The default destruction priority if none is specified in the constructor */ |
|
530 enum {EDefaultDestructionPriority=100}; |
|
531 public: |
|
532 IMPORT_C ~CCoeStatic(); |
|
533 protected: |
|
534 IMPORT_C CCoeStatic(); |
|
535 IMPORT_C CCoeStatic(TUid aUid,TScope=EThread); |
|
536 IMPORT_C CCoeStatic(TUid aUid,TInt aDestructionPriority,TScope aScope=EThread); |
|
537 private: |
|
538 IMPORT_C virtual void CCoeStatic_Reserved1(); |
|
539 IMPORT_C virtual void CCoeStatic_Reserved2(); |
|
540 private: |
|
541 void DoConstruction(const TUid& aUid,TInt aDestructionPriority,TScope aScope); |
|
542 void SetCsAppUi(CCoeAppUi* aAppUi); |
|
543 CCoeAppUi* CsAppUi() const; |
|
544 TScope CsScope() const; |
|
545 inline TInt DestructionPriority() const {return iCsLink.iPriority;} |
|
546 private: |
|
547 TPriQueLink iCsLink; |
|
548 TUid iCsUid; |
|
549 TUint iCsAppUiAndScope; |
|
550 TInt iCCoeStatic_Reserved1; |
|
551 private: |
|
552 friend class CCoeEnv; |
|
553 friend class CCoeEnvExtra; |
|
554 }; |
|
555 |
|
556 #include <coemain.inl> |
|
557 |
|
558 #endif // __COEMAIN_H__ |