uifw/EikStd/coctlsrc/EIKTXLBM.CPP
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 1997-1999 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 
       
    18 
       
    19 #include <eiklbm.h>
       
    20 #include <eiktxlbm.h>
       
    21 #include <badesca.h>
       
    22 
       
    23 // class CTextListBoxModel
       
    24 
       
    25 EXPORT_C CTextListBoxModel::CTextListBoxModel()
       
    26     {
       
    27     }
       
    28 
       
    29 EXPORT_C CTextListBoxModel::~CTextListBoxModel()
       
    30 	{
       
    31 	if (iItemArrayOwnershipType == ELbmOwnsItemArray)
       
    32 		delete(iItemTextArray);
       
    33 	}
       
    34 
       
    35 EXPORT_C TInt CTextListBoxModel::NumberOfItems() const
       
    36 	{
       
    37 	return iItemTextArray->MdcaCount();
       
    38 	}
       
    39 
       
    40 EXPORT_C const MDesCArray* CTextListBoxModel::MatchableTextArray() const
       
    41 	{
       
    42 	return iItemTextArray;
       
    43 	}
       
    44 
       
    45 EXPORT_C TPtrC CTextListBoxModel::ItemText(TInt aItemIndex) const
       
    46 	{
       
    47 	return iItemTextArray->MdcaPoint(aItemIndex);
       
    48 	}
       
    49 
       
    50 EXPORT_C void CTextListBoxModel::ConstructL(MDesCArray* aItemTextArray, TListBoxModelItemArrayOwnership aOwnershipType)
       
    51 	{
       
    52 	if (! aItemTextArray)
       
    53 		{
       
    54 		iItemTextArray = new(ELeave) CDesCArrayFlat(5);
       
    55 		iItemArrayOwnershipType = ELbmOwnsItemArray;
       
    56 		}
       
    57 	else
       
    58 		{ 	
       
    59 		iItemTextArray = aItemTextArray;
       
    60 		iItemArrayOwnershipType = aOwnershipType;
       
    61 		}
       
    62 	}
       
    63 
       
    64 EXPORT_C void CTextListBoxModel::SetItemTextArray(MDesCArray* aItemTextArray)
       
    65 	{
       
    66 	// __ASSERT_ALWAYS((aItemTextArray), User::Panic(_L("aItemTextArray is NULL"), 0));
       
    67 	if (iItemArrayOwnershipType == ELbmOwnsItemArray)
       
    68 		delete iItemTextArray;
       
    69 	iItemTextArray = aItemTextArray;
       
    70 	}
       
    71 
       
    72 EXPORT_C MDesCArray* CTextListBoxModel::ItemTextArray() const
       
    73 	{
       
    74 	return iItemTextArray;
       
    75 	}
       
    76 
       
    77 EXPORT_C void CTextListBoxModel::SetOwnershipType(TListBoxModelItemArrayOwnership aOwnershipType)
       
    78 	{
       
    79 	iItemArrayOwnershipType = aOwnershipType;
       
    80 	}
       
    81 
       
    82 EXPORT_C TListBoxModelItemArrayOwnership CTextListBoxModel::ItemArrayOwnershipType() const
       
    83 	{
       
    84 	return iItemArrayOwnershipType;
       
    85 	}
       
    86 
       
    87 EXPORT_C TAny* CTextListBoxModel::MListBoxModel_Reserved()
       
    88 	{
       
    89 	return NULL;
       
    90 	}