epoc32/include/lafmain.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 0 061f57f2323e
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
     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 __LAFMAIN_H__
    17 #define __LAFMAIN_H__
    18 
    19 #include <e32std.h>
    20 #include <e32base.h>
    21 #include <gulbordr.h>
    22 #include <gulcolor.h>
    23 #include <frmtlay.h>
    24 
    25 class CCoeControl;
    26 class CFont;
    27 class TLogicalFont;
    28 class MLafEnv;
    29 
    30 
    31 class CLafEdwinCustomDrawBase : public CBase, public MFormCustomDraw
    32 /** LAF support for custom drawing of Edwins.
    33 
    34 This class is used by CEikEdwin to draw lines in plain text editors. It does 
    35 not work in rich text editors, as it assumes the line spacing is constant.
    36 
    37 The custom drawing interface is defined by the MFormCustomDraw class. 
    38 
    39 @publishedPartner
    40 @released */
    41 	{
    42 public:
    43 	/** Allocates and constructs the custom drawer.
    44 	
    45 	@param aEnv LAF environment functions
    46 	@param aControl The Edwin control
    47 	@return New custom drawer */
    48 	IMPORT_C static CLafEdwinCustomDrawBase* NewL(const MLafEnv& aEnv,const CCoeControl& aControl);
    49 public: // from MFormCustomDraw
    50 	/** Implements MFormCustomDraw::DrawBackground() to draw the Edwin background. 
    51 	
    52 	See that function for a full description.
    53 	
    54 	@param aParam Drawing parameters
    55 	@param aBackground Default background colour
    56 	@param aDrawn On return, the rectangle to which the function has drawn */
    57 	IMPORT_C void DrawBackground(const TParam& aParam,const TRgb& aBackground,TRect& aDrawn) const;
    58 	/** Gets the physical colour that maps to a specified logical colour.
    59 	
    60 	@param aColorIndex Logical colour
    61 	@param aDefaultColor The default physical colour. This is the colour to be 
    62 	used if no translation is performed. This allows translation to change certain 
    63 	indices but not others ( by passing the default colour back unchanged).
    64 	@return Physical colour */
    65 	IMPORT_C TRgb SystemColor(TUint aColorIndex,TRgb aDefaultColor) const;
    66 public:
    67 	/** Notifies the drawer that a MEikEdwinObserver::EEventFormatChanged event has 
    68 	occurred for the Edwin. */
    69 	IMPORT_C virtual void LineSpacingChanged();
    70 protected:
    71 	/** Constructor that initialises data members.
    72 	
    73 	@param aEnv LAF environment functions
    74 	@param aControl The Edwin control */
    75 	IMPORT_C CLafEdwinCustomDrawBase(const MLafEnv& aEnv,const CCoeControl& aControl);
    76 protected:
    77 	/** LAF environment functions
    78 	
    79 	This is initialised by the constructor. */
    80 	const MLafEnv& iEnv;
    81 	/** The Edwin control. 
    82 	
    83 	This is initialised by the constructor. */
    84 	const CCoeControl& iControl;
    85 private:
    86 	/** Unused. */
    87 	TInt iSpare;
    88 	};
    89 
    90 
    91 class CLafEdwinCustomWrapBase : public CBase, public MFormCustomWrap
    92 /** LAF support for custom line breaking in Edwins.
    93 
    94 This class is used by CEikEdwin to determine how to place line breaks.
    95 
    96 The custom line breaking interface is defined by the MFormCustomWrap class. 
    97 
    98 @publishedPartner
    99 @released */
   100 	{
   101 public:
   102 	/** Allocates and constructs the custom line breaker.
   103 	
   104 	@param aControl The Edwin control
   105 	@return The new line breaker */
   106 	IMPORT_C static CLafEdwinCustomWrapBase* NewL(const CCoeControl& aControl);
   107 	/** Destructor. */
   108 	IMPORT_C ~CLafEdwinCustomWrapBase();
   109 public: // from MFormCustomWrap
   110 	/** Gets the line break class for a Unicode character.
   111 	
   112 	This implements MFormCustomWrap::LineBreakClass().
   113 	
   114 	@param aCode The Unicode character code
   115 	@param aRangeStart On return, contains the Unicode character code at the start 
   116 	of the range including aCode that shares the same line break class as aCode.
   117 	@param aRangeEnd On return, contains the Unicode character code at the end 
   118 	of the range including aCode that shares the same line break class as aCode
   119 	@return The line break class assigned to the character. Line break classes 
   120 	are enumerated with MTmCustom::EOpLineBreakClass etc. */
   121 	IMPORT_C TUint LineBreakClass(TUint aCode,TUint& aRangeStart,TUint& aRangeEnd) const;
   122 	/** Tests whether a line break is possible between two characters.
   123 	
   124 	This implements MFormCustomWrap::LineBreakPossible().
   125 	
   126 	@param aPrevClass The line break class of the previous non-space character. 
   127 	@param aNextClass The line break class of the next non-space character. 
   128 	@param aHaveSpaces True if there are one or more space characters (with a line 
   129 	break class of MTmCustom::ESpLineBreakClass) between aPrevClass and aNextClass; 
   130 	false if not.
   131 	@return ool True if a line break is possible between characters with the two 
   132 	line break classes, false if not */
   133 	IMPORT_C TBool LineBreakPossible(TUint aPrevClass,TUint aNextClass,TBool aHaveSpaces) const;
   134 	/** Gets the position of the first or last possible line break position in a text 
   135 	string.
   136 	
   137 	This implements MFormCustomWrap::GetLineBreakInContext().
   138 	
   139 	@param aText A string containing characters of class MTmCustom::ESaLineBreakClass. 
   140 	
   141 	@param aMinBreakPos A position within aText at which to begin searching for 
   142 	a possible line break position. 
   143 	@param aMaxBreakPos A position within aText at which to stop searching for 
   144 	a possible line break position. 
   145 	@param aForwards If ETrue, the function gets the first possible line break 
   146 	position (searches forwards from aMinBreakPos); if EFalse, gets the last one 
   147 	(searches backwards from aMaxBreakPos). 
   148 	@param aBreakPos On return, the position of the first or last possible line 
   149 	break within aText. This must be greater than zero and less than aText.Length() 
   150 	- 1, and must also be in the range aMinBreakPos to aMaxBreakPos. 
   151 	@return True if a possible line break position is found, false if not */
   152 	IMPORT_C TBool GetLineBreakInContext(const TDesC& aText,TInt aMinBreakPos,TInt aMaxBreakPos,TBool aForwards,TInt& aBreakPos) const;
   153 	/** Tests whether a character can overhang the right margin.
   154 	
   155 	@param aChar The Unicode character code of interest
   156 	@return True if the character specified can overhang the right margin, false 
   157 	if not */
   158 	IMPORT_C TBool IsHangingCharacter(TUint aChar) const;
   159 private:
   160 	/** Unused. */
   161 	IMPORT_C void MFormCustomWrap_Reserved_1();
   162 	/** Unused. */
   163 	IMPORT_C void MFormCustomWrap_Reserved_2();	
   164 
   165 protected:
   166 	/** Constructor.
   167 	
   168 	@param aControl The Edwin control */
   169 	IMPORT_C CLafEdwinCustomWrapBase(const CCoeControl& aControl);
   170 protected:	
   171 	/** The Edwin control, initialised by the constructor. */
   172 	const CCoeControl& iControl;
   173 private:
   174 	/** Unused. */
   175 	TInt iSpare;
   176 	};
   177 
   178 class MLafEnv
   179 /** LAF interface to access the current system environment settings.
   180 
   181 It is implemented by the Uikon Core, and effectively allows the LAF 
   182 limited access to the current thread's CEikonEnv.
   183 
   184 @publishedPartner 
   185 @released 
   186 */
   187 //@publishedAll @deprecated
   188 	{
   189 public:
   190 	/** Gets the environment's nearest match to the specified logical font.
   191 
   192 	The return value is never NULL.
   193 
   194 	@param aLogicalFont Logical font to match.
   195 	@return The font that most closely matches aLogicalFont. */
   196 	virtual const CFont* Font(const TLogicalFont& aLogicalFont) const=0;
   197 
   198 	/** Gets an environment bitmap specified by UID. 
   199 
   200 	@param aBmpUid The UID of the bitmap to retrieve.
   201 	@return The bitmap. */
   202 	virtual const CFbsBitmap* Bitmap(TUid aBmpUid) const=0;
   203 
   204 	/** Gets the physical (TRgb) colour that corresponds to the specified 
   205 	logical colour, for a specified control.
   206 
   207 	@param aLogicalColor Logical colour.
   208 	@param aControl Control for which to get the mapping. Note controls can override 
   209 	the system mappings.
   210 	@return Physical colour. */
   211 	virtual TRgb ControlColor(TLogicalColor aLogicalColor, const CCoeControl& aControl) const=0;
   212 
   213 	/** Gets the environment's physical (TRgb) colour that corresponds to 
   214 	the specified logical colour.
   215 
   216 	@param aLogicalColor Logical colour.
   217 	@param aColorListUid UID of the colour list from which to get the mapping. The default 
   218 	value is the environment's list.
   219 	@return Physical colour. */
   220 	virtual TRgb Color(TLogicalColor aLogicalColor, TUid aColorListUid=KNullUid) const=0;
   221 
   222 	/** Gets the environment setting for the default display mode.
   223 
   224 	@return Display mode. */
   225 	virtual TDisplayMode DefaultDisplayMode() const=0; 
   226 	};
   227 
   228 class MLafClientRectResolver
   229 /** Interface that works out how screen furniture reduces the available screen area 
   230 for applications.
   231 
   232 The interface is implemented by the UI and can be called by the LAF to get information 
   233 on the areas of screen furniture.
   234 
   235 @see LafAppUi::ClientRect() 
   236 @publishedPartner
   237 @released */
   238 	{
   239 public:
   240 	/** Flags for types of screen furniture. */
   241 	enum TScreenFurniture
   242 		{ 
   243 		/** Menu bar. */
   244 		EMenuBar, 
   245 		/** Button group. */
   246 		EButtonGroup, 
   247 		/** Tool band. */
   248 		EToolBand, 
   249 		/** Title band. */
   250 		ETitleBand, 
   251 		/** Status pane. */
   252 		EStatusPane,
   253 		/** Command Button Array */
   254 		ECba
   255 		};
   256 public:
   257 	/** Calculates how a specified type of screen furniture reduces the application 
   258 	area of a specified screen rectangle. 
   259 
   260 	@param aScreenFurniture Type of screen furniture.
   261 	@param aRect Screen rectangle from which to remove area of specified furniture. 
   262 	On return, the modified rectangle. */
   263 	virtual void ReduceRect(TScreenFurniture aScreenFurniture,TRect& aRect) const=0;
   264 	};
   265 
   266 #endif //__LAFMAIN_H__