|
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 __LAFENV_H__ |
|
17 #define __LAFENV_H__ |
|
18 |
|
19 #include <e32std.h> |
|
20 #include <e32base.h> |
|
21 #include <gulbordr.h> |
|
22 #include <gulalign.h> |
|
23 #include <lafmain.h> |
|
24 #include <apgcli.h> |
|
25 #include <eikinfomsgwin.h> |
|
26 #include <eikbusymsgwin.h> |
|
27 #include <eikmsg.h> |
|
28 |
|
29 class MParser; |
|
30 class CCoeEnv; |
|
31 class CFont; |
|
32 class TLogicalFont; |
|
33 class CLafSystemFont; |
|
34 |
|
35 class LafEnv |
|
36 /** Application environment level LAF functions. |
|
37 |
|
38 @publishedPartner |
|
39 @released */ |
|
40 { |
|
41 public: |
|
42 /** Creates an EText parser. |
|
43 |
|
44 @param aIndex Index of parser to retrieve. A LAF can supply multiple parsers, |
|
45 indexed from 0. |
|
46 @return EText parser */ |
|
47 IMPORT_C static MParser* CreateTextParserL(TInt aIndex); |
|
48 /** Draws a logical border. |
|
49 |
|
50 @param aBorder Border specification to draw |
|
51 @param aGc Graphics context to which to draw |
|
52 @param aRect Drawing rectangle |
|
53 @param aBorderColors Colours with which to draw */ |
|
54 IMPORT_C static void DrawLogicalBorder(const TGulBorder& aBorder,CGraphicsContext& aGc,const TRect& aRect,const TGulBorder::TColors& aBorderColors); |
|
55 /** Gets the margins of a specified logical border. |
|
56 |
|
57 @param aBorder Border specification |
|
58 @return Border's margins */ |
|
59 IMPORT_C static TMargins LogicalBorderMargins(const TGulBorder& aBorder); |
|
60 /** Populates an array with a set of system bitmaps. |
|
61 |
|
62 CEikonEnv calls this to get system bitmaps, and uses the array in subsequent |
|
63 calls to MatchBitmap(). |
|
64 |
|
65 @param aEnv Application's control environment |
|
66 @param aBitmaps On return, array of system bitmaps */ |
|
67 IMPORT_C static void CreateSystemBitmapsL(CCoeEnv& aEnv, CArrayPtrFlat<CFbsBitmap>& aBitmaps); |
|
68 /** Populates an array with a set of system fonts. |
|
69 |
|
70 CEikonEnv calls this to get system fonts, and uses the array in subsequent |
|
71 calls to MatchFont(). |
|
72 |
|
73 A minimum of one font must be created. |
|
74 |
|
75 @param aEnv Application's control environment |
|
76 @param aFonts On return, array of system fonts */ |
|
77 IMPORT_C static void CreateSystemFontsL(CCoeEnv& aEnv,CArrayPtr<CLafSystemFont>& aFonts); |
|
78 /** Gets the nearest match in the specified fonts for a specified logical system |
|
79 font. |
|
80 |
|
81 The return value must be non-NULL. |
|
82 |
|
83 @param aFonts Fonts from which to select the match |
|
84 @param aLogicalFont The logical font to match |
|
85 @return Font that is the best match to aLogicalFont */ |
|
86 IMPORT_C static const CFont* MatchFont(CArrayPtr<CLafSystemFont>& aFonts,const TLogicalFont& aLogicalFont); |
|
87 /** Gets the nearest match in the specified bitmaps for a specified system bitmap |
|
88 type. |
|
89 |
|
90 The desired bitmap is specified by the identifer aBmpUid: for possible UIDs, |
|
91 see KLafUidEikonTexturedVal etc. |
|
92 |
|
93 The return value must be non-NULL. |
|
94 |
|
95 @param aSystemBmps Bitmaps from which to select the match |
|
96 @param aBmpUid The bitmap type to match |
|
97 @return Bitmap that is the best match to aBmpUid */ |
|
98 IMPORT_C static CFbsBitmap* MatchBitmap(const CArrayPtrFlat<CFbsBitmap>& aSystemBmps, TUid aBmpUid); |
|
99 /** Gets the corner of the screen which the busy message should appear in by default |
|
100 on the device. |
|
101 |
|
102 @return Default corner |
|
103 @see CEikonEnv::BusyMsgL() */ |
|
104 IMPORT_C static TGulAlignment DefaultBusyMsgCorner(); |
|
105 /** Tests if the specified key corresponds to the hardware default key. |
|
106 |
|
107 @param aCharCode Key to test |
|
108 @return True if the key is the default */ |
|
109 IMPORT_C static TBool IsDefaultKey(TUint aCharCode); |
|
110 /** Gets the default line spacing used to format text paragraphs. |
|
111 |
|
112 @return Default line spacing in twips */ |
|
113 IMPORT_C static TInt DefaultLineSpacingInTwips(); |
|
114 /** Gets the height of single-line edit control for the system normal font. |
|
115 |
|
116 @param aLafEnv Environment access |
|
117 @return Height of single-line edit control */ |
|
118 IMPORT_C static TInt EditableControlStandardHeight(const MLafEnv& aLafEnv); |
|
119 /** Sets any device-specific font attributes to be applied to the system character |
|
120 formatting layer. |
|
121 |
|
122 Applications can access the format layer through CEikonEnv::SystemCharFormatLayerL(). |
|
123 This format layer is also used in Edwins. |
|
124 |
|
125 @param aCharFormat On return, the character formatting to apply |
|
126 @param aCharFormatMask On return, the character formatting mask to apply */ |
|
127 IMPORT_C static void PrepareCharFormatAndMask(TCharFormat& aCharFormat,TCharFormatMask& aCharFormatMask); |
|
128 /** Specifies (and creates if necessary) a default directory for documents. |
|
129 |
|
130 The function is called on application startup. The parameters provided are |
|
131 to allow an implementation to generate a document directory based on the application |
|
132 being launched. |
|
133 |
|
134 @param aFilePath On return, the default / generated directory path |
|
135 @param aAppUid UID of application being launched |
|
136 @param aLs Application's session with the Application Architecture server |
|
137 @param aEnv Thread's control environment */ |
|
138 IMPORT_C static void GetDefaultPath(TDes& aFilePath,TUid aAppUid,RApaLsSession& aLs,CCoeEnv& aEnv); |
|
139 /** Loads the system resource file. |
|
140 |
|
141 The system resource file defines resources required by the system environment, |
|
142 and which can also be used by applications. The function is called by CCoeEnv's |
|
143 construction function. |
|
144 |
|
145 @param aEnv Thread's control environment |
|
146 @return System wide error code */ |
|
147 IMPORT_C static TInt LoadCoreResFileL(CCoeEnv& aEnv); |
|
148 /** Loads the private resource file. |
|
149 |
|
150 The private resource file defines resources required by the system environment, |
|
151 but not intended for application use. The function is called by CCoeEnv's |
|
152 construction function. |
|
153 |
|
154 @param aEnv Thread's control environment |
|
155 @return System wide error code */ |
|
156 IMPORT_C static TInt LoadPrivResFileL(CCoeEnv& aEnv); |
|
157 /** Gets the name of the resource file that contains resources for the EIKCOCTL |
|
158 component. |
|
159 |
|
160 @return Resource file for the EIKCOCTL component */ |
|
161 IMPORT_C static const TDesC& CoctlResourceFile(); |
|
162 /** Allows the LAF to update the list of system bitmaps, in response to a colour |
|
163 settings change. |
|
164 |
|
165 @param aEnv Thread's control environment |
|
166 @param aBitmaps On return, updated array of system bitmaps |
|
167 @param aColorList New colour settings */ |
|
168 IMPORT_C static void UpdateSystemBitmapsL(CCoeEnv& aEnv, CArrayPtrFlat<CFbsBitmap>& aBitmaps, const CColorList& aColorList); |
|
169 |
|
170 /** Performs the releasing of the fonts but doesn't delete the array itself |
|
171 |
|
172 @param aSystemFontArray array of fonts to release |
|
173 */ |
|
174 IMPORT_C static void ReleaseSystemFonts( CArrayPtr<CLafSystemFont>& aSystemFontArray); |
|
175 |
|
176 /** Creates busy message window. |
|
177 |
|
178 @param aEnv Thread's control environment |
|
179 @return Busy message window */ |
|
180 IMPORT_C static MEikBusyMsgWin* NewBusyMsgWinL(CCoeEnv& aEnv); |
|
181 /** Creates info message window. |
|
182 |
|
183 @param aEnv Thread's control environment |
|
184 @return Info message window */ |
|
185 IMPORT_C static MEikInfoMsgWin* NewInfoMsgWinL(CCoeEnv& aEnv); |
|
186 |
|
187 /** Creates info message window, overridden function to allow another RWindowGroup to be |
|
188 used rather the the the CCoeEnv's RootWin() function. |
|
189 |
|
190 @param aEnv Thread's control environment |
|
191 @param aWinGroup window group for displaying the Info Msg |
|
192 @return Info message window */ |
|
193 IMPORT_C static MEikInfoMsgWin* NewInfoMsgWinL(CCoeEnv& aEnv, RWindowGroup& aWinGroup); |
|
194 /** Asks if display of the task list is disabled during initialization |
|
195 |
|
196 @return ETrue if task list is disabled, otherwise EFalse */ |
|
197 IMPORT_C static TBool IsTaskListDisabledAtInitialization(); |
|
198 /** Displays a one or two line alert as a notifier window customisable by the system GUI. |
|
199 |
|
200 @param aMsg1 Line one of the message to be displayed. |
|
201 @param aMsg2 Line two of the message to be displayed */ |
|
202 IMPORT_C static void DisplayAlertAsNotifier(const TDesC& aMsg1, const TDesC& aMsg2); |
|
203 |
|
204 /** Updates an existing color list |
|
205 |
|
206 @param aColorList The color list to be updated. */ |
|
207 IMPORT_C static void UpdateColorListL(CColorList* aColorList); |
|
208 |
|
209 /** Plays an audible alert, if supported by the system GUI. */ |
|
210 IMPORT_C static void Beep(); |
|
211 |
|
212 /** Updates an existing array of system fonts. |
|
213 |
|
214 @param aEnv Thread's control environment |
|
215 @param aSystemFontArray The array of fonts to be updated */ |
|
216 IMPORT_C static void UpdateSystemFontsL(CCoeEnv* aEnv, CArrayPtr<CLafSystemFont>& aSystemFontArray); |
|
217 |
|
218 /** A list of events that are handled by the HandleExtensionEventL() function.*/ |
|
219 enum TLafEnvExtensionEvent |
|
220 { |
|
221 /** Event sent in CEikonEnv::ConstructL right before CCoeEnv::ConstructL() */ |
|
222 ELafEnvPreCoeEnvConstructL, |
|
223 /** Event sent in CEikonEnv::ConstructL right after CCoeEnv::ConstructL() */ |
|
224 ELafEnvPostCoeEnvConstructL |
|
225 }; |
|
226 |
|
227 /** Handles events listed by TLafEnvExtensionEvent |
|
228 @param aEnv The instance of CEikonEnv from which this function has been called |
|
229 @param aEvent The event |
|
230 */ |
|
231 IMPORT_C static void HandleExtensionEventL(CEikonEnv& aEnv, TLafEnvExtensionEvent aEvent); |
|
232 |
|
233 /** Allows debug keys to display output. |
|
234 @param aResourceId The resource to use for the note |
|
235 */ |
|
236 IMPORT_C static void InfoNote(TInt aResourceId,...); |
|
237 |
|
238 /** Creates a default system colour list. |
|
239 @param aEnv The instance of CEikonEnv from which this function has been called |
|
240 @return A list of colours |
|
241 */ |
|
242 IMPORT_C static CColorList* CreateColorListL(CEikonEnv& aEnv); |
|
243 |
|
244 /** Gets the name of the clock DLL |
|
245 @return The name of the clock DLL |
|
246 */ |
|
247 IMPORT_C static const TDesC& ClockDllName(); |
|
248 |
|
249 /** The behaviour of CEikonEnv can be customized. This enum lists |
|
250 the things that can be customized. */ |
|
251 enum TLafEnvPolicyItem |
|
252 { |
|
253 /** The action to take when there is an error during startup. */ |
|
254 ELafEnvPolicyExitIfErrorDuringStartup, |
|
255 /** The action to take when the document is corrupt. */ |
|
256 ELafEnvPolicyDeleteCorruptDocumentAndContinue, |
|
257 /** This affects the way the environment is deleted. */ |
|
258 ELAfEnvPolicyDeferredEnvironmentDeletion, |
|
259 }; |
|
260 |
|
261 /** CEikonEnv will use this function to find out how it should behave. |
|
262 The list of things that can be customized this way are listed by |
|
263 TLafEnvPolicyItem. |
|
264 @param aItem The policy item. |
|
265 @return An integer that indicates what the action should be. |
|
266 */ |
|
267 IMPORT_C static TInt PolicyItem(TLafEnvPolicyItem aItem); |
|
268 |
|
269 public: |
|
270 inline static TInt ShadowHeight(); |
|
271 private: |
|
272 /** Defines types of constant setting relevant to LAFs. */ |
|
273 enum TConstantType |
|
274 { |
|
275 /** Window shadow height. */ |
|
276 EShadowHeight |
|
277 }; |
|
278 private: |
|
279 /** Gets the value for a specified constant setting. |
|
280 |
|
281 @param aConstant Type of constant setting to get |
|
282 @return Value for the constant setting */ |
|
283 IMPORT_C static TInt Constant(TConstantType aConstant); |
|
284 }; |
|
285 |
|
286 // identifiers for legacy system fonts |
|
287 |
|
288 /** UID for the system "normal" font. |
|
289 |
|
290 @see TLogicalFont::iFontId |
|
291 @publishedPartner |
|
292 @released */ |
|
293 #define KLafUidNormalFontVal 0x10005F02 |
|
294 |
|
295 /** UID for the system "title" font. |
|
296 |
|
297 @see TLogicalFont::iFontId |
|
298 @publishedPartner |
|
299 @released */ |
|
300 #define KLafUidTitleFontVal 0x10005F03 |
|
301 |
|
302 /** UID for the system "annotation" font. |
|
303 |
|
304 @see TLogicalFont::iFontId |
|
305 @publishedPartner |
|
306 @released */ |
|
307 #define KLafUidAnnotationFontVal 0x10005F04 |
|
308 |
|
309 /** UID for the system "legend" font. |
|
310 |
|
311 @see TLogicalFont::iFontId |
|
312 @publishedPartner |
|
313 @released */ |
|
314 #define KLafUidLegendFontVal 0x10005F05 |
|
315 |
|
316 /** UID for the system "symbol" font. |
|
317 |
|
318 @see TLogicalFont::iFontId |
|
319 @publishedPartner |
|
320 @released */ |
|
321 #define KLafUidSymbolFontVal 0x10005F06 |
|
322 |
|
323 /** UID for the system "dense" font. |
|
324 |
|
325 @see TLogicalFont::iFontId |
|
326 @publishedPartner |
|
327 @released */ |
|
328 #define KLafUidDenseFontVal 0x10005F07 |
|
329 |
|
330 // identifiers for legacy system bitmaps |
|
331 /** UID for a textured block system bitmap. |
|
332 |
|
333 @see LafEnv::MatchBitmap() |
|
334 @publishedPartner |
|
335 @released */ |
|
336 #define KLafUidEikonTexturedVal 0x100048F4 |
|
337 |
|
338 /** UID for a gray block system bitmap. |
|
339 |
|
340 @see LafEnv::MatchBitmap() |
|
341 @publishedPartner |
|
342 @released */ |
|
343 #define KLafUidEikonGrayVal 0x100048F5 |
|
344 |
|
345 /** UID for a horizontal option button system bitmap. |
|
346 |
|
347 @see LafEnv::MatchBitmap() |
|
348 @publishedPartner |
|
349 @released */ |
|
350 #define KLafUidEikonOptiVal 0x100048F6 |
|
351 |
|
352 /** UID for a highlighted horizontal option button system bitmap. |
|
353 |
|
354 @see LafEnv::MatchBitmap() |
|
355 @publishedPartner |
|
356 @released */ |
|
357 #define KLafUidEikonOptihVal 0x100048F7 |
|
358 |
|
359 /** UID for a horizontal option button mask system bitmap. |
|
360 |
|
361 @see LafEnv::MatchBitmap() |
|
362 @publishedPartner |
|
363 @released */ |
|
364 #define KLafUidEikonOptimVal 0x100048F8 |
|
365 |
|
366 // Inlines |
|
367 |
|
368 inline TInt LafEnv::ShadowHeight() |
|
369 /** Gets the height of shadows to apply to windows. |
|
370 |
|
371 @return Shadow height. */ |
|
372 {//static |
|
373 return Constant(EShadowHeight); |
|
374 } |
|
375 |
|
376 #endif |