emailuis/uicomponents/src/fsbitmapprovider.cpp
changeset 0 8466d47a6819
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2007-2007 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: This file implements class CFsBitmapProvider.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "emailtrace.h"
       
    21 #include <e32std.h>
       
    22 #include <eikenv.h>
       
    23 //<cmail> removed __FS_ALFRED_SUPPORT flag 
       
    24 //#include <fsconfig.h>
       
    25 //</cmail> removed __FS_ALFRED_SUPPORT flag 
       
    26 #include <imageconversion.h>
       
    27 #include "fsbitmapprovider.h"
       
    28 
       
    29 // ============================= LOCAL FUNCTIONS  =============================
       
    30 
       
    31 // ============================= MEMBER FUNCTIONS =============================
       
    32     
       
    33 // ----------------------------------------------------------------------------
       
    34 // CFsBitmapProvider::NewL
       
    35 // Symbian 2-phased constructor
       
    36 // (static, may leave)
       
    37 // Status : Draft
       
    38 // ----------------------------------------------------------------------------
       
    39 //
       
    40 CFsBitmapProvider* CFsBitmapProvider::NewL( const CFbsBitmap* aBitmap,
       
    41                                             const CFbsBitmap* aBitmapMask,
       
    42                                             const TInt aId
       
    43                                           )
       
    44     {
       
    45     FUNC_LOG;
       
    46     CFsBitmapProvider* provider = new (ELeave) CFsBitmapProvider( aId );
       
    47     CleanupStack::PushL( provider );
       
    48     provider->ConstructL( aBitmap,
       
    49                           aBitmapMask
       
    50                         );
       
    51     CleanupStack::Pop( provider );
       
    52     
       
    53     return provider;
       
    54     }
       
    55                                           
       
    56 // ----------------------------------------------------------------------------
       
    57 // CFsBitmapProvider::~CFsBitmapProvider
       
    58 // C++ Destructor
       
    59 // Status : Draft
       
    60 // ----------------------------------------------------------------------------
       
    61 //
       
    62 CFsBitmapProvider::~CFsBitmapProvider()
       
    63     {
       
    64     FUNC_LOG;
       
    65     return;
       
    66     }
       
    67             
       
    68 // ----------------------------------------------------------------------------
       
    69 // CFsBitmapProvider::CFsBitmapProvider
       
    70 // C++ Constructor
       
    71 // Status : Draft
       
    72 // ----------------------------------------------------------------------------
       
    73 //
       
    74 CFsBitmapProvider::CFsBitmapProvider( const TInt aId )
       
    75     : iBitmap( NULL ),
       
    76       iBitmapMask( NULL ),
       
    77       iId( aId )
       
    78     {
       
    79     FUNC_LOG;
       
    80     return;
       
    81     }
       
    82 
       
    83 // ----------------------------------------------------------------------------
       
    84 // CFsBitmapProvider::ConstructL
       
    85 // 2nd phase constructor
       
    86 // (may leave)
       
    87 // Status : Draft
       
    88 // ----------------------------------------------------------------------------
       
    89 //
       
    90 void CFsBitmapProvider::ConstructL( const CFbsBitmap* aBitmap, 
       
    91                                     const CFbsBitmap* aBitmapMask
       
    92                                   )
       
    93     {
       
    94     FUNC_LOG;
       
    95     if ( aBitmap )
       
    96         {
       
    97         iBitmap = new (ELeave) CFbsBitmap;
       
    98         iBitmap->Duplicate( aBitmap->Handle() );
       
    99         }
       
   100     
       
   101     if ( aBitmapMask )
       
   102         {
       
   103         iBitmapMask = new (ELeave) CFbsBitmap;
       
   104         iBitmapMask->Duplicate( aBitmapMask->Handle() );
       
   105         }    
       
   106     
       
   107     return;
       
   108     }
       
   109 
       
   110 // ----------------------------------------------------------------------------
       
   111 // CFsBitmapProvider::ProvideBitmapL
       
   112 // Interface callback
       
   113 // (may leave)
       
   114 // Status : Draft
       
   115 // ----------------------------------------------------------------------------
       
   116 //
       
   117 void CFsBitmapProvider::ProvideBitmapL( TInt aId, 
       
   118                                         CFbsBitmap*& aBitmap, 
       
   119                                         CFbsBitmap*& aMaskBitmap
       
   120                                       )
       
   121     {
       
   122     FUNC_LOG;
       
   123     User::LeaveIfError( aId == iId ? KErrNone : KErrArgument );
       
   124     
       
   125     aBitmap = iBitmap;
       
   126     aMaskBitmap = iBitmapMask;
       
   127     
       
   128     return;
       
   129     }
       
   130 
       
   131 // ----------------------------------------------------------------------------
       
   132 // CFsBitmapProvider::Id
       
   133 // Return provider Id
       
   134 // Status : Draft
       
   135 // ----------------------------------------------------------------------------
       
   136 //
       
   137 TInt CFsBitmapProvider::Id() const
       
   138     {
       
   139     FUNC_LOG;
       
   140     return iId;
       
   141     }
       
   142 
       
   143 // ========================= OTHER EXPORTED FUNCTIONS =========================
       
   144 
       
   145 // End of file
       
   146