williamr@2: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@2: // 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 williamr@2: // which accompanies this distribution, and is available williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: #ifndef __LAFMAIN_H__ williamr@2: #define __LAFMAIN_H__ williamr@2: williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: williamr@2: class CCoeControl; williamr@2: class CFont; williamr@2: class TLogicalFont; williamr@2: class MLafEnv; williamr@2: williamr@2: williamr@2: class CLafEdwinCustomDrawBase : public CBase, public MFormCustomDraw williamr@2: /** LAF support for custom drawing of Edwins. williamr@2: williamr@2: This class is used by CEikEdwin to draw lines in plain text editors. It does williamr@2: not work in rich text editors, as it assumes the line spacing is constant. williamr@2: williamr@2: The custom drawing interface is defined by the MFormCustomDraw class. williamr@2: williamr@2: @publishedPartner williamr@2: @released */ williamr@2: { williamr@2: public: williamr@2: /** Allocates and constructs the custom drawer. williamr@2: williamr@2: @param aEnv LAF environment functions williamr@2: @param aControl The Edwin control williamr@2: @return New custom drawer */ williamr@2: IMPORT_C static CLafEdwinCustomDrawBase* NewL(const MLafEnv& aEnv,const CCoeControl& aControl); williamr@2: public: // from MFormCustomDraw williamr@2: /** Implements MFormCustomDraw::DrawBackground() to draw the Edwin background. williamr@2: williamr@2: See that function for a full description. williamr@2: williamr@2: @param aParam Drawing parameters williamr@2: @param aBackground Default background colour williamr@2: @param aDrawn On return, the rectangle to which the function has drawn */ williamr@2: IMPORT_C void DrawBackground(const TParam& aParam,const TRgb& aBackground,TRect& aDrawn) const; williamr@2: /** Gets the physical colour that maps to a specified logical colour. williamr@2: williamr@2: @param aColorIndex Logical colour williamr@2: @param aDefaultColor The default physical colour. This is the colour to be williamr@2: used if no translation is performed. This allows translation to change certain williamr@2: indices but not others ( by passing the default colour back unchanged). williamr@2: @return Physical colour */ williamr@2: IMPORT_C TRgb SystemColor(TUint aColorIndex,TRgb aDefaultColor) const; williamr@2: public: williamr@2: /** Notifies the drawer that a MEikEdwinObserver::EEventFormatChanged event has williamr@2: occurred for the Edwin. */ williamr@2: IMPORT_C virtual void LineSpacingChanged(); williamr@2: protected: williamr@2: /** Constructor that initialises data members. williamr@2: williamr@2: @param aEnv LAF environment functions williamr@2: @param aControl The Edwin control */ williamr@2: IMPORT_C CLafEdwinCustomDrawBase(const MLafEnv& aEnv,const CCoeControl& aControl); williamr@2: protected: williamr@2: /** LAF environment functions williamr@2: williamr@2: This is initialised by the constructor. */ williamr@2: const MLafEnv& iEnv; williamr@2: /** The Edwin control. williamr@2: williamr@2: This is initialised by the constructor. */ williamr@2: const CCoeControl& iControl; williamr@2: private: williamr@2: /** Unused. */ williamr@2: TInt iSpare; williamr@2: }; williamr@2: williamr@2: williamr@2: class CLafEdwinCustomWrapBase : public CBase, public MFormCustomWrap williamr@2: /** LAF support for custom line breaking in Edwins. williamr@2: williamr@2: This class is used by CEikEdwin to determine how to place line breaks. williamr@2: williamr@2: The custom line breaking interface is defined by the MFormCustomWrap class. williamr@2: williamr@2: @publishedPartner williamr@2: @released */ williamr@2: { williamr@2: public: williamr@2: /** Allocates and constructs the custom line breaker. williamr@2: williamr@2: @param aControl The Edwin control williamr@2: @return The new line breaker */ williamr@2: IMPORT_C static CLafEdwinCustomWrapBase* NewL(const CCoeControl& aControl); williamr@2: /** Destructor. */ williamr@2: IMPORT_C ~CLafEdwinCustomWrapBase(); williamr@2: public: // from MFormCustomWrap williamr@2: /** Gets the line break class for a Unicode character. williamr@2: williamr@2: This implements MFormCustomWrap::LineBreakClass(). williamr@2: williamr@2: @param aCode The Unicode character code williamr@2: @param aRangeStart On return, contains the Unicode character code at the start williamr@2: of the range including aCode that shares the same line break class as aCode. williamr@2: @param aRangeEnd On return, contains the Unicode character code at the end williamr@2: of the range including aCode that shares the same line break class as aCode williamr@2: @return The line break class assigned to the character. Line break classes williamr@2: are enumerated with MTmCustom::EOpLineBreakClass etc. */ williamr@2: IMPORT_C TUint LineBreakClass(TUint aCode,TUint& aRangeStart,TUint& aRangeEnd) const; williamr@2: /** Tests whether a line break is possible between two characters. williamr@2: williamr@2: This implements MFormCustomWrap::LineBreakPossible(). williamr@2: williamr@2: @param aPrevClass The line break class of the previous non-space character. williamr@2: @param aNextClass The line break class of the next non-space character. williamr@2: @param aHaveSpaces True if there are one or more space characters (with a line williamr@2: break class of MTmCustom::ESpLineBreakClass) between aPrevClass and aNextClass; williamr@2: false if not. williamr@2: @return ool True if a line break is possible between characters with the two williamr@2: line break classes, false if not */ williamr@2: IMPORT_C TBool LineBreakPossible(TUint aPrevClass,TUint aNextClass,TBool aHaveSpaces) const; williamr@2: /** Gets the position of the first or last possible line break position in a text williamr@2: string. williamr@2: williamr@2: This implements MFormCustomWrap::GetLineBreakInContext(). williamr@2: williamr@2: @param aText A string containing characters of class MTmCustom::ESaLineBreakClass. williamr@2: williamr@2: @param aMinBreakPos A position within aText at which to begin searching for williamr@2: a possible line break position. williamr@2: @param aMaxBreakPos A position within aText at which to stop searching for williamr@2: a possible line break position. williamr@2: @param aForwards If ETrue, the function gets the first possible line break williamr@2: position (searches forwards from aMinBreakPos); if EFalse, gets the last one williamr@2: (searches backwards from aMaxBreakPos). williamr@2: @param aBreakPos On return, the position of the first or last possible line williamr@2: break within aText. This must be greater than zero and less than aText.Length() williamr@2: - 1, and must also be in the range aMinBreakPos to aMaxBreakPos. williamr@2: @return True if a possible line break position is found, false if not */ williamr@2: IMPORT_C TBool GetLineBreakInContext(const TDesC& aText,TInt aMinBreakPos,TInt aMaxBreakPos,TBool aForwards,TInt& aBreakPos) const; williamr@2: /** Tests whether a character can overhang the right margin. williamr@2: williamr@2: @param aChar The Unicode character code of interest williamr@2: @return True if the character specified can overhang the right margin, false williamr@2: if not */ williamr@2: IMPORT_C TBool IsHangingCharacter(TUint aChar) const; williamr@2: private: williamr@2: /** Unused. */ williamr@2: IMPORT_C void MFormCustomWrap_Reserved_1(); williamr@2: /** Unused. */ williamr@2: IMPORT_C void MFormCustomWrap_Reserved_2(); williamr@2: williamr@2: protected: williamr@2: /** Constructor. williamr@2: williamr@2: @param aControl The Edwin control */ williamr@2: IMPORT_C CLafEdwinCustomWrapBase(const CCoeControl& aControl); williamr@2: protected: williamr@2: /** The Edwin control, initialised by the constructor. */ williamr@2: const CCoeControl& iControl; williamr@2: private: williamr@2: /** Unused. */ williamr@2: TInt iSpare; williamr@2: }; williamr@2: williamr@2: class MLafEnv williamr@2: /** LAF interface to access the current system environment settings. williamr@2: williamr@2: It is implemented by the Uikon Core, and effectively allows the LAF williamr@2: limited access to the current thread's CEikonEnv. williamr@2: williamr@2: @publishedPartner williamr@2: @released williamr@2: */ williamr@2: //@publishedAll @deprecated williamr@2: { williamr@2: public: williamr@2: /** Gets the environment's nearest match to the specified logical font. williamr@2: williamr@2: The return value is never NULL. williamr@2: williamr@2: @param aLogicalFont Logical font to match. williamr@2: @return The font that most closely matches aLogicalFont. */ williamr@2: virtual const CFont* Font(const TLogicalFont& aLogicalFont) const=0; williamr@2: williamr@2: /** Gets an environment bitmap specified by UID. williamr@2: williamr@2: @param aBmpUid The UID of the bitmap to retrieve. williamr@2: @return The bitmap. */ williamr@2: virtual const CFbsBitmap* Bitmap(TUid aBmpUid) const=0; williamr@2: williamr@2: /** Gets the physical (TRgb) colour that corresponds to the specified williamr@2: logical colour, for a specified control. williamr@2: williamr@2: @param aLogicalColor Logical colour. williamr@2: @param aControl Control for which to get the mapping. Note controls can override williamr@2: the system mappings. williamr@2: @return Physical colour. */ williamr@2: virtual TRgb ControlColor(TLogicalColor aLogicalColor, const CCoeControl& aControl) const=0; williamr@2: williamr@2: /** Gets the environment's physical (TRgb) colour that corresponds to williamr@2: the specified logical colour. williamr@2: williamr@2: @param aLogicalColor Logical colour. williamr@2: @param aColorListUid UID of the colour list from which to get the mapping. The default williamr@2: value is the environment's list. williamr@2: @return Physical colour. */ williamr@2: virtual TRgb Color(TLogicalColor aLogicalColor, TUid aColorListUid=KNullUid) const=0; williamr@2: williamr@2: /** Gets the environment setting for the default display mode. williamr@2: williamr@2: @return Display mode. */ williamr@2: virtual TDisplayMode DefaultDisplayMode() const=0; williamr@2: }; williamr@2: williamr@2: class MLafClientRectResolver williamr@2: /** Interface that works out how screen furniture reduces the available screen area williamr@2: for applications. williamr@2: williamr@2: The interface is implemented by the UI and can be called by the LAF to get information williamr@2: on the areas of screen furniture. williamr@2: williamr@2: @see LafAppUi::ClientRect() williamr@2: @publishedPartner williamr@2: @released */ williamr@2: { williamr@2: public: williamr@2: /** Flags for types of screen furniture. */ williamr@2: enum TScreenFurniture williamr@2: { williamr@2: /** Menu bar. */ williamr@2: EMenuBar, williamr@2: /** Button group. */ williamr@2: EButtonGroup, williamr@2: /** Tool band. */ williamr@2: EToolBand, williamr@2: /** Title band. */ williamr@2: ETitleBand, williamr@2: /** Status pane. */ williamr@2: EStatusPane, williamr@2: /** Command Button Array */ williamr@2: ECba williamr@2: }; williamr@2: public: williamr@2: /** Calculates how a specified type of screen furniture reduces the application williamr@2: area of a specified screen rectangle. williamr@2: williamr@2: @param aScreenFurniture Type of screen furniture. williamr@2: @param aRect Screen rectangle from which to remove area of specified furniture. williamr@2: On return, the modified rectangle. */ williamr@2: virtual void ReduceRect(TScreenFurniture aScreenFurniture,TRect& aRect) const=0; williamr@2: }; williamr@2: williamr@2: #endif //__LAFMAIN_H__