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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
19 Gets the most recent standard event that was received by the application.
21 Note: standard events are all events except redraw events and priority key events.
23 @return The last event.
25 inline const TWsEvent& CCoeEnv::LastEvent() const
26 { return(iLastEvent); }
28 /** Gets the application UI owned by this application.
30 @return Pointer to the app UI owned by the application. */
31 inline CCoeAppUi* CCoeEnv::AppUi() const
34 /** Gets the file server session owned by this CCoeEnv.
36 This session is normally only used for accessing the application's resource
39 @return The file server session owned by this CCoeEnv. */
40 inline RFs& CCoeEnv::FsSession() const
41 { return((RFs&)iFsSession); }
43 /** Gets the window server session owned by the application.
45 This provides access to window server functions not directly accessible via
46 the UI control framework.
48 @return The window server session opened by the application. */
49 inline RWsSession& CCoeEnv::WsSession() const
50 { return((RWsSession&)iWsSession); }
52 /** Gets the application's window group.
54 Note: a window group is an invisible window which acts as the parent window for
55 all other windows in an application. Typically, each application has one window
56 group. In the window server, window groups are also the unit of keyboard focus.
58 @return The application's window group. */inline RWindowGroup& CCoeEnv::RootWin() const
59 { return((RWindowGroup&)iRootWin); }
61 /** Gets the system graphics context.
63 This is the graphics context typically used for drawing controls, but an
64 alternative graphics context can be created if required using CreateGcL().
66 @return The system graphics context. */
67 inline CWindowGc& CCoeEnv::SystemGc() const
68 { return((CWindowGc&)*iSystemGc); }
70 /** Gets the normal environment font.
72 This is the font created during construction of the control environment.
74 @return Pointer to the normal environment font.
75 @see InitSystemFontsL() */
76 inline const CFont* CCoeEnv::NormalFont() const
77 { return(iNormalFont); }
79 /** Gets the default screen device owned by this CCoeEnv.
81 This is typically used as the standard screen device for the CCoeEnv's application.
83 @return The default screen device owned by this CCoeEnv. */
84 inline CWsScreenDevice* CCoeEnv::ScreenDevice() const
87 /** Gets the current error message text.
89 @return The current error message text. */
90 inline TDes& CCoeEnv::ErrorText()
91 { return *iErrorText; }
93 /** Gets the current error context text.
95 @return The current error context text. */
96 inline TDes& CCoeEnv::ErrorContextText()
97 { return *iErrorContextText; }
100 /** Reads a resource into a descriptor.
102 The descriptor must be long enough to contain the entire resource. No memory
103 is allocated by this function. If the read fails, the function sets an error
104 condition and performs any cleanup required. The error condition causes the
105 GUI to launch an alert window.
107 Deprecated - Use CCoeEnv::ReadResourceL() instead.
110 @param aDes On return, contains the resource data.
111 @param aResourceId The numeric ID of the resource to be read.
112 @see RResourceFile::ReadL()
113 @see KErrCoeFailedToReadFromProgDisk */
114 inline void CCoeEnv::ReadResource(TDes& aDes,TInt aResourceId) const
115 { ReadResourceAsDes16(aDes,aResourceId); }
117 /** Reads a resource into a descriptor.
119 The descriptor must be long enough to contain the entire resource.
120 No memory is allocated by this function.
122 @param aDes On return, contains the resource data.
123 @param aResourceId The numeric ID of the resource to be read.
124 @return Pointer to a heap descriptor containing the resource. */
125 inline void CCoeEnv::ReadResourceL(TDes& aDes,TInt aResourceId) const
126 { ReadResourceAsDes16L(aDes,aResourceId); }
128 /** Reads a resource into a heap descriptor, allocating memory for it.
130 Note: the calling program must destroy the heap descriptor when it is no longer
133 @param aResourceId The numeric ID of the resource to be read.
134 @return Pointer to a heap descriptor containing the resource data.
135 @see RResourceFile::AllocReadL() */
136 inline HBufC* CCoeEnv::AllocReadResourceL(TInt aResourceId) const
137 { return AllocReadResourceAsDes16L(aResourceId); }
139 /** Reads a specified resource into a heap descriptor, allocating memory for it,
140 and pushing the descriptor onto the cleanup stack.
142 The calling program should pop and destroy the heap descriptor when it is
145 @param aResourceId The numeric ID of the resource to be read.
146 @return Pointer to a heap descriptor containing the resource data.
147 @see RResourceFile::AllocReadLC() */
148 inline HBufC* CCoeEnv::AllocReadResourceLC(TInt aResourceId) const
149 { return AllocReadResourceAsDes16LC(aResourceId); }
151 /** Reads a resource into a Unicode descriptor array.
153 @param aResourceId The numeric ID of the resource to be read.
154 @return A pointer to the descriptor array containing the resource data.
155 @see TResourceReader::ReadDesCArrayL() */
156 inline CDesCArrayFlat* CCoeEnv::ReadDesCArrayResourceL(TInt aResourceId)
157 { return ReadDesC16ArrayResourceL(aResourceId); }
160 /** Deprecated - use CCoeEnv::ReadResourceL() instead.
163 inline void CCoeEnv::ReadResource(TDes& aDes,TInt aResourceId) const
164 { ReadResourceAsDes8(aDes,aResourceId); }
166 inline void CCoeEnv::ReadResourceL(TDes& aDes,TInt aResourceId) const
167 { ReadResourceAsDes8L(aDes,aResourceId); }
168 inline HBufC* CCoeEnv::AllocReadResourceL(TInt aResourceId) const
169 { return AllocReadResourceAsDes8L(aResourceId); }
170 inline HBufC* CCoeEnv::AllocReadResourceLC(TInt aResourceId) const
171 { return AllocReadResourceAsDes8LC(aResourceId); }
172 inline CDesCArrayFlat* CCoeEnv::ReadDesCArrayResourceL(TInt aResourceId)
173 { return ReadDesC8ArrayResourceL(aResourceId); }
177 // Tests if the Active Scheduler is started in the CCoeEnv::ExecuteD
180 // <code>ETrue</code> if Active Scheduler is started in
181 // CCoeEnv::ExecuteD()
182 // <code>EFalse</code> if Active Scheduler is not started in
183 // CCoeEnv::ExecuteD()
185 inline TBool CCoeEnv::IsSchedulerRunning() const
186 {return iEnvFlags&ESchedulerIsRunning;}