1.1 --- a/epoc32/include/mw/aknqueryvaluenumber.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/mw/aknqueryvaluenumber.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,220 @@
1.4 -aknqueryvaluenumber.h
1.5 +/*
1.6 +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
1.7 +* All rights reserved.
1.8 +* This component and the accompanying materials are made available
1.9 +* 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
1.10 +* which accompanies this distribution, and is available
1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.12 +*
1.13 +* Initial Contributors:
1.14 +* Nokia Corporation - initial contribution.
1.15 +*
1.16 +* Contributors:
1.17 +*
1.18 +* Description:
1.19 +*
1.20 +*/
1.21 +
1.22 +// AknQueryValueNumber.h
1.23 +//
1.24 +// Copyright (c) 2001 Symbian Ltd. All rights reserved.
1.25 +//
1.26 +
1.27 +#if !defined(__AKNQUERYVALUENUMBER_H__)
1.28 +#define __AKNQUERYVALUENUMBER_H__
1.29 +
1.30 +#include <bamdesca.h>
1.31 +#include <eikdialg.h>
1.32 +#include "AknQueryValue.h"
1.33 +
1.34 +class CAknQueryValueNumberArray;
1.35 +
1.36 +/**
1.37 + * Encapsulates a TInt. Provides an interface to create a dialog
1.38 + * containing a number query control, which will edit the value. Optionally
1.39 + * allows the value to be changed by selecting from a list of values.
1.40 + *
1.41 + */
1.42 +NONSHARABLE_CLASS(CAknQueryValueNumber) : public CAknQueryValue
1.43 + {
1.44 +public:
1.45 + /**
1.46 + * First stage of two stage construction.
1.47 + *
1.48 + */
1.49 + IMPORT_C static CAknQueryValueNumber* NewL();
1.50 +
1.51 + /**
1.52 + * First stage of two stage construction.
1.53 + *
1.54 + */
1.55 + IMPORT_C static CAknQueryValueNumber* NewLC();
1.56 +
1.57 + IMPORT_C virtual ~CAknQueryValueNumber();
1.58 +
1.59 + /**
1.60 + * Set the array.
1.61 + *
1.62 + * @param aArray pointer to array, ownership is not passed
1.63 + */
1.64 + IMPORT_C void SetArrayL(const CAknQueryValueNumberArray* aArray);
1.65 +
1.66 + /**
1.67 + * Set the string used for the query caption to be a string other than the default.
1.68 + *
1.69 + * @param aResourceId resource id of string to use for caption.
1.70 + *
1.71 + */
1.72 + IMPORT_C void SetQueryCaption(TInt aResourceId);
1.73 +
1.74 + /**
1.75 + * Return the current value, which may have been set by the user
1.76 + *
1.77 + * @return The current value
1.78 + *
1.79 + */
1.80 + IMPORT_C TInt Value() const;
1.81 +
1.82 +public: // from MAknQueryValue
1.83 + IMPORT_C virtual const MDesCArray* MdcArray() const;
1.84 + IMPORT_C virtual HBufC* CurrentValueTextLC();
1.85 + IMPORT_C virtual TInt CurrentValueIndex() const;
1.86 + IMPORT_C virtual void SetCurrentValueIndex(const TInt aIndex);
1.87 + IMPORT_C virtual TBool CreateEditorL();
1.88 +
1.89 +protected:
1.90 + CAknQueryValueNumber();
1.91 +
1.92 + /**
1.93 + * 2nd stage construction.
1.94 + *
1.95 + */
1.96 + void ConstructL();
1.97 +
1.98 + /**
1.99 + * Search for the current value in the list, and set the curent index
1.100 + * to be the found index. If not found, set current index to 1 after the size of the array.
1.101 + *
1.102 + */
1.103 + void CalculateCurrentIndex();
1.104 + virtual void AppendValueIfNewL();
1.105 +private: // from MAknQueryValue
1.106 + IMPORT_C void Reserved_MAknQueryValue();
1.107 +private:
1.108 + // the following are member variables
1.109 + TInt iQueryCaptionId;
1.110 + TInt iNumber;
1.111 + TInt iCurrentIndex;
1.112 + // the following are not owned
1.113 + const CAknQueryValueNumberArray* iArray;
1.114 + };
1.115 +
1.116 +
1.117 +/**
1.118 + * Wraps an array of numeric values, adapts it into a descriptor array.
1.119 + *
1.120 + */
1.121 +NONSHARABLE_CLASS(CAknQueryValueNumberArray) : public CBase, public MDesCArray
1.122 + {
1.123 +public:
1.124 + /**
1.125 + * Typedef for array containing TInt items
1.126 + *
1.127 + */
1.128 + typedef CArrayFix<TInt> NumberArray;
1.129 + enum {KSafeSizeOfDescriptorForNumberFormat = 32};
1.130 +public:
1.131 +
1.132 + /**
1.133 + * Two-phased constructor..
1.134 + *
1.135 + * @param aResourceId Recource id of a TBUF containing a number format string. Client
1.136 + * can use R_AVKON_TBUF_POPUP_FIELD_DEFAULT_NUMBER_FORMAT
1.137 + * if desired, or provide its own resource.
1.138 + */
1.139 + IMPORT_C static CAknQueryValueNumberArray* NewL(TInt aResourceId);
1.140 +
1.141 + /**
1.142 + * See NewL
1.143 + *
1.144 + */
1.145 + IMPORT_C static CAknQueryValueNumberArray* NewLC(TInt aResourceId);
1.146 +
1.147 + IMPORT_C ~CAknQueryValueNumberArray();
1.148 +
1.149 + /**
1.150 + * Set the array of values.
1.151 + * Note that client can use any implementation of array class, but must pass in a
1.152 + * TArray generated from it (by calling the Array() method on the array class)
1.153 + *
1.154 + * @param aArray array of values, ownership is not passed
1.155 + */
1.156 + IMPORT_C void SetArray(NumberArray& aArray);
1.157 +
1.158 + /**
1.159 + * Get the array of values as a TArray.
1.160 + * Note that client can use any implementation of array class, but the array is
1.161 + * treated as a TArray.
1.162 + *
1.163 + * @return array of values, ownership is not passed
1.164 + */
1.165 + IMPORT_C NumberArray* Array() const;
1.166 +
1.167 + /**
1.168 + * Return the TTime format string that is used to generate MDesCArray values
1.169 + *
1.170 + * @return format string
1.171 + */
1.172 + IMPORT_C const HBufC* FormatString() const;
1.173 +
1.174 + /**
1.175 + * Return the size of a maximal time string formated using the format string
1.176 + * that was supplied during construction of this instance.
1.177 + * Two versions to eliminate compiler warnings.
1.178 + *
1.179 + * @return length of formatted string.
1.180 + */
1.181 +#ifdef __WINS__
1.182 + IMPORT_C const TInt FormattedStringSize() const;
1.183 +#else
1.184 + IMPORT_C TInt FormattedStringSize() const;
1.185 +#endif // __WINS__
1.186 +
1.187 +public:
1.188 + // from MDesCArray
1.189 + /**
1.190 + * @return count of contained array
1.191 + *
1.192 + */
1.193 + IMPORT_C virtual TInt MdcaCount() const;
1.194 +
1.195 + /**
1.196 + * Returns array element, converting value to text.
1.197 + * <p> WARNING: the returned pointer is only valid until the next time this
1.198 + * method is invoked.
1.199 + *
1.200 + * @param aIndex index of element to return
1.201 + * @return descriptor representing array element, ownership is not passed
1.202 + */
1.203 + IMPORT_C virtual TPtrC MdcaPoint(TInt aIndex) const;
1.204 +protected:
1.205 + CAknQueryValueNumberArray();
1.206 +
1.207 + /**
1.208 + * ConstructL
1.209 + *
1.210 + * @param aResourceId id of a resource containing a time format string
1.211 + */
1.212 + void ConstructL(TInt aResourceId);
1.213 +private:
1.214 + // the following members are owned
1.215 + HBufC* iLastGeneratedTextValue;
1.216 + HBufC* iFormatString;
1.217 + // the following members are not owned
1.218 + NumberArray* iArray;
1.219 + TInt iFormattedStringSize;
1.220 + };
1.221 +
1.222 +
1.223 +#endif // __AKNQUERYVALUENUMBER_H__
1.224 +