epoc32/include/uiklaf/private/lafenv.h
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/uiklaf/private/lafenv.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,376 @@
     1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// 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
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef __LAFENV_H__
    1.20 +#define __LAFENV_H__
    1.21 +
    1.22 +#include <e32std.h>
    1.23 +#include <e32base.h>
    1.24 +#include <gulbordr.h>
    1.25 +#include <gulalign.h>
    1.26 +#include <lafmain.h>
    1.27 +#include <apgcli.h>
    1.28 +#include <eikinfomsgwin.h>
    1.29 +#include <eikbusymsgwin.h>
    1.30 +#include <eikmsg.h>
    1.31 +
    1.32 +class MParser;
    1.33 +class CCoeEnv;
    1.34 +class CFont;
    1.35 +class TLogicalFont;
    1.36 +class CLafSystemFont;
    1.37 +
    1.38 +class LafEnv
    1.39 +/** Application environment level LAF functions.
    1.40 +
    1.41 +@publishedPartner 
    1.42 +@released */
    1.43 +	{
    1.44 +public:
    1.45 +	/** Creates an EText parser.
    1.46 +	
    1.47 +	@param aIndex Index of parser to retrieve. A LAF can supply multiple parsers, 
    1.48 +	indexed from 0.
    1.49 +	@return EText parser */
    1.50 +	IMPORT_C static MParser* CreateTextParserL(TInt aIndex);
    1.51 +	/** Draws a logical border.
    1.52 +	
    1.53 +	@param aBorder Border specification to draw
    1.54 +	@param aGc Graphics context to which to draw
    1.55 +	@param aRect Drawing rectangle
    1.56 +	@param aBorderColors Colours with which to draw */
    1.57 +	IMPORT_C static void DrawLogicalBorder(const TGulBorder& aBorder,CGraphicsContext& aGc,const TRect& aRect,const TGulBorder::TColors& aBorderColors);
    1.58 +	/** Gets the margins of a specified logical border.
    1.59 +	
    1.60 +	@param aBorder Border specification
    1.61 +	@return Border's margins */
    1.62 +	IMPORT_C static TMargins LogicalBorderMargins(const TGulBorder& aBorder);
    1.63 +	/** Populates an array with a set of system bitmaps.
    1.64 +	
    1.65 +	CEikonEnv calls this to get system bitmaps, and uses the array in subsequent 
    1.66 +	calls to MatchBitmap().
    1.67 +	
    1.68 +	@param aEnv Application's control environment
    1.69 +	@param aBitmaps On return, array of system bitmaps */
    1.70 +	IMPORT_C static void CreateSystemBitmapsL(CCoeEnv& aEnv, CArrayPtrFlat<CFbsBitmap>& aBitmaps);
    1.71 +	/** Populates an array with a set of system fonts.
    1.72 +	
    1.73 +	CEikonEnv calls this to get system fonts, and uses the array in subsequent 
    1.74 +	calls to MatchFont().
    1.75 +	
    1.76 +	A minimum of one font must be created. 
    1.77 +	
    1.78 +	@param aEnv Application's control environment
    1.79 +	@param aFonts On return, array of system fonts */
    1.80 +	IMPORT_C static void CreateSystemFontsL(CCoeEnv& aEnv,CArrayPtr<CLafSystemFont>& aFonts);
    1.81 +	/** Gets the nearest match in the specified fonts for a specified logical system 
    1.82 +	font.
    1.83 +	
    1.84 +	The return value must be non-NULL.
    1.85 +	
    1.86 +	@param aFonts Fonts from which to select the match
    1.87 +	@param aLogicalFont The logical font to match
    1.88 +	@return Font that is the best match to aLogicalFont */
    1.89 +	IMPORT_C static const CFont* MatchFont(CArrayPtr<CLafSystemFont>& aFonts,const TLogicalFont& aLogicalFont);
    1.90 +	/** Gets the nearest match in the specified bitmaps for a specified system bitmap 
    1.91 +	type.
    1.92 +	
    1.93 +	The desired bitmap is specified by the identifer aBmpUid: for possible UIDs, 
    1.94 +	see KLafUidEikonTexturedVal etc.
    1.95 +	
    1.96 +	The return value must be non-NULL.
    1.97 +	
    1.98 +	@param aSystemBmps Bitmaps from which to select the match
    1.99 +	@param aBmpUid The bitmap type to match
   1.100 +	@return Bitmap that is the best match to aBmpUid */
   1.101 +	IMPORT_C static CFbsBitmap* MatchBitmap(const CArrayPtrFlat<CFbsBitmap>& aSystemBmps, TUid aBmpUid);
   1.102 +	/** Gets the corner of the screen which the busy message should appear in by default 
   1.103 +	on the device. 
   1.104 +	
   1.105 +	@return Default corner
   1.106 +	@see CEikonEnv::BusyMsgL() */
   1.107 +	IMPORT_C static TGulAlignment DefaultBusyMsgCorner();
   1.108 +	/** Tests if the specified key corresponds to the hardware default key.
   1.109 +	
   1.110 +	@param aCharCode Key to test
   1.111 +	@return True if the key is the default */
   1.112 +	IMPORT_C static TBool IsDefaultKey(TUint aCharCode);
   1.113 +	/** Gets the default line spacing used to format text paragraphs.
   1.114 +	
   1.115 +	@return Default line spacing in twips */
   1.116 +	IMPORT_C static TInt DefaultLineSpacingInTwips();
   1.117 +	/** Gets the height of single-line edit control for the system normal font.
   1.118 +	
   1.119 +	@param aLafEnv Environment access
   1.120 +	@return Height of single-line edit control */
   1.121 +	IMPORT_C static TInt EditableControlStandardHeight(const MLafEnv& aLafEnv);
   1.122 +	/** Sets any device-specific font attributes to be applied to the system character 
   1.123 +	formatting layer.
   1.124 +	
   1.125 +	Applications can access the format layer through CEikonEnv::SystemCharFormatLayerL(). 
   1.126 +	This format layer is also used in Edwins.
   1.127 +	
   1.128 +	@param aCharFormat On return, the character formatting to apply
   1.129 +	@param aCharFormatMask On return, the character formatting mask to apply */
   1.130 +	IMPORT_C static void PrepareCharFormatAndMask(TCharFormat& aCharFormat,TCharFormatMask& aCharFormatMask);
   1.131 +	/** Specifies (and creates if necessary) a default directory for documents.
   1.132 +	
   1.133 +	The function is called on application startup. The parameters provided are 
   1.134 +	to allow an implementation to generate a document directory based on the application 
   1.135 +	being launched.
   1.136 +	
   1.137 +	@param aFilePath On return, the default / generated directory path
   1.138 +	@param aAppUid UID of application being launched
   1.139 +	@param aLs Application's session with the Application Architecture server
   1.140 +	@param aEnv Thread's control environment */
   1.141 +	IMPORT_C static void GetDefaultPath(TDes& aFilePath,TUid aAppUid,RApaLsSession& aLs,CCoeEnv& aEnv);
   1.142 +	/** Loads the system resource file.
   1.143 +	
   1.144 +	The system resource file defines resources required by the system environment, 
   1.145 +	and which can also be used by applications. The function is called by CCoeEnv's 
   1.146 +	construction function.
   1.147 +	
   1.148 +	@param aEnv Thread's control environment
   1.149 +	@return System wide error code */
   1.150 +	IMPORT_C static TInt LoadCoreResFileL(CCoeEnv& aEnv);
   1.151 +	/** Loads the private resource file.
   1.152 +	
   1.153 +	The private resource file defines resources required by the system environment, 
   1.154 +	but not intended for application use. The function is called by CCoeEnv's 
   1.155 +	construction function.
   1.156 +	
   1.157 +	@param aEnv Thread's control environment
   1.158 +	@return System wide error code */
   1.159 +	IMPORT_C static TInt LoadPrivResFileL(CCoeEnv& aEnv);
   1.160 +	/** Gets the name of the resource file that contains resources for the EIKCOCTL 
   1.161 +	component.
   1.162 +	
   1.163 +	@return Resource file for the EIKCOCTL component */
   1.164 +	IMPORT_C static const TDesC& CoctlResourceFile();
   1.165 +	/** Allows the LAF to update the list of system bitmaps, in response to a colour 
   1.166 +	settings change.
   1.167 +	
   1.168 +	@param aEnv Thread's control environment
   1.169 +	@param aBitmaps On return, updated array of system bitmaps
   1.170 +	@param aColorList New colour settings */
   1.171 +	IMPORT_C static void UpdateSystemBitmapsL(CCoeEnv& aEnv, CArrayPtrFlat<CFbsBitmap>& aBitmaps, const CColorList& aColorList);
   1.172 +	
   1.173 +	/**	Performs the releasing of the fonts but doesn't delete the array itself
   1.174 +	
   1.175 +	@param aSystemFontArray array of fonts to release
   1.176 +	*/
   1.177 +	IMPORT_C static void ReleaseSystemFonts( CArrayPtr<CLafSystemFont>& aSystemFontArray);
   1.178 +	
   1.179 +	/** Creates busy message window.
   1.180 +	
   1.181 +	@param aEnv Thread's control environment
   1.182 +	@return Busy message window */
   1.183 +	IMPORT_C static MEikBusyMsgWin* NewBusyMsgWinL(CCoeEnv& aEnv);
   1.184 +	/** Creates info message window.
   1.185 +	
   1.186 +	@param aEnv Thread's control environment
   1.187 +	@return Info message window */
   1.188 +	IMPORT_C static MEikInfoMsgWin* NewInfoMsgWinL(CCoeEnv& aEnv);
   1.189 +		
   1.190 +	/** Creates info message window, overridden function to allow another RWindowGroup to be
   1.191 +	used rather the the the CCoeEnv's RootWin() function.
   1.192 +		
   1.193 +	@param aEnv Thread's control environment
   1.194 +	@param aWinGroup window group for displaying the Info Msg
   1.195 +	@return Info message window */
   1.196 +    	IMPORT_C static MEikInfoMsgWin* NewInfoMsgWinL(CCoeEnv& aEnv, RWindowGroup& aWinGroup);
   1.197 +	/** Asks if display of the task list is disabled during initialization
   1.198 +
   1.199 +	@return ETrue if task list is disabled, otherwise EFalse */
   1.200 +	IMPORT_C static TBool IsTaskListDisabledAtInitialization();
   1.201 +	/** Displays a one or two line alert as a notifier window customisable by the system GUI.
   1.202 +
   1.203 +	@param aMsg1 Line one of the message to be displayed.
   1.204 +	@param aMsg2 Line two of the message to be displayed */
   1.205 +	IMPORT_C static void DisplayAlertAsNotifier(const TDesC& aMsg1, const TDesC& aMsg2);
   1.206 +	
   1.207 +	/** Updates an existing color list
   1.208 +	
   1.209 +	@param aColorList The color list to be updated. */
   1.210 +	IMPORT_C static void UpdateColorListL(CColorList* aColorList);
   1.211 +	
   1.212 +	/** Plays an audible alert, if supported by the system GUI. */
   1.213 +	IMPORT_C static void Beep();
   1.214 +	
   1.215 +	/** Updates an existing array of system fonts.
   1.216 +	
   1.217 +	@param aEnv Thread's control environment
   1.218 +	@param aSystemFontArray The array of fonts to be updated */
   1.219 +	IMPORT_C static void UpdateSystemFontsL(CCoeEnv* aEnv, CArrayPtr<CLafSystemFont>& aSystemFontArray);
   1.220 +
   1.221 +	/** A list of events that are handled by the HandleExtensionEventL() function.*/
   1.222 +	enum TLafEnvExtensionEvent 
   1.223 +        {
   1.224 +        /** Event sent in CEikonEnv::ConstructL right before CCoeEnv::ConstructL() */
   1.225 +        ELafEnvPreCoeEnvConstructL,
   1.226 +        /** Event sent in CEikonEnv::ConstructL right after CCoeEnv::ConstructL() */
   1.227 +        ELafEnvPostCoeEnvConstructL
   1.228 +        };
   1.229 +	
   1.230 +	/** Handles events listed by TLafEnvExtensionEvent
   1.231 +	@param aEnv The instance of CEikonEnv from which this function has been called
   1.232 +	@param aEvent The event
   1.233 +	*/
   1.234 +	IMPORT_C static void HandleExtensionEventL(CEikonEnv& aEnv, TLafEnvExtensionEvent aEvent);
   1.235 +	
   1.236 +    /** Allows debug keys to display output.
   1.237 +    @param aResourceId The resource to use for the note
   1.238 +    */
   1.239 +    IMPORT_C static void InfoNote(TInt aResourceId,...);
   1.240 +
   1.241 +	/** Creates a default system colour list. 
   1.242 +	@param aEnv The instance of CEikonEnv from which this function has been called
   1.243 +	@return A list of colours
   1.244 +	*/
   1.245 +	IMPORT_C static CColorList* CreateColorListL(CEikonEnv& aEnv);
   1.246 +	
   1.247 +	/** Gets the name of the clock DLL
   1.248 +	@return The name of the clock DLL
   1.249 +	*/
   1.250 +	IMPORT_C static const TDesC& ClockDllName();
   1.251 +
   1.252 +	/** The behaviour of CEikonEnv can be customized. This enum lists
   1.253 +	the things that can be customized. */
   1.254 +	enum TLafEnvPolicyItem
   1.255 +        {
   1.256 +        /** The action to take when there is an error during startup. */
   1.257 +        ELafEnvPolicyExitIfErrorDuringStartup,
   1.258 +        /** The action to take when the document is corrupt. */
   1.259 +        ELafEnvPolicyDeleteCorruptDocumentAndContinue,
   1.260 +        /** This affects the way the environment is deleted. */
   1.261 +        ELAfEnvPolicyDeferredEnvironmentDeletion,
   1.262 +        };
   1.263 +
   1.264 +	/** CEikonEnv will use this function to find out how it should behave.
   1.265 +	The list of things that can be customized this way are listed by 
   1.266 +	TLafEnvPolicyItem.
   1.267 +	@param aItem The policy item.
   1.268 +	@return An integer that indicates what the action should be.
   1.269 +	*/
   1.270 +    IMPORT_C static TInt PolicyItem(TLafEnvPolicyItem aItem);
   1.271 +
   1.272 +public:
   1.273 +	inline static TInt ShadowHeight();
   1.274 +private:
   1.275 +	/** Defines types of constant setting relevant to LAFs. */
   1.276 +	enum TConstantType
   1.277 +		{
   1.278 +		/** Window shadow height. */
   1.279 +		EShadowHeight
   1.280 +		};
   1.281 +private:
   1.282 +	/** Gets the value for a specified constant setting.
   1.283 +	
   1.284 +	@param aConstant Type of constant setting to get
   1.285 +	@return Value for the constant setting */
   1.286 +	IMPORT_C static TInt Constant(TConstantType aConstant);
   1.287 +	};
   1.288 +
   1.289 +// identifiers for legacy system fonts
   1.290 +
   1.291 +/** UID for the system "normal" font.
   1.292 +
   1.293 +@see TLogicalFont::iFontId 
   1.294 +@publishedPartner 
   1.295 +@released */
   1.296 +#define KLafUidNormalFontVal		0x10005F02
   1.297 +
   1.298 +/** UID for the system "title" font.
   1.299 +
   1.300 +@see TLogicalFont::iFontId 
   1.301 +@publishedPartner 
   1.302 +@released */
   1.303 +#define KLafUidTitleFontVal			0x10005F03
   1.304 +
   1.305 +/** UID for the system "annotation" font.
   1.306 +
   1.307 +@see TLogicalFont::iFontId 
   1.308 +@publishedPartner 
   1.309 +@released */
   1.310 +#define KLafUidAnnotationFontVal	0x10005F04
   1.311 +
   1.312 +/** UID for the system "legend" font.
   1.313 +
   1.314 +@see TLogicalFont::iFontId 
   1.315 +@publishedPartner 
   1.316 +@released */
   1.317 +#define KLafUidLegendFontVal		0x10005F05
   1.318 +
   1.319 +/** UID for the system "symbol" font.
   1.320 +
   1.321 +@see TLogicalFont::iFontId 
   1.322 +@publishedPartner 
   1.323 +@released */
   1.324 +#define KLafUidSymbolFontVal		0x10005F06
   1.325 +
   1.326 +/** UID for the system "dense" font.
   1.327 +
   1.328 +@see TLogicalFont::iFontId 
   1.329 +@publishedPartner 
   1.330 +@released */
   1.331 +#define KLafUidDenseFontVal			0x10005F07
   1.332 +
   1.333 +// identifiers for legacy system bitmaps
   1.334 +/** UID for a textured block system bitmap.
   1.335 +
   1.336 +@see LafEnv::MatchBitmap() 
   1.337 +@publishedPartner 
   1.338 +@released */
   1.339 +#define KLafUidEikonTexturedVal		0x100048F4
   1.340 +
   1.341 +/** UID for a gray block system bitmap.
   1.342 +
   1.343 +@see LafEnv::MatchBitmap() 
   1.344 +@publishedPartner 
   1.345 +@released */
   1.346 +#define KLafUidEikonGrayVal			0x100048F5
   1.347 +
   1.348 +/** UID for a horizontal option button system bitmap.
   1.349 +
   1.350 +@see LafEnv::MatchBitmap() 
   1.351 +@publishedPartner 
   1.352 +@released */
   1.353 +#define KLafUidEikonOptiVal			0x100048F6
   1.354 +
   1.355 +/** UID for a highlighted horizontal option button system bitmap.
   1.356 +
   1.357 +@see LafEnv::MatchBitmap() 
   1.358 +@publishedPartner 
   1.359 +@released */
   1.360 +#define KLafUidEikonOptihVal		0x100048F7
   1.361 +
   1.362 +/** UID for a horizontal option button mask system bitmap.
   1.363 +
   1.364 +@see LafEnv::MatchBitmap() 
   1.365 +@publishedPartner 
   1.366 +@released */
   1.367 +#define KLafUidEikonOptimVal		0x100048F8
   1.368 +
   1.369 +// Inlines
   1.370 +
   1.371 +inline TInt LafEnv::ShadowHeight()
   1.372 +/** Gets the height of shadows to apply to windows. 
   1.373 +
   1.374 +@return Shadow height. */
   1.375 +	{//static
   1.376 +	return Constant(EShadowHeight);
   1.377 +	}
   1.378 +
   1.379 +#endif