williamr@2: /* williamr@2: * Copyright (c) 2002 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: Pictograph drawer interface. williamr@2: * williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: #ifndef AKN_PICTOGRAPH_DRAWER_INTERFACE_H williamr@2: #define AKN_PICTOGRAPH_DRAWER_INTERFACE_H williamr@2: williamr@2: // INCLUDES williamr@2: #include williamr@2: #include williamr@2: williamr@2: // CONSTANTS williamr@2: williamr@2: enum TAknPictographHeight williamr@2: { williamr@2: EHeight12 = 0, williamr@2: EHeight16 = 1, williamr@2: EHeight18 = 2, williamr@2: EHeight24 = 3, williamr@2: EHeight30 = 4 williamr@2: }; williamr@2: williamr@2: enum TAknPictographDrawingMode williamr@2: { williamr@2: EDrawingModeNormal = 0, williamr@2: EDrawingModeWhite = 1 williamr@2: }; williamr@2: williamr@2: // FORWARD DECLARATIONS williamr@2: williamr@2: class CBitmapContext; williamr@2: class CFont; williamr@2: williamr@2: // CLASS DECLARATION williamr@2: williamr@2: class MAknPictographAnimatorCallBack williamr@2: { williamr@2: public: williamr@2: /** williamr@2: * This function is called when a redraw is needed for drawing williamr@2: * new frames of animated pictographs. It should williamr@2: * williamr@2: * 1) Draw or clear the background of pictographs williamr@2: * 2) If the pictographs are amongst text, draw the text williamr@2: * 3) Draw the pictographs using MAknPictographDrawer interface williamr@2: * williamr@2: * In many cases, it is sufficient to implement this simply by williamr@2: * calling CCoeControl::DrawNow for the appropriate control. williamr@2: */ williamr@2: virtual void DrawPictographArea() = 0; williamr@2: }; williamr@2: williamr@2: /** williamr@2: * Pictograph drawer interface williamr@2: * williamr@2: * @lib N/A williamr@2: * @since 2.6 williamr@2: */ williamr@2: NONSHARABLE_CLASS(MAknPictographDrawer) williamr@2: { williamr@2: public: // Constructors and destructor williamr@2: williamr@2: /** williamr@2: * Destructor. williamr@2: */ williamr@2: inline virtual ~MAknPictographDrawer() {}; williamr@2: williamr@2: public: // New functions williamr@2: williamr@2: /** williamr@2: * Returns a heap descriptor filled with all supported williamr@2: * pictograph codes. williamr@2: * They are sorted in ascending pictograph code order. williamr@2: * Ownership of the returned object is transferred to the caller. williamr@2: * williamr@2: * @since 2.6 williamr@2: * @return Heap descriptor filled with all supported williamr@2: * pictograph codes. williamr@2: */ williamr@2: virtual HBufC* SupportedPictographCodesL() const = 0; williamr@2: williamr@2: /** williamr@2: * Tells whether the character is in the pictograph code range. williamr@2: * williamr@2: * @since 2.6 williamr@2: * @param aCode Character code in Unicode. williamr@2: * @return ETrue if in pictograph code range, EFalse if not. williamr@2: */ williamr@2: virtual TBool IsPictograph( TText aCode ) const = 0; williamr@2: williamr@2: /** williamr@2: * Tells whether the text contains any pictographs. williamr@2: * williamr@2: * @since 2.6 williamr@2: * @param aText Text. williamr@2: * @return ETrue if the text contains any pictographs, EFalse if not. williamr@2: */ williamr@2: virtual TBool ContainsPictographs( const TDesC& aText ) const = 0; williamr@2: williamr@2: /** williamr@2: * Draws pictograph bitmap in the given position. williamr@2: * This method sets aGc to use CGraphicsContext::ENullBrush. williamr@2: * williamr@2: * @since 2.6 williamr@2: * @param aGc Graphics context. williamr@2: * @param aTopLeft Top left coordinates of the rendering position . williamr@2: * @param aCode Pictograph code in Unicode. williamr@2: * @param aHeight Pictograph height. williamr@2: */ williamr@2: virtual void DrawPictograph( williamr@2: CBitmapContext& aGc, williamr@2: const TPoint& aTopLeft, williamr@2: TText aCode, williamr@2: TAknPictographHeight aHeight ) const = 0; williamr@2: williamr@2: /** williamr@2: * Draws pictograph bitmap centered in the given rect. williamr@2: * This method sets aGc to use CGraphicsContext::ENullBrush. williamr@2: * williamr@2: * @since 2.6 williamr@2: * @param aGc Graphics context. williamr@2: * @param aRect Rectangle, where the pictograph is centered in. williamr@2: * @param aCode Pictograph code in Unicode. williamr@2: * @param aHeight Pictograph height. williamr@2: */ williamr@2: virtual void DrawPictograph( williamr@2: CBitmapContext& aGc, williamr@2: const TRect& aRect, williamr@2: TText aCode, williamr@2: TAknPictographHeight aHeight ) const = 0; williamr@2: williamr@2: /** williamr@2: * Draws pictograph bitmap centered in the given rect, williamr@2: * clipped with clipping rect. williamr@2: * This method sets aGc to use CGraphicsContext::ENullBrush. williamr@2: * williamr@2: * @since 2.6 williamr@2: * @param aGc Graphics context. williamr@2: * @param aRect Rectangle, where the pictograph is centered in. williamr@2: * @param aClipRect Clipping rectangle. williamr@2: * @param aCode Pictograph code in Unicode. williamr@2: * @param aHeight Pictograph height. williamr@2: */ williamr@2: virtual void DrawPictograph( williamr@2: CBitmapContext& aGc, williamr@2: const TRect& aRect, williamr@2: const TRect& aClipRect, williamr@2: TText aCode, williamr@2: TAknPictographHeight aHeight ) const = 0; williamr@2: williamr@2: /** williamr@2: * Draws text using CGraphicsContext::DrawText and then williamr@2: * draws pictographs on top of that. williamr@2: * williamr@2: * Suitable pictograph height is chosen based on aFont. williamr@2: * williamr@2: * The graphics context aGc must be set to use font aFont williamr@2: * before calling this method. williamr@2: * williamr@2: * This method sets aGc to use CGraphicsContext::ENullBrush. williamr@2: * williamr@2: * @since 2.6 williamr@2: * @param aGc Graphics context. williamr@2: * @param aFont Used font. williamr@2: * @param aText Text. williamr@2: * @param aPosition Text baseline coordinates of the starting position. williamr@2: */ williamr@2: virtual void DrawText( williamr@2: CBitmapContext& aGc, williamr@2: const CFont& aFont, williamr@2: const TDesC& aText, williamr@2: const TPoint& aPosition ) const = 0; williamr@2: williamr@2: /** williamr@2: * Draws text using CGraphicsContext::DrawText and then williamr@2: * draws pictographs on top of that. williamr@2: * williamr@2: * Suitable pictograph height is chosen based on aFont. williamr@2: * williamr@2: * The graphics context aGc must be set to use font aFont williamr@2: * before calling this method. williamr@2: * williamr@2: * This method sets aGc to use CGraphicsContext::ENullBrush. williamr@2: * williamr@2: * @since 2.6 williamr@2: * @param aGc Graphics context. williamr@2: * @param aFont Used font. williamr@2: * @param aText Text. williamr@2: * @param aBox Rectangle, where the text is rendered. williamr@2: * @param aBaselineOffset Offset from the top of the rectangle to williamr@2: * the baseline to the text. williamr@2: * @param aAlignment Text alignment. williamr@2: * @param aLeftMargin The left margin for left-aligned text, or the right williamr@2: * margin for right-aligned text williamr@2: */ williamr@2: virtual void DrawText( williamr@2: CBitmapContext& aGc, williamr@2: const CFont& aFont, williamr@2: const TDesC& aText, williamr@2: const TRect& aBox, williamr@2: TInt aBaselineOffset, williamr@2: CGraphicsContext::TTextAlign aAlignment = williamr@2: CGraphicsContext::ELeft, williamr@2: TInt aLeftMargin = 0 ) const = 0; williamr@2: williamr@2: /** williamr@2: * Draws pictographs that are encountered in the text. williamr@2: * Suitable pictograph height is chosen based on aFont. williamr@2: * This method sets aGc to use CGraphicsContext::ENullBrush. williamr@2: * williamr@2: * @since 2.6 williamr@2: * @param aGc Graphics context. williamr@2: * @param aFont Used font. williamr@2: * @param aText Text. williamr@2: * @param aPosition Text baseline coordinates of the starting position. williamr@2: */ williamr@2: virtual void DrawPictographsInText( williamr@2: CBitmapContext& aGc, williamr@2: const CFont& aFont, williamr@2: const TDesC& aText, williamr@2: const TPoint& aPosition ) const = 0; williamr@2: williamr@2: /** williamr@2: * Draws pictographs that are encountered in the text. williamr@2: * This method sets aGc to use CGraphicsContext::ENullBrush. williamr@2: * williamr@2: * @since 2.6 williamr@2: * @param aGc Graphics context. williamr@2: * @param aFont Used font. williamr@2: * @param aText Text. williamr@2: * @param aBox Rectangle, where the text is rendered. williamr@2: * @param aBaselineOffset Offset from the top of the rectangle to williamr@2: * the baseline to the text. williamr@2: * @param aAlignment Text alignment. williamr@2: * @param aLeftMargin The left margin for left-aligned text, or the right williamr@2: * margin for right-aligned text williamr@2: */ williamr@2: virtual void DrawPictographsInText( williamr@2: CBitmapContext& aGc, williamr@2: const CFont& aFont, williamr@2: const TDesC& aText, williamr@2: const TRect& aBox, williamr@2: TInt aBaselineOffset, williamr@2: CGraphicsContext::TTextAlign aAlignment = williamr@2: CGraphicsContext::ELeft, williamr@2: TInt aLeftMargin = 0 ) const = 0; williamr@2: williamr@2: /** williamr@2: * Tells whether the given pictograph is animated or not. williamr@2: * williamr@2: * @since 2.6 williamr@2: * @param aCode Pictograph code in Unicode. williamr@2: */ williamr@2: virtual TBool IsAnimated( TText aCode, TAknPictographHeight aHeight ) const = 0; williamr@2: williamr@2: /** williamr@2: * Tries to find a matching pictograph height for a given font. williamr@2: * williamr@2: * @since 2.8 williamr@2: * @param aFont Used font. williamr@2: * @param aHeight Pictograph height. williamr@2: * @return KErrNone if a supported pictograph height is found that matches williamr@2: * aFont otherwise returns KErrNotSupported williamr@2: */ williamr@2: virtual TInt SelectPictographHeightForFont( williamr@2: const CFont& aFont, williamr@2: TAknPictographHeight& aHeight williamr@2: ) const = 0; williamr@2: williamr@2: /** williamr@2: * Sets the pictograph drawing mode for DrawPictograph calls. Other functions e.g. williamr@2: * DrawText, etc are unaffected by this function. williamr@2: * The drawing mode is set to EDrawingModeNormal by default. williamr@2: * Note: When drawing mode EDrawingModeWhite is set only a single DrawPictograph call williamr@2: * is supported per component->Draw() call. williamr@2: * williamr@2: * @since 2.8 williamr@2: * @param aDrawingMode the new pictograph drawing mode to be used. williamr@2: * @return the value of the previous pictograph drawing mode. williamr@2: */ williamr@2: virtual TAknPictographDrawingMode SetPictographDrawingMode( williamr@2: TAknPictographDrawingMode aDrawingMode) = 0; williamr@2: }; williamr@2: williamr@2: #endif // AKN_PICTOGRAPH_DRAWER_INTERFACE_H williamr@2: williamr@2: // End of File