williamr@2
|
1 |
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@4
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@4
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
/**
|
williamr@2
|
17 |
Gets the most recent standard event that was received by the application.
|
williamr@2
|
18 |
|
williamr@2
|
19 |
Note: standard events are all events except redraw events and priority key events.
|
williamr@2
|
20 |
|
williamr@2
|
21 |
@return The last event.
|
williamr@2
|
22 |
*/
|
williamr@2
|
23 |
inline const TWsEvent& CCoeEnv::LastEvent() const
|
williamr@2
|
24 |
{ return(iLastEvent); }
|
williamr@2
|
25 |
|
williamr@2
|
26 |
/** Gets the application UI owned by this application.
|
williamr@2
|
27 |
|
williamr@2
|
28 |
@return Pointer to the app UI owned by the application. */
|
williamr@2
|
29 |
inline CCoeAppUi* CCoeEnv::AppUi() const
|
williamr@2
|
30 |
{ return(iAppUi); }
|
williamr@2
|
31 |
|
williamr@2
|
32 |
/** Gets the file server session owned by this CCoeEnv.
|
williamr@2
|
33 |
|
williamr@2
|
34 |
This session is normally only used for accessing the application's resource
|
williamr@2
|
35 |
file.
|
williamr@2
|
36 |
|
williamr@2
|
37 |
@return The file server session owned by this CCoeEnv. */
|
williamr@2
|
38 |
inline RFs& CCoeEnv::FsSession() const
|
williamr@2
|
39 |
{ return((RFs&)iFsSession); }
|
williamr@2
|
40 |
|
williamr@2
|
41 |
/** Gets the window server session owned by the application.
|
williamr@2
|
42 |
|
williamr@2
|
43 |
This provides access to window server functions not directly accessible via
|
williamr@2
|
44 |
the UI control framework.
|
williamr@2
|
45 |
|
williamr@2
|
46 |
@return The window server session opened by the application. */
|
williamr@2
|
47 |
inline RWsSession& CCoeEnv::WsSession() const
|
williamr@2
|
48 |
{ return((RWsSession&)iWsSession); }
|
williamr@2
|
49 |
|
williamr@2
|
50 |
/** Gets the application's window group.
|
williamr@2
|
51 |
|
williamr@2
|
52 |
Note: a window group is an invisible window which acts as the parent window for
|
williamr@2
|
53 |
all other windows in an application. Typically, each application has one window
|
williamr@2
|
54 |
group. In the window server, window groups are also the unit of keyboard focus.
|
williamr@2
|
55 |
|
williamr@2
|
56 |
@return The application's window group. */inline RWindowGroup& CCoeEnv::RootWin() const
|
williamr@2
|
57 |
{ return((RWindowGroup&)iRootWin); }
|
williamr@2
|
58 |
|
williamr@2
|
59 |
/** Gets the system graphics context.
|
williamr@2
|
60 |
|
williamr@2
|
61 |
This is the graphics context typically used for drawing controls, but an
|
williamr@2
|
62 |
alternative graphics context can be created if required using CreateGcL().
|
williamr@2
|
63 |
|
williamr@2
|
64 |
@return The system graphics context. */
|
williamr@2
|
65 |
inline CWindowGc& CCoeEnv::SystemGc() const
|
williamr@2
|
66 |
{ return((CWindowGc&)*iSystemGc); }
|
williamr@2
|
67 |
|
williamr@2
|
68 |
/** Gets the normal environment font.
|
williamr@2
|
69 |
|
williamr@2
|
70 |
This is the font created during construction of the control environment.
|
williamr@2
|
71 |
|
williamr@2
|
72 |
@return Pointer to the normal environment font.
|
williamr@2
|
73 |
@see InitSystemFontsL() */
|
williamr@2
|
74 |
inline const CFont* CCoeEnv::NormalFont() const
|
williamr@2
|
75 |
{ return(iNormalFont); }
|
williamr@2
|
76 |
|
williamr@2
|
77 |
/** Gets the default screen device owned by this CCoeEnv.
|
williamr@2
|
78 |
|
williamr@2
|
79 |
This is typically used as the standard screen device for the CCoeEnv's application.
|
williamr@2
|
80 |
|
williamr@2
|
81 |
@return The default screen device owned by this CCoeEnv. */
|
williamr@2
|
82 |
inline CWsScreenDevice* CCoeEnv::ScreenDevice() const
|
williamr@2
|
83 |
{ return(iScreen); }
|
williamr@2
|
84 |
|
williamr@2
|
85 |
/** Gets the current error message text.
|
williamr@2
|
86 |
|
williamr@2
|
87 |
@return The current error message text. */
|
williamr@2
|
88 |
inline TDes& CCoeEnv::ErrorText()
|
williamr@2
|
89 |
{ return *iErrorText; }
|
williamr@2
|
90 |
|
williamr@2
|
91 |
/** Gets the current error context text.
|
williamr@2
|
92 |
|
williamr@2
|
93 |
@return The current error context text. */
|
williamr@2
|
94 |
inline TDes& CCoeEnv::ErrorContextText()
|
williamr@2
|
95 |
{ return *iErrorContextText; }
|
williamr@2
|
96 |
|
williamr@2
|
97 |
#if defined(_UNICODE)
|
williamr@2
|
98 |
/** Reads a resource into a descriptor.
|
williamr@2
|
99 |
|
williamr@2
|
100 |
The descriptor must be long enough to contain the entire resource. No memory
|
williamr@2
|
101 |
is allocated by this function. If the read fails, the function sets an error
|
williamr@2
|
102 |
condition and performs any cleanup required. The error condition causes the
|
williamr@2
|
103 |
GUI to launch an alert window.
|
williamr@2
|
104 |
|
williamr@2
|
105 |
Deprecated - Use CCoeEnv::ReadResourceL() instead.
|
williamr@2
|
106 |
|
williamr@2
|
107 |
@deprecated
|
williamr@2
|
108 |
@param aDes On return, contains the resource data.
|
williamr@2
|
109 |
@param aResourceId The numeric ID of the resource to be read.
|
williamr@2
|
110 |
@see RResourceFile::ReadL()
|
williamr@2
|
111 |
@see KErrCoeFailedToReadFromProgDisk */
|
williamr@2
|
112 |
inline void CCoeEnv::ReadResource(TDes& aDes,TInt aResourceId) const
|
williamr@2
|
113 |
{ ReadResourceAsDes16(aDes,aResourceId); }
|
williamr@2
|
114 |
|
williamr@2
|
115 |
/** Reads a resource into a descriptor.
|
williamr@2
|
116 |
|
williamr@2
|
117 |
The descriptor must be long enough to contain the entire resource.
|
williamr@2
|
118 |
No memory is allocated by this function.
|
williamr@2
|
119 |
|
williamr@2
|
120 |
@param aDes On return, contains the resource data.
|
williamr@2
|
121 |
@param aResourceId The numeric ID of the resource to be read.
|
williamr@2
|
122 |
@return Pointer to a heap descriptor containing the resource. */
|
williamr@2
|
123 |
inline void CCoeEnv::ReadResourceL(TDes& aDes,TInt aResourceId) const
|
williamr@2
|
124 |
{ ReadResourceAsDes16L(aDes,aResourceId); }
|
williamr@2
|
125 |
|
williamr@2
|
126 |
/** Reads a resource into a heap descriptor, allocating memory for it.
|
williamr@2
|
127 |
|
williamr@2
|
128 |
Note: the calling program must destroy the heap descriptor when it is no longer
|
williamr@2
|
129 |
needed.
|
williamr@2
|
130 |
|
williamr@2
|
131 |
@param aResourceId The numeric ID of the resource to be read.
|
williamr@2
|
132 |
@return Pointer to a heap descriptor containing the resource data.
|
williamr@2
|
133 |
@see RResourceFile::AllocReadL() */
|
williamr@2
|
134 |
inline HBufC* CCoeEnv::AllocReadResourceL(TInt aResourceId) const
|
williamr@2
|
135 |
{ return AllocReadResourceAsDes16L(aResourceId); }
|
williamr@2
|
136 |
|
williamr@2
|
137 |
/** Reads a specified resource into a heap descriptor, allocating memory for it,
|
williamr@2
|
138 |
and pushing the descriptor onto the cleanup stack.
|
williamr@2
|
139 |
|
williamr@2
|
140 |
The calling program should pop and destroy the heap descriptor when it is
|
williamr@2
|
141 |
no longer needed.
|
williamr@2
|
142 |
|
williamr@2
|
143 |
@param aResourceId The numeric ID of the resource to be read.
|
williamr@2
|
144 |
@return Pointer to a heap descriptor containing the resource data.
|
williamr@2
|
145 |
@see RResourceFile::AllocReadLC() */
|
williamr@2
|
146 |
inline HBufC* CCoeEnv::AllocReadResourceLC(TInt aResourceId) const
|
williamr@2
|
147 |
{ return AllocReadResourceAsDes16LC(aResourceId); }
|
williamr@2
|
148 |
|
williamr@2
|
149 |
/** Reads a resource into a Unicode descriptor array.
|
williamr@2
|
150 |
|
williamr@2
|
151 |
@param aResourceId The numeric ID of the resource to be read.
|
williamr@2
|
152 |
@return A pointer to the descriptor array containing the resource data.
|
williamr@2
|
153 |
@see TResourceReader::ReadDesCArrayL() */
|
williamr@2
|
154 |
inline CDesCArrayFlat* CCoeEnv::ReadDesCArrayResourceL(TInt aResourceId)
|
williamr@2
|
155 |
{ return ReadDesC16ArrayResourceL(aResourceId); }
|
williamr@2
|
156 |
#else // not UNICODE
|
williamr@2
|
157 |
|
williamr@2
|
158 |
/** Deprecated - use CCoeEnv::ReadResourceL() instead.
|
williamr@2
|
159 |
|
williamr@2
|
160 |
@deprecated */
|
williamr@2
|
161 |
inline void CCoeEnv::ReadResource(TDes& aDes,TInt aResourceId) const
|
williamr@2
|
162 |
{ ReadResourceAsDes8(aDes,aResourceId); }
|
williamr@2
|
163 |
|
williamr@2
|
164 |
inline void CCoeEnv::ReadResourceL(TDes& aDes,TInt aResourceId) const
|
williamr@2
|
165 |
{ ReadResourceAsDes8L(aDes,aResourceId); }
|
williamr@2
|
166 |
inline HBufC* CCoeEnv::AllocReadResourceL(TInt aResourceId) const
|
williamr@2
|
167 |
{ return AllocReadResourceAsDes8L(aResourceId); }
|
williamr@2
|
168 |
inline HBufC* CCoeEnv::AllocReadResourceLC(TInt aResourceId) const
|
williamr@2
|
169 |
{ return AllocReadResourceAsDes8LC(aResourceId); }
|
williamr@2
|
170 |
inline CDesCArrayFlat* CCoeEnv::ReadDesCArrayResourceL(TInt aResourceId)
|
williamr@2
|
171 |
{ return ReadDesC8ArrayResourceL(aResourceId); }
|
williamr@2
|
172 |
#endif // UNICODE
|
williamr@2
|
173 |
|
williamr@2
|
174 |
//
|
williamr@2
|
175 |
// Tests if the Active Scheduler is started in the CCoeEnv::ExecuteD
|
williamr@2
|
176 |
//
|
williamr@2
|
177 |
// @return "TBool"
|
williamr@2
|
178 |
// <code>ETrue</code> if Active Scheduler is started in
|
williamr@2
|
179 |
// CCoeEnv::ExecuteD()
|
williamr@2
|
180 |
// <code>EFalse</code> if Active Scheduler is not started in
|
williamr@2
|
181 |
// CCoeEnv::ExecuteD()
|
williamr@2
|
182 |
//
|
williamr@2
|
183 |
inline TBool CCoeEnv::IsSchedulerRunning() const
|
williamr@2
|
184 |
{return iEnvFlags&ESchedulerIsRunning;}
|