menufw/hierarchynavigator/hnpresentationmodel/inc/hnattrimgprovliwimage.h
changeset 0 f72a12da539e
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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:   image provider for liw buffer
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef HNATTRIMGPROVLIWIMAGE_H_
       
    20 #define HNATTRIMGPROVLIWIMAGE_H_
       
    21 
       
    22 #include <AknUtils.h>
       
    23 #include "hnattrimgprovider.h"
       
    24 #include "hnglobals.h"
       
    25 
       
    26 class TLiwVariant;
       
    27 class CLiwBitmapBuffer;
       
    28 
       
    29 /**
       
    30  *  Image provider class for empty image.
       
    31  *  Image provider specialization that loads image
       
    32  *  froma an liw buffer.
       
    33  *
       
    34  *  @lib hnpresentationmodel
       
    35  *  @since S60 5.0
       
    36  *  @ingroup group_hnpresentationmodel
       
    37  */
       
    38 NONSHARABLE_CLASS( CHnAttrImgProvLiwImage ) : public CHnAttrImgProvider
       
    39     {
       
    40 public:
       
    41     
       
    42     /**
       
    43      * Two-phase constructor.
       
    44      *
       
    45      * @since S60 5.0
       
    46      * @param aBitmap Pointer to bitmap.
       
    47      * @param aMaskBitmap Poitner to mask.
       
    48      * @return Fully constructed object.
       
    49      */
       
    50     IMPORT_C static CHnAttrImgProvLiwImage* NewL( TLiwVariant*& aBitmap, 
       
    51             TLiwVariant*& aMaskBitmap );
       
    52 
       
    53     /**
       
    54      * Two-phase constructor.
       
    55      *
       
    56      * @since S60 5.0
       
    57      * @param aBitmap Pointer to bitmap.
       
    58      * @param aMaskBitmap Poitner to mask.
       
    59      * @return Fully constructed object.
       
    60      */
       
    61     IMPORT_C static CHnAttrImgProvLiwImage* NewLC( TLiwVariant*& aBitmap, 
       
    62             TLiwVariant*& aMaskBitmap );
       
    63 
       
    64     /**
       
    65      * Virtual destructor.
       
    66      * 
       
    67      * @since S60 5.0
       
    68      */
       
    69     virtual ~CHnAttrImgProvLiwImage();
       
    70     
       
    71     /**
       
    72      * Removes all  LIW objects owned by this object.
       
    73      * 
       
    74      * LIW objects owned by non-LIW objects that are owned by
       
    75      * this object are also removed.
       
    76      * @since S60 5.0
       
    77      */
       
    78     virtual void RemoveLiwObjects();
       
    79 
       
    80 // from base class CHnAttrImgProvider
       
    81 public:
       
    82     
       
    83     /**
       
    84      * Returns the value.
       
    85      *
       
    86      * @since S60 5.0
       
    87      * @return Value
       
    88      */
       
    89     const TDesC8& Value();
       
    90 
       
    91 private:
       
    92 
       
    93     /**
       
    94      * Defualt constructor.
       
    95      * 
       
    96      * @since S60 5.0
       
    97      */
       
    98     CHnAttrImgProvLiwImage();
       
    99 
       
   100     /**
       
   101      * Standard 2nd pahse symbian constructor.
       
   102      * 
       
   103      * @since S60 5.0
       
   104      * @param aBitmap Pointer to bitmap.
       
   105      * @param aMaskBitmap Poitner to mask.
       
   106      */
       
   107     void ConstructL( TLiwVariant*& aBitmap, TLiwVariant*& aMaskBitmap );
       
   108     
       
   109     /**
       
   110      * Creates icon whose bitmaps are owned externally by CLiwBitmapBuffer objects.
       
   111      * 
       
   112      * @param aBitmap Primary icon bitmap.
       
   113      * @param aMask Icon mask.
       
   114      * @param aExtBmp Buffer that owns the primary bitmap of the icon.
       
   115      * @param aExtMask Buffer that owns the mask.
       
   116      */
       
   117     void CreateExtIconL( CFbsBitmap* aBitmap, CFbsBitmap* aMask,
       
   118             CLiwBitmapBuffer* aExtBmp, CLiwBitmapBuffer* aExtMask );
       
   119     
       
   120     /**
       
   121      * Creates Bitmap from variant which can be a handle or a descriptor.  
       
   122      * 
       
   123      * @since S60 5.0
       
   124      * @param aVariant Contains bitmap.
       
   125      * @return Bitmap.
       
   126      */
       
   127     CFbsBitmap* CreateBitmapFromVariantL( const TLiwVariant& aVariant );
       
   128     
       
   129     /**
       
   130      * Retrieves bitmap handle from a TLiwVariant object.
       
   131      * The reason why such function is needed is that bitmap handle can be
       
   132      * stored in many integer types.
       
   133      * 
       
   134      * @param aVariant a variant from which to extract the handle
       
   135      * @param aHandle will contain the handle on successful execution
       
   136      * @return KErrNone if handle extracted successfully, KErrNotFound if
       
   137      *         the variant did not contain anything that can be cast to
       
   138      *         integer. 
       
   139      */
       
   140     TInt ExtractBitmapHandleFromVariant( const TLiwVariant& aVariant,
       
   141             TInt& aHandle );
       
   142     
       
   143 private: // data
       
   144    
       
   145     /**
       
   146      * Value.
       
   147      */
       
   148     TBuf8<KMaxLength> iValue;
       
   149     
       
   150     };
       
   151     
       
   152 #endif // HNATTRIMGPROVLIWIMAGE_H_
       
   153     
       
   154