phonebookui/Phonebook2/UIControls/src/pbk2contactviewdoublelistboxdataelement.cpp
branchRCL_3
changeset 63 f4a778e096c2
child 64 c1e8ba0c2b16
equal deleted inserted replaced
62:5b6f26637ad3 63:f4a778e096c2
       
     1 /*
       
     2 * Copyright (c) 2009-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:  
       
    15 */
       
    16 
       
    17 #include "pbk2contactviewdoublelistboxdataelement.h"
       
    18 
       
    19 // --------------------------------------------------------------------------
       
    20 // CPbk2ContactViewDoubleListboxDataElement::NewLC
       
    21 // --------------------------------------------------------------------------
       
    22 //
       
    23 CPbk2ContactViewDoubleListboxDataElement* 
       
    24 CPbk2ContactViewDoubleListboxDataElement::NewLC()
       
    25     {
       
    26     CPbk2ContactViewDoubleListboxDataElement* self =
       
    27         new ( ELeave ) CPbk2ContactViewDoubleListboxDataElement();
       
    28 
       
    29     CleanupStack::PushL(self);
       
    30     self->ConstructL();
       
    31     return self;
       
    32     }
       
    33 
       
    34 // --------------------------------------------------------------------------
       
    35 // CPbk2ContactViewDoubleListboxDataElement::CPbk2ContactViewDoubleListboxDataElement
       
    36 // --------------------------------------------------------------------------
       
    37 //
       
    38 inline CPbk2ContactViewDoubleListboxDataElement::CPbk2ContactViewDoubleListboxDataElement()
       
    39     {
       
    40     iTexts.Reset();
       
    41     iIcons.Reset();
       
    42     iTextType.Reset();
       
    43     }
       
    44 
       
    45 // --------------------------------------------------------------------------
       
    46 // CPbk2ContactViewDoubleListboxDataElement::ConstructL
       
    47 // --------------------------------------------------------------------------
       
    48 //
       
    49 inline void CPbk2ContactViewDoubleListboxDataElement::ConstructL()
       
    50     {
       
    51     iEmptyBuffer = KNullDesC().AllocL();
       
    52     }
       
    53 
       
    54 // --------------------------------------------------------------------------
       
    55 // CPbk2ContactViewDoubleListboxDataElement::~CPbk2ContactViewDoubleListboxDataElement
       
    56 // --------------------------------------------------------------------------
       
    57 //
       
    58 CPbk2ContactViewDoubleListboxDataElement::~CPbk2ContactViewDoubleListboxDataElement()
       
    59     {
       
    60     iTexts.DeleteAll();
       
    61     delete iEmptyBuffer;
       
    62     }
       
    63 
       
    64 // --------------------------------------------------------------------------
       
    65 // CPbk2ContactViewDoubleListboxDataElement::TextPtr
       
    66 // --------------------------------------------------------------------------
       
    67 //
       
    68 TPtr CPbk2ContactViewDoubleListboxDataElement::TextPtr(
       
    69         MPbk2DoubleListboxDataElement::TTextDataElementItems aIndex) const
       
    70     {
       
    71     if( iTexts[aIndex] )
       
    72         {
       
    73         return iTexts[aIndex]->Des();
       
    74         }
       
    75     return iEmptyBuffer->Des();
       
    76     }
       
    77 
       
    78 // --------------------------------------------------------------------------
       
    79 // CPbk2ContactViewDoubleListboxDataElement::IconId
       
    80 // --------------------------------------------------------------------------
       
    81 //
       
    82 const TPbk2IconId& CPbk2ContactViewDoubleListboxDataElement::IconId( 
       
    83         MPbk2DoubleListboxDataElement::TIconDataElementItems aIndex ) const
       
    84     {
       
    85     return iIcons[aIndex];
       
    86     }
       
    87 
       
    88 // --------------------------------------------------------------------------
       
    89 // CPbk2ContactViewDoubleListboxDataElement::Text
       
    90 // --------------------------------------------------------------------------
       
    91 //
       
    92 const TDesC& CPbk2ContactViewDoubleListboxDataElement::Text( 
       
    93         MPbk2DoubleListboxDataElement::TTextDataElementItems aIndex ) const
       
    94     {
       
    95     if( iTexts[aIndex] )
       
    96         {
       
    97         return *(iTexts[aIndex]);
       
    98         }
       
    99     return *iEmptyBuffer;
       
   100     }
       
   101 
       
   102 // --------------------------------------------------------------------------
       
   103 // CPbk2ContactViewDoubleListboxDataElement::TextType
       
   104 // --------------------------------------------------------------------------
       
   105 //
       
   106 MPbk2DoubleListboxDataElement::TTextDataType 
       
   107 CPbk2ContactViewDoubleListboxDataElement::TextType(
       
   108     MPbk2DoubleListboxDataElement::TTextDataElementItems aIndex ) const
       
   109     {
       
   110     return iTextType[aIndex];
       
   111     }
       
   112 
       
   113 // --------------------------------------------------------------------------
       
   114 // CPbk2ContactViewDoubleListboxDataElement::SetIconId
       
   115 // --------------------------------------------------------------------------
       
   116 //
       
   117 void CPbk2ContactViewDoubleListboxDataElement::SetIconId(
       
   118         MPbk2DoubleListboxDataElement::TIconDataElementItems aIndex, 
       
   119         const TPbk2IconId& aIconId )
       
   120     {
       
   121     iIcons[aIndex] = aIconId;
       
   122     }
       
   123 
       
   124 // --------------------------------------------------------------------------
       
   125 // CPbk2ContactViewDoubleListboxDataElement::SetText
       
   126 // --------------------------------------------------------------------------
       
   127 //
       
   128 void CPbk2ContactViewDoubleListboxDataElement::SetText( 
       
   129         MPbk2DoubleListboxDataElement::TTextDataElementItems aIndex, 
       
   130         HBufC* aBuffer,
       
   131         MPbk2DoubleListboxDataElement::TTextDataType aType )
       
   132     {
       
   133     delete iTexts[aIndex];
       
   134     iTexts[aIndex] = aBuffer;
       
   135     iTextType[aIndex] = aType;
       
   136     }
       
   137 
       
   138 // End of File