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.
25 #include <eikinfomsgwin.h>
26 #include <eikbusymsgwin.h>
36 /** Application environment level LAF functions.
42 /** Creates an EText parser.
44 @param aIndex Index of parser to retrieve. A LAF can supply multiple parsers,
46 @return EText parser */
47 IMPORT_C static MParser* CreateTextParserL(TInt aIndex);
48 /** Draws a logical border.
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.
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.
62 CEikonEnv calls this to get system bitmaps, and uses the array in subsequent
63 calls to MatchBitmap().
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.
70 CEikonEnv calls this to get system fonts, and uses the array in subsequent
73 A minimum of one font must be created.
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
81 The return value must be non-NULL.
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
90 The desired bitmap is specified by the identifer aBmpUid: for possible UIDs,
91 see KLafUidEikonTexturedVal etc.
93 The return value must be non-NULL.
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
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.
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.
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.
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
122 Applications can access the format layer through CEikonEnv::SystemCharFormatLayerL().
123 This format layer is also used in Edwins.
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.
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
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.
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.
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.
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.
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
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
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);
170 /** Performs the releasing of the fonts but doesn't delete the array itself
172 @param aSystemFontArray array of fonts to release
174 IMPORT_C static void ReleaseSystemFonts( CArrayPtr<CLafSystemFont>& aSystemFontArray);
176 /** Creates busy message window.
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.
183 @param aEnv Thread's control environment
184 @return Info message window */
185 IMPORT_C static MEikInfoMsgWin* NewInfoMsgWinL(CCoeEnv& aEnv);
187 /** Creates info message window, overridden function to allow another RWindowGroup to be
188 used rather the the the CCoeEnv's RootWin() function.
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
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.
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);
204 /** Updates an existing color list
206 @param aColorList The color list to be updated. */
207 IMPORT_C static void UpdateColorListL(CColorList* aColorList);
209 /** Plays an audible alert, if supported by the system GUI. */
210 IMPORT_C static void Beep();
212 /** Updates an existing array of system fonts.
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);
218 /** A list of events that are handled by the HandleExtensionEventL() function.*/
219 enum TLafEnvExtensionEvent
221 /** Event sent in CEikonEnv::ConstructL right before CCoeEnv::ConstructL() */
222 ELafEnvPreCoeEnvConstructL,
223 /** Event sent in CEikonEnv::ConstructL right after CCoeEnv::ConstructL() */
224 ELafEnvPostCoeEnvConstructL
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
231 IMPORT_C static void HandleExtensionEventL(CEikonEnv& aEnv, TLafEnvExtensionEvent aEvent);
233 /** Allows debug keys to display output.
234 @param aResourceId The resource to use for the note
236 IMPORT_C static void InfoNote(TInt aResourceId,...);
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
242 IMPORT_C static CColorList* CreateColorListL(CEikonEnv& aEnv);
244 /** Gets the name of the clock DLL
245 @return The name of the clock DLL
247 IMPORT_C static const TDesC& ClockDllName();
249 /** The behaviour of CEikonEnv can be customized. This enum lists
250 the things that can be customized. */
251 enum TLafEnvPolicyItem
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,
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
264 @param aItem The policy item.
265 @return An integer that indicates what the action should be.
267 IMPORT_C static TInt PolicyItem(TLafEnvPolicyItem aItem);
270 inline static TInt ShadowHeight();
272 /** Defines types of constant setting relevant to LAFs. */
275 /** Window shadow height. */
279 /** Gets the value for a specified constant setting.
281 @param aConstant Type of constant setting to get
282 @return Value for the constant setting */
283 IMPORT_C static TInt Constant(TConstantType aConstant);
286 // identifiers for legacy system fonts
288 /** UID for the system "normal" font.
290 @see TLogicalFont::iFontId
293 #define KLafUidNormalFontVal 0x10005F02
295 /** UID for the system "title" font.
297 @see TLogicalFont::iFontId
300 #define KLafUidTitleFontVal 0x10005F03
302 /** UID for the system "annotation" font.
304 @see TLogicalFont::iFontId
307 #define KLafUidAnnotationFontVal 0x10005F04
309 /** UID for the system "legend" font.
311 @see TLogicalFont::iFontId
314 #define KLafUidLegendFontVal 0x10005F05
316 /** UID for the system "symbol" font.
318 @see TLogicalFont::iFontId
321 #define KLafUidSymbolFontVal 0x10005F06
323 /** UID for the system "dense" font.
325 @see TLogicalFont::iFontId
328 #define KLafUidDenseFontVal 0x10005F07
330 // identifiers for legacy system bitmaps
331 /** UID for a textured block system bitmap.
333 @see LafEnv::MatchBitmap()
336 #define KLafUidEikonTexturedVal 0x100048F4
338 /** UID for a gray block system bitmap.
340 @see LafEnv::MatchBitmap()
343 #define KLafUidEikonGrayVal 0x100048F5
345 /** UID for a horizontal option button system bitmap.
347 @see LafEnv::MatchBitmap()
350 #define KLafUidEikonOptiVal 0x100048F6
352 /** UID for a highlighted horizontal option button system bitmap.
354 @see LafEnv::MatchBitmap()
357 #define KLafUidEikonOptihVal 0x100048F7
359 /** UID for a horizontal option button mask system bitmap.
361 @see LafEnv::MatchBitmap()
364 #define KLafUidEikonOptimVal 0x100048F8
368 inline TInt LafEnv::ShadowHeight()
369 /** Gets the height of shadows to apply to windows.
371 @return Shadow height. */
373 return Constant(EShadowHeight);