epoc32/include/lafmain.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
     1.1 --- a/epoc32/include/lafmain.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/lafmain.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,266 @@
     1.4 -lafmain.h
     1.5 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +// All rights reserved.
     1.7 +// This component and the accompanying materials are made available
     1.8 +// 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.9 +// which accompanies this distribution, and is available
    1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +//
    1.12 +// Initial Contributors:
    1.13 +// Nokia Corporation - initial contribution.
    1.14 +//
    1.15 +// Contributors:
    1.16 +//
    1.17 +// Description:
    1.18 +//
    1.19 +
    1.20 +#ifndef __LAFMAIN_H__
    1.21 +#define __LAFMAIN_H__
    1.22 +
    1.23 +#include <e32std.h>
    1.24 +#include <e32base.h>
    1.25 +#include <gulbordr.h>
    1.26 +#include <gulcolor.h>
    1.27 +#include <frmtlay.h>
    1.28 +
    1.29 +class CCoeControl;
    1.30 +class CFont;
    1.31 +class TLogicalFont;
    1.32 +class MLafEnv;
    1.33 +
    1.34 +
    1.35 +class CLafEdwinCustomDrawBase : public CBase, public MFormCustomDraw
    1.36 +/** LAF support for custom drawing of Edwins.
    1.37 +
    1.38 +This class is used by CEikEdwin to draw lines in plain text editors. It does 
    1.39 +not work in rich text editors, as it assumes the line spacing is constant.
    1.40 +
    1.41 +The custom drawing interface is defined by the MFormCustomDraw class. 
    1.42 +
    1.43 +@publishedPartner
    1.44 +@released */
    1.45 +	{
    1.46 +public:
    1.47 +	/** Allocates and constructs the custom drawer.
    1.48 +	
    1.49 +	@param aEnv LAF environment functions
    1.50 +	@param aControl The Edwin control
    1.51 +	@return New custom drawer */
    1.52 +	IMPORT_C static CLafEdwinCustomDrawBase* NewL(const MLafEnv& aEnv,const CCoeControl& aControl);
    1.53 +public: // from MFormCustomDraw
    1.54 +	/** Implements MFormCustomDraw::DrawBackground() to draw the Edwin background. 
    1.55 +	
    1.56 +	See that function for a full description.
    1.57 +	
    1.58 +	@param aParam Drawing parameters
    1.59 +	@param aBackground Default background colour
    1.60 +	@param aDrawn On return, the rectangle to which the function has drawn */
    1.61 +	IMPORT_C void DrawBackground(const TParam& aParam,const TRgb& aBackground,TRect& aDrawn) const;
    1.62 +	/** Gets the physical colour that maps to a specified logical colour.
    1.63 +	
    1.64 +	@param aColorIndex Logical colour
    1.65 +	@param aDefaultColor The default physical colour. This is the colour to be 
    1.66 +	used if no translation is performed. This allows translation to change certain 
    1.67 +	indices but not others ( by passing the default colour back unchanged).
    1.68 +	@return Physical colour */
    1.69 +	IMPORT_C TRgb SystemColor(TUint aColorIndex,TRgb aDefaultColor) const;
    1.70 +public:
    1.71 +	/** Notifies the drawer that a MEikEdwinObserver::EEventFormatChanged event has 
    1.72 +	occurred for the Edwin. */
    1.73 +	IMPORT_C virtual void LineSpacingChanged();
    1.74 +protected:
    1.75 +	/** Constructor that initialises data members.
    1.76 +	
    1.77 +	@param aEnv LAF environment functions
    1.78 +	@param aControl The Edwin control */
    1.79 +	IMPORT_C CLafEdwinCustomDrawBase(const MLafEnv& aEnv,const CCoeControl& aControl);
    1.80 +protected:
    1.81 +	/** LAF environment functions
    1.82 +	
    1.83 +	This is initialised by the constructor. */
    1.84 +	const MLafEnv& iEnv;
    1.85 +	/** The Edwin control. 
    1.86 +	
    1.87 +	This is initialised by the constructor. */
    1.88 +	const CCoeControl& iControl;
    1.89 +private:
    1.90 +	/** Unused. */
    1.91 +	TInt iSpare;
    1.92 +	};
    1.93 +
    1.94 +
    1.95 +class CLafEdwinCustomWrapBase : public CBase, public MFormCustomWrap
    1.96 +/** LAF support for custom line breaking in Edwins.
    1.97 +
    1.98 +This class is used by CEikEdwin to determine how to place line breaks.
    1.99 +
   1.100 +The custom line breaking interface is defined by the MFormCustomWrap class. 
   1.101 +
   1.102 +@publishedPartner
   1.103 +@released */
   1.104 +	{
   1.105 +public:
   1.106 +	/** Allocates and constructs the custom line breaker.
   1.107 +	
   1.108 +	@param aControl The Edwin control
   1.109 +	@return The new line breaker */
   1.110 +	IMPORT_C static CLafEdwinCustomWrapBase* NewL(const CCoeControl& aControl);
   1.111 +	/** Destructor. */
   1.112 +	IMPORT_C ~CLafEdwinCustomWrapBase();
   1.113 +public: // from MFormCustomWrap
   1.114 +	/** Gets the line break class for a Unicode character.
   1.115 +	
   1.116 +	This implements MFormCustomWrap::LineBreakClass().
   1.117 +	
   1.118 +	@param aCode The Unicode character code
   1.119 +	@param aRangeStart On return, contains the Unicode character code at the start 
   1.120 +	of the range including aCode that shares the same line break class as aCode.
   1.121 +	@param aRangeEnd On return, contains the Unicode character code at the end 
   1.122 +	of the range including aCode that shares the same line break class as aCode
   1.123 +	@return The line break class assigned to the character. Line break classes 
   1.124 +	are enumerated with MTmCustom::EOpLineBreakClass etc. */
   1.125 +	IMPORT_C TUint LineBreakClass(TUint aCode,TUint& aRangeStart,TUint& aRangeEnd) const;
   1.126 +	/** Tests whether a line break is possible between two characters.
   1.127 +	
   1.128 +	This implements MFormCustomWrap::LineBreakPossible().
   1.129 +	
   1.130 +	@param aPrevClass The line break class of the previous non-space character. 
   1.131 +	@param aNextClass The line break class of the next non-space character. 
   1.132 +	@param aHaveSpaces True if there are one or more space characters (with a line 
   1.133 +	break class of MTmCustom::ESpLineBreakClass) between aPrevClass and aNextClass; 
   1.134 +	false if not.
   1.135 +	@return ool True if a line break is possible between characters with the two 
   1.136 +	line break classes, false if not */
   1.137 +	IMPORT_C TBool LineBreakPossible(TUint aPrevClass,TUint aNextClass,TBool aHaveSpaces) const;
   1.138 +	/** Gets the position of the first or last possible line break position in a text 
   1.139 +	string.
   1.140 +	
   1.141 +	This implements MFormCustomWrap::GetLineBreakInContext().
   1.142 +	
   1.143 +	@param aText A string containing characters of class MTmCustom::ESaLineBreakClass. 
   1.144 +	
   1.145 +	@param aMinBreakPos A position within aText at which to begin searching for 
   1.146 +	a possible line break position. 
   1.147 +	@param aMaxBreakPos A position within aText at which to stop searching for 
   1.148 +	a possible line break position. 
   1.149 +	@param aForwards If ETrue, the function gets the first possible line break 
   1.150 +	position (searches forwards from aMinBreakPos); if EFalse, gets the last one 
   1.151 +	(searches backwards from aMaxBreakPos). 
   1.152 +	@param aBreakPos On return, the position of the first or last possible line 
   1.153 +	break within aText. This must be greater than zero and less than aText.Length() 
   1.154 +	- 1, and must also be in the range aMinBreakPos to aMaxBreakPos. 
   1.155 +	@return True if a possible line break position is found, false if not */
   1.156 +	IMPORT_C TBool GetLineBreakInContext(const TDesC& aText,TInt aMinBreakPos,TInt aMaxBreakPos,TBool aForwards,TInt& aBreakPos) const;
   1.157 +	/** Tests whether a character can overhang the right margin.
   1.158 +	
   1.159 +	@param aChar The Unicode character code of interest
   1.160 +	@return True if the character specified can overhang the right margin, false 
   1.161 +	if not */
   1.162 +	IMPORT_C TBool IsHangingCharacter(TUint aChar) const;
   1.163 +private:
   1.164 +	/** Unused. */
   1.165 +	IMPORT_C void MFormCustomWrap_Reserved_1();
   1.166 +	/** Unused. */
   1.167 +	IMPORT_C void MFormCustomWrap_Reserved_2();	
   1.168 +
   1.169 +protected:
   1.170 +	/** Constructor.
   1.171 +	
   1.172 +	@param aControl The Edwin control */
   1.173 +	IMPORT_C CLafEdwinCustomWrapBase(const CCoeControl& aControl);
   1.174 +protected:	
   1.175 +	/** The Edwin control, initialised by the constructor. */
   1.176 +	const CCoeControl& iControl;
   1.177 +private:
   1.178 +	/** Unused. */
   1.179 +	TInt iSpare;
   1.180 +	};
   1.181 +
   1.182 +class MLafEnv
   1.183 +/** LAF interface to access the current system environment settings.
   1.184 +
   1.185 +It is implemented by the Uikon Core, and effectively allows the LAF 
   1.186 +limited access to the current thread's CEikonEnv.
   1.187 +
   1.188 +@publishedPartner 
   1.189 +@released 
   1.190 +*/
   1.191 +//@publishedAll @deprecated
   1.192 +	{
   1.193 +public:
   1.194 +	/** Gets the environment's nearest match to the specified logical font.
   1.195 +
   1.196 +	The return value is never NULL.
   1.197 +
   1.198 +	@param aLogicalFont Logical font to match.
   1.199 +	@return The font that most closely matches aLogicalFont. */
   1.200 +	virtual const CFont* Font(const TLogicalFont& aLogicalFont) const=0;
   1.201 +
   1.202 +	/** Gets an environment bitmap specified by UID. 
   1.203 +
   1.204 +	@param aBmpUid The UID of the bitmap to retrieve.
   1.205 +	@return The bitmap. */
   1.206 +	virtual const CFbsBitmap* Bitmap(TUid aBmpUid) const=0;
   1.207 +
   1.208 +	/** Gets the physical (TRgb) colour that corresponds to the specified 
   1.209 +	logical colour, for a specified control.
   1.210 +
   1.211 +	@param aLogicalColor Logical colour.
   1.212 +	@param aControl Control for which to get the mapping. Note controls can override 
   1.213 +	the system mappings.
   1.214 +	@return Physical colour. */
   1.215 +	virtual TRgb ControlColor(TLogicalColor aLogicalColor, const CCoeControl& aControl) const=0;
   1.216 +
   1.217 +	/** Gets the environment's physical (TRgb) colour that corresponds to 
   1.218 +	the specified logical colour.
   1.219 +
   1.220 +	@param aLogicalColor Logical colour.
   1.221 +	@param aColorListUid UID of the colour list from which to get the mapping. The default 
   1.222 +	value is the environment's list.
   1.223 +	@return Physical colour. */
   1.224 +	virtual TRgb Color(TLogicalColor aLogicalColor, TUid aColorListUid=KNullUid) const=0;
   1.225 +
   1.226 +	/** Gets the environment setting for the default display mode.
   1.227 +
   1.228 +	@return Display mode. */
   1.229 +	virtual TDisplayMode DefaultDisplayMode() const=0; 
   1.230 +	};
   1.231 +
   1.232 +class MLafClientRectResolver
   1.233 +/** Interface that works out how screen furniture reduces the available screen area 
   1.234 +for applications.
   1.235 +
   1.236 +The interface is implemented by the UI and can be called by the LAF to get information 
   1.237 +on the areas of screen furniture.
   1.238 +
   1.239 +@see LafAppUi::ClientRect() 
   1.240 +@publishedPartner
   1.241 +@released */
   1.242 +	{
   1.243 +public:
   1.244 +	/** Flags for types of screen furniture. */
   1.245 +	enum TScreenFurniture
   1.246 +		{ 
   1.247 +		/** Menu bar. */
   1.248 +		EMenuBar, 
   1.249 +		/** Button group. */
   1.250 +		EButtonGroup, 
   1.251 +		/** Tool band. */
   1.252 +		EToolBand, 
   1.253 +		/** Title band. */
   1.254 +		ETitleBand, 
   1.255 +		/** Status pane. */
   1.256 +		EStatusPane,
   1.257 +		/** Command Button Array */
   1.258 +		ECba
   1.259 +		};
   1.260 +public:
   1.261 +	/** Calculates how a specified type of screen furniture reduces the application 
   1.262 +	area of a specified screen rectangle. 
   1.263 +
   1.264 +	@param aScreenFurniture Type of screen furniture.
   1.265 +	@param aRect Screen rectangle from which to remove area of specified furniture. 
   1.266 +	On return, the modified rectangle. */
   1.267 +	virtual void ReduceRect(TScreenFurniture aScreenFurniture,TRect& aRect) const=0;
   1.268 +	};
   1.269 +
   1.270 +#endif //__LAFMAIN_H__