2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
18 // AknQueryValuePhone.h
20 // Copyright (c) 2001 Symbian Ltd. All rights reserved.
23 #if !defined(__AKNQUERYVALUEPHONE_H__)
24 #define __AKNQUERYVALUEPHONE_H__
28 #include "AknQueryValue.h"
30 class CAknQueryValuePhoneArray;
33 * Encapsulates a string. Provides an interface to create a dialog
34 * containing a phone number query control, which will edit the value. Optionally
35 * allows the value to be changed by selecting from a list of values.
38 NONSHARABLE_CLASS(CAknQueryValuePhone) : public CAknQueryValue
42 * First stage of two stage construction.
45 IMPORT_C static CAknQueryValuePhone* NewL();
48 * First stage of two stage construction.
51 IMPORT_C static CAknQueryValuePhone* NewLC();
53 IMPORT_C virtual ~CAknQueryValuePhone();
58 * @param aArray pointer to array, ownership is not passed
60 IMPORT_C void SetArrayL(const CAknQueryValuePhoneArray* aArray);
63 * Set the string used for the query caption to be a string other than the default.
65 * @param aResourceId resource id of string to use for caption.
68 IMPORT_C void SetQueryCaption(TInt aResourceId);
71 * Return the current value, which may have been set by the user
73 * @return The current value, ownership is not passed
76 IMPORT_C HBufC* Value() const;
78 public: // from MAknQueryValue
79 IMPORT_C virtual const MDesCArray* MdcArray() const;
80 IMPORT_C virtual HBufC* CurrentValueTextLC();
81 IMPORT_C virtual TInt CurrentValueIndex() const;
82 IMPORT_C virtual void SetCurrentValueIndex(const TInt aIndex);
83 IMPORT_C virtual TBool CreateEditorL();
86 CAknQueryValuePhone();
89 * Two stage construction
95 * Search for the current value in the list, and set the curent index
96 * to be the found index. If not found, set current index to 1 after the size of the array.
99 void CalculateCurrentIndex();
101 virtual void AppendValueIfNewL();
103 private: // from MAknQueryValue
104 IMPORT_C void Reserved_MAknQueryValue();
107 // the following are member variables
108 TInt iQueryCaptionId;
111 // the following are not owned
112 const CAknQueryValuePhoneArray* iArray;
117 * Wraps a descriptor array.
120 NONSHARABLE_CLASS(CAknQueryValuePhoneArray) : public CBase, public MDesCArray
127 typedef CDesCArray TextArray;
129 enum {KSafeSizeOfDescriptorForPhoneFormat = 64};
133 * Two-phased constructor.
136 IMPORT_C static CAknQueryValuePhoneArray* NewL();
139 * Two-phased constructor.
142 IMPORT_C static CAknQueryValuePhoneArray* NewLC();
144 IMPORT_C ~CAknQueryValuePhoneArray();
147 * Set the array of values.
148 * Note that client can use any implementation of array class, but must pass in a
149 * TArray generated from it (by calling the Array() method on the array class)
151 * @param aArray array of values, ownership is passed
153 IMPORT_C void SetArray(TextArray& aArray);
156 * Get the array of values as a TArray.
157 * Note that client can use any implementation of array class, but the array is
158 * treated as a TArray.
160 * @return array of values, ownership is not passed
162 IMPORT_C TextArray* Array() const;
165 * Return the size of a maximal time string formated using the format string
166 * that was supplied during construction of this instance.
167 * Two versions to eliminate compiler warnings.
169 * @return length of formatted string.
172 IMPORT_C const TInt FormattedStringSize() const;
174 IMPORT_C TInt FormattedStringSize() const;
180 * @return count of contained array
183 IMPORT_C virtual TInt MdcaCount() const;
186 * Returns array element, pass through to contained descriptor array
188 * @param aIndex index of element to return
189 * @return descriptor representing array element, ownership is not passed
191 IMPORT_C virtual TPtrC MdcaPoint(TInt aIndex) const;
194 CAknQueryValuePhoneArray();
197 * 2nd stage construction.
203 // the following members are not owned
205 TInt iFormattedStringSize;
208 #endif // __AKNQUERYVALUEPHONE_H__