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