epoc32/include/mw/aknpictographdrawerinterface.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:  Pictograph drawer interface.
    15 *
    16 *
    17 */
    18 
    19 
    20 #ifndef AKN_PICTOGRAPH_DRAWER_INTERFACE_H
    21 #define AKN_PICTOGRAPH_DRAWER_INTERFACE_H
    22 
    23 // INCLUDES
    24 #include <e32std.h>
    25 #include <gdi.h>
    26 
    27 // CONSTANTS
    28 
    29 enum TAknPictographHeight
    30     {
    31     EHeight12 = 0,
    32     EHeight16 = 1,
    33     EHeight18 = 2,
    34     EHeight24 = 3,
    35     EHeight30 = 4
    36     };
    37 
    38 enum TAknPictographDrawingMode
    39     {
    40     EDrawingModeNormal = 0,
    41     EDrawingModeWhite  = 1
    42     };
    43 
    44 // FORWARD DECLARATIONS
    45 
    46 class CBitmapContext;
    47 class CFont;
    48 
    49 // CLASS DECLARATION
    50 
    51 class MAknPictographAnimatorCallBack
    52     {
    53     public:
    54         /**
    55         * This function is called when a redraw is needed for drawing
    56         * new frames of animated pictographs. It should
    57         *
    58         * 1) Draw or clear the background of pictographs
    59         * 2) If the pictographs are amongst text, draw the text
    60         * 3) Draw the pictographs using MAknPictographDrawer interface
    61         *
    62         * In many cases, it is sufficient to implement this simply by
    63         * calling CCoeControl::DrawNow for the appropriate control.
    64         */
    65         virtual void DrawPictographArea() = 0;
    66     };
    67 
    68 /**
    69 * Pictograph drawer interface
    70 *
    71 *  @lib N/A
    72 *  @since 2.6
    73 */
    74 NONSHARABLE_CLASS(MAknPictographDrawer) 
    75 	{
    76     public:  // Constructors and destructor
    77 
    78         /**
    79         * Destructor.
    80         */
    81         inline virtual ~MAknPictographDrawer() {};
    82 
    83     public: // New functions
    84 
    85         /**
    86         * Returns a heap descriptor filled with all supported
    87         * pictograph codes.
    88         * They are sorted in ascending pictograph code order.
    89         * Ownership of the returned object is transferred to the caller.
    90         *
    91         * @since 2.6
    92         * @return Heap descriptor filled with all supported
    93         *         pictograph codes.
    94         */
    95         virtual HBufC* SupportedPictographCodesL() const = 0;
    96 
    97         /**
    98         * Tells whether the character is in the pictograph code range.
    99         *
   100         * @since 2.6
   101         * @param aCode Character code in Unicode.
   102         * @return ETrue if in pictograph code range, EFalse if not.
   103         */
   104         virtual TBool IsPictograph( TText aCode ) const = 0;
   105 
   106         /**
   107         * Tells whether the text contains any pictographs.
   108         *
   109         * @since 2.6
   110         * @param aText Text.
   111         * @return ETrue if the text contains any pictographs, EFalse if not.
   112         */
   113         virtual TBool ContainsPictographs( const TDesC& aText ) const = 0;
   114 
   115         /**
   116         * Draws pictograph bitmap in the given position.
   117         * This method sets aGc to use CGraphicsContext::ENullBrush.
   118         *
   119         * @since 2.6
   120         * @param aGc Graphics context.
   121         * @param aTopLeft Top left coordinates of the rendering position .
   122         * @param aCode Pictograph code in Unicode.
   123         * @param aHeight Pictograph height.
   124         */
   125 	    virtual void DrawPictograph(
   126             CBitmapContext& aGc,
   127             const TPoint& aTopLeft,
   128             TText aCode,
   129             TAknPictographHeight aHeight ) const = 0;
   130 
   131         /**
   132         * Draws pictograph bitmap centered in the given rect.
   133         * This method sets aGc to use CGraphicsContext::ENullBrush.
   134         *
   135         * @since 2.6
   136         * @param aGc Graphics context.
   137         * @param aRect Rectangle, where the pictograph is centered in.
   138         * @param aCode Pictograph code in Unicode.
   139         * @param aHeight Pictograph height.
   140         */
   141 	    virtual void DrawPictograph(
   142             CBitmapContext& aGc,
   143             const TRect& aRect,
   144             TText aCode,
   145             TAknPictographHeight aHeight ) const = 0;
   146 
   147         /**
   148         * Draws pictograph bitmap centered in the given rect,
   149         * clipped with clipping rect.
   150         * This method sets aGc to use CGraphicsContext::ENullBrush.
   151         *
   152         * @since 2.6
   153         * @param aGc Graphics context.
   154         * @param aRect Rectangle, where the pictograph is centered in.
   155         * @param aClipRect Clipping rectangle.
   156         * @param aCode Pictograph code in Unicode.
   157         * @param aHeight Pictograph height.
   158         */
   159 	    virtual void DrawPictograph(
   160             CBitmapContext& aGc,
   161             const TRect& aRect,
   162             const TRect& aClipRect,
   163             TText aCode,
   164             TAknPictographHeight aHeight ) const = 0;
   165 
   166         /**
   167         * Draws text using CGraphicsContext::DrawText and then
   168         * draws pictographs on top of that.
   169         *
   170         * Suitable pictograph height is chosen based on aFont.
   171         *
   172         * The graphics context aGc must be set to use font aFont
   173         * before calling this method.
   174         *
   175         * This method sets aGc to use CGraphicsContext::ENullBrush.
   176         *
   177         * @since 2.6
   178         * @param aGc Graphics context.
   179         * @param aFont Used font.
   180         * @param aText Text.
   181         * @param aPosition Text baseline coordinates of the starting position.
   182         */
   183         virtual void DrawText(
   184             CBitmapContext& aGc,
   185             const CFont& aFont,
   186             const TDesC& aText,
   187             const TPoint& aPosition ) const = 0;
   188 
   189         /**
   190         * Draws text using CGraphicsContext::DrawText and then
   191         * draws pictographs on top of that.
   192         *
   193         * Suitable pictograph height is chosen based on aFont.
   194         *
   195         * The graphics context aGc must be set to use font aFont
   196         * before calling this method.
   197         *
   198         * This method sets aGc to use CGraphicsContext::ENullBrush.
   199         *
   200         * @since 2.6
   201         * @param aGc Graphics context.
   202         * @param aFont Used font.
   203         * @param aText Text.
   204         * @param aBox Rectangle, where the text is rendered.
   205         * @param aBaselineOffset Offset from the top of the rectangle to
   206         *   the baseline to the text.
   207         * @param aAlignment Text alignment.
   208         * @param aLeftMargin The left margin for left-aligned text, or the right
   209         *   margin for right-aligned text
   210         */
   211         virtual void DrawText(
   212             CBitmapContext& aGc,
   213             const CFont& aFont,
   214             const TDesC& aText,
   215             const TRect& aBox,
   216             TInt aBaselineOffset,
   217             CGraphicsContext::TTextAlign aAlignment =
   218                 CGraphicsContext::ELeft,
   219             TInt aLeftMargin = 0 ) const = 0;
   220 
   221         /**
   222         * Draws pictographs that are encountered in the text.
   223         * Suitable pictograph height is chosen based on aFont.
   224         * This method sets aGc to use CGraphicsContext::ENullBrush.
   225         *
   226         * @since 2.6
   227         * @param aGc Graphics context.
   228         * @param aFont Used font.
   229         * @param aText Text.
   230         * @param aPosition Text baseline coordinates of the starting position.
   231         */
   232         virtual void DrawPictographsInText(
   233             CBitmapContext& aGc,
   234             const CFont& aFont,
   235             const TDesC& aText,
   236             const TPoint& aPosition ) const = 0;
   237 
   238         /**
   239         * Draws pictographs that are encountered in the text.
   240         * This method sets aGc to use CGraphicsContext::ENullBrush.
   241         *
   242         * @since 2.6
   243         * @param aGc Graphics context.
   244         * @param aFont Used font.
   245         * @param aText Text.
   246         * @param aBox Rectangle, where the text is rendered.
   247         * @param aBaselineOffset Offset from the top of the rectangle to
   248         *   the baseline to the text.
   249         * @param aAlignment Text alignment.
   250         * @param aLeftMargin The left margin for left-aligned text, or the right
   251         *   margin for right-aligned text
   252         */
   253         virtual void DrawPictographsInText(
   254             CBitmapContext& aGc,
   255             const CFont& aFont,
   256             const TDesC& aText,
   257             const TRect& aBox,
   258             TInt aBaselineOffset,
   259             CGraphicsContext::TTextAlign aAlignment =
   260                 CGraphicsContext::ELeft,
   261             TInt aLeftMargin = 0 ) const = 0;
   262 
   263         /**
   264         * Tells whether the given pictograph is animated or not.
   265         *
   266         * @since 2.6
   267         * @param aCode Pictograph code in Unicode.
   268         */
   269         virtual TBool IsAnimated( TText aCode, TAknPictographHeight aHeight ) const = 0;
   270 
   271         /**
   272         * Tries to find a matching pictograph height for a given font.
   273         *
   274         * @since 2.8
   275         * @param aFont Used font.
   276         * @param aHeight Pictograph height.
   277         * @return KErrNone if a supported pictograph height is found that matches
   278         *         aFont otherwise returns KErrNotSupported
   279         */
   280         virtual TInt SelectPictographHeightForFont(
   281             const CFont& aFont,
   282             TAknPictographHeight& aHeight
   283             ) const = 0;
   284 
   285         /**
   286         * Sets the pictograph drawing mode for DrawPictograph calls. Other functions e.g.
   287         * DrawText, etc are unaffected by this function.
   288         * The drawing mode is set to EDrawingModeNormal by default.
   289         * Note: When drawing mode EDrawingModeWhite is set only a single DrawPictograph call
   290         * is supported per component->Draw() call.
   291         *
   292         * @since 2.8
   293         * @param aDrawingMode the new pictograph drawing mode to be used.
   294         * @return the value of the previous pictograph drawing mode.
   295         */
   296         virtual TAknPictographDrawingMode SetPictographDrawingMode(
   297             TAknPictographDrawingMode aDrawingMode) = 0;
   298     };
   299 
   300 #endif // AKN_PICTOGRAPH_DRAWER_INTERFACE_H
   301             
   302 // End of File