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 "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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
18 // AknQueryValueText.h
20 // Copyright (c) 2001 Symbian Ltd. All rights reserved.
23 #if !defined(__AKNQUERYVALUETEXT_H__)
24 #define __AKNQUERYVALUETEXT_H__
28 #include "AknQueryValue.h"
30 class CAknQueryValueTextArray;
33 * Encapsulates a string. Provides an interface to create a dialog
34 * containing a text 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(CAknQueryValueText) : public CAknQueryValue
42 * First stage of two stage construction.
44 IMPORT_C static CAknQueryValueText* NewL();
47 * First stage of two stage construction.
49 IMPORT_C static CAknQueryValueText* NewLC();
51 IMPORT_C virtual ~CAknQueryValueText();
56 * @param aArray pointer to array, ownership is not passed
58 IMPORT_C void SetArrayL(const CAknQueryValueTextArray* aArray);
61 * Set the string used for the query caption to be a string other than the default.
63 * @param aResourceId resource id of string to use for caption.
66 IMPORT_C void SetQueryCaption(TInt aResourceId);
69 * Return the current value, which may have been set by the user
71 * @return The current value, ownership is not passed
74 IMPORT_C HBufC* Value() const;
76 public: // from MAknQueryValue
77 IMPORT_C virtual const MDesCArray* MdcArray() const;
78 IMPORT_C virtual HBufC* CurrentValueTextLC();
79 IMPORT_C virtual TInt CurrentValueIndex() const;
80 IMPORT_C virtual void SetCurrentValueIndex(const TInt aIndex);
81 IMPORT_C virtual TBool CreateEditorL();
87 * Two stage construction
93 * Search for the current value in the list, and set the current index
94 * to be the found index. If not found, set current index to 1 after the size of the array.
97 void CalculateCurrentIndex();
100 * Append the current value if it is new
104 virtual void AppendValueIfNewL();
106 private: // from MAknQueryValue
107 IMPORT_C void Reserved_MAknQueryValue();
110 // the following are member variables
111 TInt iQueryCaptionId;
114 // the following are not owned
115 const CAknQueryValueTextArray* iArray;
120 * Wraps a descriptor array.
123 NONSHARABLE_CLASS(CAknQueryValueTextArray) : public CBase, public MDesCArray
130 typedef CDesCArray TextArray;
132 enum {KSafeSizeOfDescriptorForTextFormat = 32};
136 * Two-phased constructor.
139 IMPORT_C static CAknQueryValueTextArray* NewL();
142 * Two-phased constructor.
145 IMPORT_C static CAknQueryValueTextArray* NewLC();
147 IMPORT_C ~CAknQueryValueTextArray();
150 * Set the array of values.
151 * Note that client can use any implementation of array class, but must pass in a
152 * TArray generated from it (by calling the Array() method on the array class)
154 * @param aArray array of values, ownership is passed
156 IMPORT_C void SetArray(TextArray& aArray);
159 * Get the array of values as a TArray.
160 * Note that client can use any implementation of array class, but the array is
161 * treated as a TArray.
163 * @return array of values, ownership is not passed
165 IMPORT_C TextArray* Array() const;
168 * Return the size of a maximal time string formated using the format string
169 * that was supplied during construction of this instance.
170 * Two versions to eliminate compiler warnings.
172 * @return length of formatted string.
175 IMPORT_C const TInt FormattedStringSize() const;
177 IMPORT_C TInt FormattedStringSize() const;
183 * @return count of contained array
186 IMPORT_C virtual TInt MdcaCount() const;
189 * Returns array element, pass through to contained descriptor array
191 * @param aIndex index of element to return
192 * @return descriptor representing array element, ownership is not passed
194 IMPORT_C virtual TPtrC MdcaPoint(TInt aIndex) const;
197 CAknQueryValueTextArray();
200 * 2nd stage construction.
206 // the following members are not owned
208 TInt iFormattedStringSize;
211 #endif // __AKNQUERYVALUETEXT_H__