vtuis/videotelui/inc/CVtUiBitmapManager.h
branchRCL_3
changeset 25 779871d1e4f4
parent 0 ed9695c8bcbe
equal deleted inserted replaced
24:f15ac8e65a02 25:779871d1e4f4
       
     1 /*
       
     2 * Copyright (c) 2004, 2005 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:  Bitmap manager for Video Telephone application.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CVTUIBITMAPMANAGER_H
       
    21 #define CVTUIBITMAPMANAGER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include    <e32base.h>
       
    25 #include    <gdi.h>
       
    26 #include    "videotelui.hrh"
       
    27 
       
    28 // DATA TYPES
       
    29 
       
    30 /**
       
    31 * Type definition for bitmap pool identifier.
       
    32 * Zero is reserved as invalid identifier.
       
    33 */
       
    34 typedef TInt TVtUiBitmapPoolId;
       
    35 
       
    36 // FORWARD DECLARATION
       
    37 class CFbsBitmap;
       
    38 
       
    39 // CLASS DECLARATION
       
    40 
       
    41 /**
       
    42 *  Bitmap manager for Video Telephone application.
       
    43 *  @since Series 60 2.8
       
    44 */
       
    45 class CVtUiBitmapManager
       
    46     : public CBase
       
    47     {
       
    48     public: // Constructors and destructor
       
    49         
       
    50         /**
       
    51         * Constructor.
       
    52         */
       
    53         CVtUiBitmapManager();
       
    54 
       
    55         /**
       
    56         * Destructor.
       
    57         */
       
    58         ~CVtUiBitmapManager();
       
    59 
       
    60     public: // New functions
       
    61 
       
    62         /**
       
    63         * Adds bitmaps to the pool.
       
    64         * @param aBitmapId bitmap identifier.
       
    65         * @param aBitmapMaskId bitmap mask identifier, 
       
    66         *        KErrNotFound if no mask.
       
    67         * @param aExpectDefaultColor ETrue if default color is to be expected.
       
    68         * @return bitmap pool identifier.
       
    69         */
       
    70         TVtUiBitmapPoolId AddBitmapsL(
       
    71             TVtUiBitmapId aBitmapId, 
       
    72             TVtUiBitmapId aBitmapMaskId,
       
    73             TBool aExpectDefaultColor );
       
    74 
       
    75         /**
       
    76         * Adds bitmap to the pool.Note that this bitmap does not have mask.
       
    77         * @param aBitmapId bitmap identifier.
       
    78         * @param aExpectDefaultColor ETrue if default color is to be expected.
       
    79         * @return bitmap pool identifier.
       
    80         */
       
    81         TVtUiBitmapPoolId AddBitmapL(
       
    82             TVtUiBitmapId aBitmapId,
       
    83             TBool aExpectDefaultColor );
       
    84         
       
    85         /**
       
    86         * Removes bitmap from the pool.
       
    87         * @param aId bitmap pool identifier.
       
    88         */
       
    89         void RemoveBitmap( TVtUiBitmapPoolId aId );
       
    90 
       
    91         /**
       
    92         * Sets size of the specified bitmap. This method must be 
       
    93         * called before bitmap is used.
       
    94         *
       
    95         * @param aId bitmap pool identifier.
       
    96         * @param aSize size of the bitmap.
       
    97         */
       
    98         void SetSize( 
       
    99             TVtUiBitmapPoolId aId, 
       
   100             const TSize& aSize );
       
   101 
       
   102         /**
       
   103         * Sets size and default color of the specified bitmap. 
       
   104         * This method must be called before bitmap is used.
       
   105         *
       
   106         * @param aId bitmap pool identifier.
       
   107         * @param aSize size of the bitmap.
       
   108         * @param aDefaultColor default color of the bitmap.
       
   109         */
       
   110         void SetSizeAndColor( 
       
   111             TVtUiBitmapPoolId aId,
       
   112             const TSize& aSize, 
       
   113             const TRgb& aDefaultColor );
       
   114 
       
   115         /**
       
   116         * Sets aspect ratio preservation status.
       
   117         * @param aId bitmap pool identifier.
       
   118         * @param aPreserve ETrue if aspect ration is to be preserved.
       
   119         */
       
   120         void SetAspectRatio( 
       
   121             TVtUiBitmapPoolId aId,
       
   122             TBool aPreserve );
       
   123 
       
   124         /**
       
   125         * This method is called to inform that bitmap is required.
       
   126         * @param aId bitmap pool identifier.
       
   127         */
       
   128         void RequireBitmap( TVtUiBitmapPoolId aId );
       
   129 
       
   130         /**
       
   131         * Gets bitmap & its mask.
       
   132         * @param aId bitmap pool identifier.
       
   133         * @param aBitmap it will be updated to hold bitmap pointer, 
       
   134         *        or NULL if bitmap is not available. This pointer
       
   135         *        must not be kept any longer than absolutely required.
       
   136         * @param aBitmapMask it will be updated to hold bitmap mask pointer, 
       
   137         *        or NULL if bitmap mask is not available. This pointer
       
   138         *        must not be kept any longer than absolutely required.
       
   139         */
       
   140         void GetBitmaps(
       
   141             TVtUiBitmapPoolId aId,
       
   142             CFbsBitmap*& aBitmap,
       
   143             CFbsBitmap*& aBitmapMask );
       
   144 
       
   145         /**
       
   146         * Gets bitmap & its mask.
       
   147         * @param aId bitmap pool identifier.
       
   148         * @param aBitmap it will be updated to hold bitmap pointer, 
       
   149         *        or NULL if bitmap is not available. This pointer
       
   150         *        must not be kept any longer than absolutely required.
       
   151         */
       
   152         void GetBitmap(
       
   153             TVtUiBitmapPoolId aId,
       
   154             CFbsBitmap*& aBitmap );
       
   155 
       
   156         /**
       
   157         * Invalidates bitmaps. This is called on theme / layout change.
       
   158         */
       
   159         void InvalidateBitmaps();
       
   160 
       
   161     private:
       
   162 
       
   163         // Inner class.
       
   164         class CBitmapInfo;
       
   165 
       
   166         /**
       
   167         * Finds bitmap based on pool identifier.
       
   168         * @param aId bitmap pool identifier.
       
   169         * @return KErrNotFound if not found, or index to array.
       
   170         */ 
       
   171         TInt Find( TVtUiBitmapPoolId aId ) const;
       
   172 
       
   173     private:
       
   174 
       
   175         // Owned array of bitmap information instances.
       
   176         RPointerArray< CBitmapInfo > iBitmapArray;
       
   177 
       
   178         // Bitmap pool identifier used to generate bitmaps.
       
   179         TVtUiBitmapPoolId iBitmapId;
       
   180 
       
   181         // Temporary instance for getting bitmap file name.
       
   182         TFileName iTmpFileName;
       
   183 
       
   184     };
       
   185 
       
   186 #endif      // CVTUIBITMAPMANAGER_H
       
   187 
       
   188 // End of File