menufw/hierarchynavigator/hnpresentationmodel/src/hnattrimgprovider.cpp
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:  base class for all image providers
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <AknsSkinInstance.h>
       
    20 #include <AknIconUtils.h>
       
    21 #include <AknsUtils.h>
       
    22 #include "hnattrimgprovider.h"
       
    23 
       
    24 // ============================ MEMBER FUNCTIONS =============================
       
    25 
       
    26 // ---------------------------------------------------------------------------
       
    27 // 
       
    28 // ---------------------------------------------------------------------------
       
    29 //
       
    30 TDismissableCleaner::TDismissableCleaner( TAny* aToBeDeletedOnLeave )
       
    31     : mToBeDeletedOnLeave( aToBeDeletedOnLeave )
       
    32     {
       
    33     }
       
    34 
       
    35 // ---------------------------------------------------------------------------
       
    36 // 
       
    37 // ---------------------------------------------------------------------------
       
    38 //
       
    39 void TDismissableCleaner::Close()
       
    40     {
       
    41     delete mToBeDeletedOnLeave;
       
    42     }
       
    43 
       
    44 // ---------------------------------------------------------------------------
       
    45 // 
       
    46 // ---------------------------------------------------------------------------
       
    47 //
       
    48 void TDismissableCleaner::Dismiss()
       
    49     {
       
    50     mToBeDeletedOnLeave = NULL;
       
    51     }
       
    52 
       
    53 // ---------------------------------------------------------------------------
       
    54 // 
       
    55 // ---------------------------------------------------------------------------
       
    56 //
       
    57 CHnAttrImgProvider::CHnAttrImgProvider()
       
    58     {
       
    59     }
       
    60 
       
    61 // ---------------------------------------------------------------------------
       
    62 // 
       
    63 // ---------------------------------------------------------------------------
       
    64 //
       
    65 CHnAttrImgProvider::~CHnAttrImgProvider()
       
    66     {
       
    67     if ( iIconHolder )
       
    68         {
       
    69         iIconHolder->Close();
       
    70         }
       
    71     }
       
    72 
       
    73 // ---------------------------------------------------------------------------
       
    74 // 
       
    75 // ---------------------------------------------------------------------------
       
    76 //
       
    77 void CHnAttrImgProvider::CreateIconL( CFbsBitmap* aBitmap, 
       
    78                                       CFbsBitmap* aMaskBitmap )
       
    79     {
       
    80     CGulIcon* newIcon = CGulIcon::NewL( aBitmap, aMaskBitmap );
       
    81     CleanupStack::PushL( newIcon );
       
    82     CHnIconHolder *newIconHolder = new (ELeave) CHnIconHolder();
       
    83     newIconHolder->SetGulIcon( newIcon );
       
    84     CleanupStack::Pop( newIcon );
       
    85     
       
    86     if ( iIconHolder )
       
    87         {
       
    88         iIconHolder->Close();
       
    89         }
       
    90     iIconHolder = newIconHolder;
       
    91     }
       
    92 
       
    93 // ---------------------------------------------------------------------------
       
    94 // 
       
    95 // ---------------------------------------------------------------------------
       
    96 //
       
    97 CGulIcon* CHnAttrImgProvider::GetIcon( TSize* /*aDesiredIconSize*/ )
       
    98     {   
       
    99     return iIconHolder ? iIconHolder->GetGulIcon() : NULL;
       
   100     }
       
   101 
       
   102 // ---------------------------------------------------------------------------
       
   103 // 
       
   104 // ---------------------------------------------------------------------------
       
   105 //
       
   106 CHnIconHolder* CHnAttrImgProvider::GetIconHolder( TSize* /*aDesiredIconSize*/ )
       
   107     {
       
   108     return iIconHolder;
       
   109     }
       
   110 
       
   111 // ---------------------------------------------------------------------------
       
   112 // 
       
   113 // ---------------------------------------------------------------------------
       
   114 //
       
   115 void CHnAttrImgProvider::RemoveLiwObjects()
       
   116     {
       
   117     }