extras/about/src/AboutResource.cpp
branchRCL_3
changeset 22 bec11adf88f9
equal deleted inserted replaced
21:10c6e6d6e4d9 22:bec11adf88f9
       
     1 /*
       
     2 * Copyright (c) 2010 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: Resource for About resource loader.
       
    15 *
       
    16 */
       
    17 
       
    18 #include "AboutResource.h"
       
    19 
       
    20 
       
    21 // CONSTANTS
       
    22 const TInt KDefaultResourceIndex( -1 ); // Default resource index.
       
    23 const TInt KDefaultBitmapId( -1 ); // Default bitmap id.
       
    24 
       
    25 // ---------------------------------------------------------
       
    26 // CAboutResource::CAboutResource()
       
    27 //
       
    28 // ---------------------------------------------------------
       
    29 CAboutResource::CAboutResource():iBitmapId( KDefaultBitmapId ),
       
    30                                  iResourceItem( NULL ),
       
    31                                  iResourceIndex( KDefaultResourceIndex )
       
    32     {
       
    33     iResourceType = EAboutTextItem;
       
    34     }
       
    35 
       
    36 // ---------------------------------------------------------
       
    37 // CAboutResource::~CAboutResource()
       
    38 //
       
    39 // ---------------------------------------------------------
       
    40 CAboutResource::~CAboutResource()
       
    41     {
       
    42     if ( iResourceItem )
       
    43         {
       
    44         delete iResourceItem;
       
    45         iResourceItem = NULL;
       
    46         }
       
    47     }
       
    48 
       
    49 // ---------------------------------------------------------
       
    50 // CAboutResource::NewLC()
       
    51 //
       
    52 // ---------------------------------------------------------
       
    53 CAboutResource* CAboutResource::NewLC()
       
    54     {
       
    55     CAboutResource* self = new ( ELeave ) CAboutResource();
       
    56     CleanupStack::PushL(self);
       
    57     return self;
       
    58     }
       
    59 
       
    60 // ---------------------------------------------------------
       
    61 // CAboutResource::NewL()
       
    62 //
       
    63 // ---------------------------------------------------------
       
    64 CAboutResource* CAboutResource::NewL()
       
    65     {
       
    66     CAboutResource* self = CAboutResource::NewLC();
       
    67     CleanupStack::Pop(); // self;
       
    68     return self;
       
    69     }
       
    70 
       
    71 // ---------------------------------------------------------
       
    72 // CAboutResource::ResourceIndex()
       
    73 //
       
    74 // ---------------------------------------------------------
       
    75 TInt CAboutResource::ResourceIndex()
       
    76     {
       
    77     return iResourceIndex;
       
    78     }
       
    79 
       
    80 // ---------------------------------------------------------
       
    81 // CAboutResource::SetResourceIndex()
       
    82 //
       
    83 // ---------------------------------------------------------
       
    84 void CAboutResource::SetResourceIndex( const TInt aIndex )
       
    85     {
       
    86     iResourceIndex = aIndex;
       
    87     }
       
    88 
       
    89 // ---------------------------------------------------------
       
    90 // CAboutResource::BitmapId()
       
    91 //
       
    92 // ---------------------------------------------------------
       
    93 TInt CAboutResource::BitmapId()
       
    94     {
       
    95     return iBitmapId;
       
    96     }
       
    97 
       
    98 // ---------------------------------------------------------
       
    99 // CAboutResource::SetBitmapId()
       
   100 //
       
   101 // ---------------------------------------------------------
       
   102 void CAboutResource::SetBitmapId( const TInt aBitmapId )
       
   103     {
       
   104     iBitmapId = aBitmapId;
       
   105     }
       
   106 
       
   107 // ---------------------------------------------------------
       
   108 // CAboutResource::ResourceType()
       
   109 //
       
   110 // ---------------------------------------------------------
       
   111 TAboutItemType CAboutResource::ResourceType()
       
   112     {
       
   113     return iResourceType;
       
   114     }
       
   115 
       
   116 // ---------------------------------------------------------
       
   117 // CAboutResource::SetResourceType()
       
   118 //
       
   119 // ---------------------------------------------------------
       
   120 void CAboutResource::SetResourceType( TAboutItemType aType )
       
   121     {
       
   122     iResourceType = aType;
       
   123     }
       
   124 
       
   125 // ---------------------------------------------------------
       
   126 // CAboutResource::ResourceItem()
       
   127 //
       
   128 // ---------------------------------------------------------
       
   129 HBufC* CAboutResource::ResourceItem()
       
   130     {
       
   131     return iResourceItem;
       
   132     }
       
   133 
       
   134 // ---------------------------------------------------------
       
   135 // CAboutResource::SetResourceItem()
       
   136 //
       
   137 // ---------------------------------------------------------
       
   138 void CAboutResource::SetResourceItem( HBufC* aItem )
       
   139     {
       
   140     iResourceItem = aItem;
       
   141     }
       
   142