landmarksui/engine/src/CLmkCategoryUiItem.cpp
branchRCL_3
changeset 18 870918037e16
parent 0 522cd55cc3d7
equal deleted inserted replaced
17:1fc85118c3ae 18:870918037e16
       
     1 /*
       
     2 * Copyright (c) 2002-2009 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:    Category info item for landmarks list box model
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include "CLmkCategoryUiItem.h"
       
    23 #include <EPos_CPosLandmarkCategory.h>
       
    24 #include <lmkerrors.h>
       
    25 
       
    26 #if defined(_DEBUG)
       
    27 // CONSTANTS
       
    28 /// Unnamed namespace for local definitions
       
    29 namespace {
       
    30 
       
    31 _LIT( KPanicMsg, "CLmkCategoryUiItem" );
       
    32 
       
    33 void Panic( TPanicCode aReason )
       
    34     {
       
    35     User::Panic( KPanicMsg, aReason );
       
    36     }
       
    37 }  // namespace
       
    38 #endif
       
    39 // ============================ MEMBER FUNCTIONS ===============================
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 // CLmkCategoryUiItem::CLmkCategoryUiItem
       
    43 // C++ default constructor can NOT contain any code, that
       
    44 // might leave.
       
    45 // -----------------------------------------------------------------------------
       
    46 //
       
    47 CLmkCategoryUiItem::CLmkCategoryUiItem(
       
    48     CPosLandmarkCategory* aCategory,
       
    49     TInt aIconListIndex )
       
    50     : iCategory( aCategory ),
       
    51       iIconListIndex( aIconListIndex )
       
    52     {
       
    53     iCategory->GetCategoryName( iText );
       
    54     }
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 // CLmkCategoryUiItem::ConstructL
       
    58 // Symbian 2nd phase constructor can leave.
       
    59 // -----------------------------------------------------------------------------
       
    60 //
       
    61 void CLmkCategoryUiItem::ConstructL()
       
    62     {
       
    63     }
       
    64 
       
    65 // -----------------------------------------------------------------------------
       
    66 // CLmkCategoryUiItem::NewL
       
    67 // Two-phased constructor.
       
    68 // -----------------------------------------------------------------------------
       
    69 //
       
    70 CLmkCategoryUiItem* CLmkCategoryUiItem::NewL(
       
    71     CPosLandmarkCategory* aCategory,
       
    72     TInt aIconListIndex )
       
    73     {
       
    74     __ASSERT_DEBUG( aCategory, Panic( KLmkPanicNullMember ) );
       
    75     CLmkCategoryUiItem* self =
       
    76         new ( ELeave ) CLmkCategoryUiItem( aCategory, aIconListIndex );
       
    77 
       
    78     CleanupStack::PushL( self );
       
    79     self->ConstructL();
       
    80     CleanupStack::Pop();
       
    81 
       
    82     return self;
       
    83     }
       
    84 
       
    85 // -----------------------------------------------------------------------------
       
    86 // CLmkCategoryUiItem::~CLmkCategoryUiItem
       
    87 // -----------------------------------------------------------------------------
       
    88 //
       
    89 CLmkCategoryUiItem::~CLmkCategoryUiItem()
       
    90     {
       
    91     delete iCategory;
       
    92     }
       
    93 
       
    94 // -----------------------------------------------------------------------------
       
    95 // CLmkCategoryUiItem::Type
       
    96 // ?implementation_description
       
    97 // (other items were commented in a header).
       
    98 // -----------------------------------------------------------------------------
       
    99 //
       
   100 TLmkItemType CLmkCategoryUiItem::Type()
       
   101     {
       
   102     return ELmkItemTypeCategory;
       
   103     }
       
   104 
       
   105 // -----------------------------------------------------------------------------
       
   106 // CLmkCategoryUiItem::Text
       
   107 // ?implementation_description
       
   108 // (other items were commented in a header).
       
   109 // -----------------------------------------------------------------------------
       
   110 //
       
   111 TPtrC CLmkCategoryUiItem::Text()
       
   112     {
       
   113     return iText;
       
   114     }
       
   115 
       
   116 // -----------------------------------------------------------------------------
       
   117 // CLmkCategoryUiItem::GetIconId
       
   118 // ?implementation_description
       
   119 // (other items were commented in a header).
       
   120 // -----------------------------------------------------------------------------
       
   121 //
       
   122 TInt CLmkCategoryUiItem::GetIconId()
       
   123     {
       
   124     return iIconListIndex;
       
   125     }
       
   126 
       
   127 //  End of File