uifw/AvKon/src/AknPopupFieldText.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2002 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 *     Represents a generic text combo box type control, used to implement the
       
    16 *     Symbian OS text pop-up field.
       
    17 *     This control can be constructed directly from resource.
       
    18 *
       
    19 */
       
    20 
       
    21 // AknPopupFieldText.cpp
       
    22 //
       
    23 // Copyright (c) 1997-2001 Symbian Ltd.  All rights reserved.
       
    24 //
       
    25 
       
    26 #include "AknPopupFieldText.h"
       
    27 #include "AknPanic.h"
       
    28 #include <barsread.h>
       
    29 
       
    30 EXPORT_C CAknPopupFieldText::CAknPopupFieldText()
       
    31 	{}
       
    32 
       
    33 EXPORT_C CAknPopupFieldText::~CAknPopupFieldText()
       
    34 	{
       
    35 	delete iArray;
       
    36 	delete iTextArray;
       
    37 	delete iTextValue;
       
    38 	}
       
    39 
       
    40 
       
    41 EXPORT_C void CAknPopupFieldText::ConstructFromResourceL(TResourceReader& aReader)
       
    42 	{
       
    43 	CAknPopupField::ConstructFromResourceL(aReader);
       
    44 	TInt textArrayResourceId = aReader.ReadInt32();
       
    45 	TInt initialIndex = aReader.ReadInt16();
       
    46 
       
    47 	CommonConstructL(textArrayResourceId, initialIndex);
       
    48 	}
       
    49 
       
    50 void CAknPopupFieldText::CommonConstructL(TInt aTextArrayResourceId, TInt aInitialIndex)
       
    51 	{
       
    52  	if (aTextArrayResourceId)
       
    53 		{
       
    54 		iArray=iCoeEnv->ReadDesCArrayResourceL(aTextArrayResourceId);
       
    55 		}
       
    56 	__ASSERT_DEBUG(iArray, Panic(EAknPanicPopupFieldArrayIsEmpty));
       
    57 	__ASSERT_DEBUG(iArray->Count()>0, Panic(EAknPanicPopupFieldArrayIsEmpty));
       
    58 
       
    59 
       
    60 	iTextArray = CAknQueryValueTextArray::NewL();
       
    61 	iTextArray->SetArray(*iArray);
       
    62 	
       
    63 	iTextValue = CAknQueryValueText::NewL();
       
    64 	iTextValue->SetArrayL(iTextArray);
       
    65 	SetCurrentValueIndex(aInitialIndex);
       
    66 	CAknPopupField::SetQueryValueL(iTextValue);
       
    67 	}
       
    68 
       
    69 EXPORT_C HBufC* CAknPopupFieldText::CurrentValueTextLC()
       
    70 	{
       
    71 	return iTextValue->CurrentValueTextLC();
       
    72 	}
       
    73 
       
    74 EXPORT_C TInt CAknPopupFieldText::CurrentValueIndex() const
       
    75 	{
       
    76 	return iTextValue->CurrentValueIndex();
       
    77 	}
       
    78 
       
    79 EXPORT_C void CAknPopupFieldText::SetCurrentValueIndex(const TInt aIndex)
       
    80 	{
       
    81 	iTextValue->SetCurrentValueIndex(aIndex);
       
    82 	}
       
    83 
       
    84 EXPORT_C const MDesCArray* CAknPopupFieldText::MdcArray() const
       
    85 	{
       
    86 	return iTextValue->MdcArray();
       
    87 	}
       
    88 
       
    89 EXPORT_C void CAknPopupFieldText::SetAutoAppend(TBool aAppend)
       
    90 	{
       
    91 	iTextValue->SetAutoAppend(aAppend);
       
    92 	}
       
    93 
       
    94 void CAknPopupFieldText::ConstructL()
       
    95 	{
       
    96 	CAknPopupField::ConstructL();
       
    97 	}
       
    98 
       
    99 void CAknPopupFieldText::SetQueryValueL(MAknQueryValue* /*aValue*/) 
       
   100 	{
       
   101 	__ASSERT_DEBUG(ETrue, Panic(EAknPanicNotSupported));
       
   102 	}
       
   103 
       
   104 EXPORT_C void CAknPopupFieldText::HandlePointerEventL(const TPointerEvent& aPointerEvent) 
       
   105     { 
       
   106     CAknPopupField::HandlePointerEventL(aPointerEvent); 
       
   107     }
       
   108 
       
   109 EXPORT_C void* CAknPopupFieldText::ExtensionInterface( TUid /*aInterface*/ ) 
       
   110     { 
       
   111     return NULL;
       
   112     }
       
   113 
       
   114 EXPORT_C void CAknPopupFieldText::Reserved_1()
       
   115 	{}
       
   116 
       
   117 EXPORT_C void CAknPopupFieldText::Reserved_2()
       
   118 	{}
       
   119 
       
   120 // End of File