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