williamr@2: /* williamr@2: * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@2: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: williamr@2: * williamr@2: */ williamr@2: williamr@2: // AknQueryValuePhone.h williamr@2: // williamr@2: // Copyright (c) 2001 Symbian Ltd. All rights reserved. williamr@2: // williamr@2: williamr@2: #if !defined(__AKNQUERYVALUEPHONE_H__) williamr@2: #define __AKNQUERYVALUEPHONE_H__ williamr@2: williamr@2: #include williamr@2: #include williamr@2: #include "AknQueryValue.h" williamr@2: williamr@2: class CAknQueryValuePhoneArray; williamr@2: williamr@2: /** williamr@2: * Encapsulates a string. Provides an interface to create a dialog williamr@2: * containing a phone number query control, which will edit the value. Optionally williamr@2: * allows the value to be changed by selecting from a list of values. williamr@2: * williamr@2: */ williamr@2: NONSHARABLE_CLASS(CAknQueryValuePhone) : public CAknQueryValue williamr@2: { williamr@2: public: williamr@2: /** williamr@2: * First stage of two stage construction. williamr@2: * williamr@2: */ williamr@2: IMPORT_C static CAknQueryValuePhone* NewL(); williamr@2: williamr@2: /** williamr@2: * First stage of two stage construction. williamr@2: * williamr@2: */ williamr@2: IMPORT_C static CAknQueryValuePhone* NewLC(); williamr@2: williamr@2: IMPORT_C virtual ~CAknQueryValuePhone(); williamr@2: williamr@2: /** williamr@2: * Set the array. williamr@2: * williamr@2: * @param aArray pointer to array, ownership is not passed williamr@2: */ williamr@2: IMPORT_C void SetArrayL(const CAknQueryValuePhoneArray* aArray); williamr@2: williamr@2: /** williamr@2: * Set the string used for the query caption to be a string other than the default. williamr@2: * williamr@2: * @param aResourceId resource id of string to use for caption. williamr@2: * williamr@2: */ williamr@2: IMPORT_C void SetQueryCaption(TInt aResourceId); williamr@2: williamr@2: /** williamr@2: * Return the current value, which may have been set by the user williamr@2: * williamr@2: * @return The current value, ownership is not passed williamr@2: * williamr@2: */ williamr@2: IMPORT_C HBufC* Value() const; williamr@2: williamr@2: public: // from MAknQueryValue williamr@2: IMPORT_C virtual const MDesCArray* MdcArray() const; williamr@2: IMPORT_C virtual HBufC* CurrentValueTextLC(); williamr@2: IMPORT_C virtual TInt CurrentValueIndex() const; williamr@2: IMPORT_C virtual void SetCurrentValueIndex(const TInt aIndex); williamr@2: IMPORT_C virtual TBool CreateEditorL(); williamr@2: williamr@2: protected: williamr@2: CAknQueryValuePhone(); williamr@2: williamr@2: /** williamr@2: * Two stage construction williamr@2: * williamr@2: */ williamr@2: void ConstructL(); williamr@2: williamr@2: /** williamr@2: * Search for the current value in the list, and set the curent index williamr@2: * to be the found index. If not found, set current index to 1 after the size of the array. williamr@2: * williamr@2: */ williamr@2: void CalculateCurrentIndex(); williamr@2: williamr@2: virtual void AppendValueIfNewL(); williamr@2: williamr@2: private: // from MAknQueryValue williamr@2: IMPORT_C void Reserved_MAknQueryValue(); williamr@2: williamr@2: private: williamr@2: // the following are member variables williamr@2: TInt iQueryCaptionId; williamr@2: HBufC* iText; williamr@2: TInt iCurrentIndex; williamr@2: // the following are not owned williamr@2: const CAknQueryValuePhoneArray* iArray; williamr@2: }; williamr@2: williamr@2: williamr@2: /** williamr@2: * Wraps a descriptor array. williamr@2: * williamr@2: */ williamr@2: NONSHARABLE_CLASS(CAknQueryValuePhoneArray) : public CBase, public MDesCArray williamr@2: { williamr@2: public: williamr@2: /** williamr@2: * Typedef for array williamr@2: * williamr@2: */ williamr@2: typedef CDesCArray TextArray; williamr@2: williamr@2: enum {KSafeSizeOfDescriptorForPhoneFormat = 64}; williamr@2: williamr@2: public: williamr@2: /** williamr@2: * Two-phased constructor. williamr@2: * williamr@2: */ williamr@2: IMPORT_C static CAknQueryValuePhoneArray* NewL(); williamr@2: williamr@2: /** williamr@2: * Two-phased constructor. williamr@2: * williamr@2: */ williamr@2: IMPORT_C static CAknQueryValuePhoneArray* NewLC(); williamr@2: williamr@2: IMPORT_C ~CAknQueryValuePhoneArray(); williamr@2: williamr@2: /** williamr@2: * Set the array of values. williamr@2: * Note that client can use any implementation of array class, but must pass in a williamr@2: * TArray generated from it (by calling the Array() method on the array class) williamr@2: * williamr@2: * @param aArray array of values, ownership is passed williamr@2: */ williamr@2: IMPORT_C void SetArray(TextArray& aArray); williamr@2: williamr@2: /** williamr@2: * Get the array of values as a TArray. williamr@2: * Note that client can use any implementation of array class, but the array is williamr@2: * treated as a TArray. williamr@2: * williamr@2: * @return array of values, ownership is not passed williamr@2: */ williamr@2: IMPORT_C TextArray* Array() const; williamr@2: williamr@2: /** williamr@2: * Return the size of a maximal time string formated using the format string williamr@2: * that was supplied during construction of this instance. williamr@2: * Two versions to eliminate compiler warnings. williamr@2: * williamr@2: * @return length of formatted string. williamr@2: */ williamr@2: #ifdef __WINS__ williamr@2: IMPORT_C const TInt FormattedStringSize() const; williamr@2: #else williamr@2: IMPORT_C TInt FormattedStringSize() const; williamr@2: #endif // __WINS__ williamr@2: williamr@2: public: williamr@2: // from MDesCArray williamr@2: /** williamr@2: * @return count of contained array williamr@2: * williamr@2: */ williamr@2: IMPORT_C virtual TInt MdcaCount() const; williamr@2: williamr@2: /** williamr@2: * Returns array element, pass through to contained descriptor array williamr@2: * williamr@2: * @param aIndex index of element to return williamr@2: * @return descriptor representing array element, ownership is not passed williamr@2: */ williamr@2: IMPORT_C virtual TPtrC MdcaPoint(TInt aIndex) const; williamr@2: williamr@2: protected: williamr@2: CAknQueryValuePhoneArray(); williamr@2: williamr@2: /** williamr@2: * 2nd stage construction. williamr@2: * williamr@2: */ williamr@2: void ConstructL(); williamr@2: williamr@2: private: williamr@2: // the following members are not owned williamr@2: TextArray* iArray; williamr@2: TInt iFormattedStringSize; williamr@2: }; williamr@2: williamr@2: #endif // __AKNQUERYVALUEPHONE_H__ williamr@2: