epoc32/include/mw/aknqueryvalueduration.h
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
     1.1 --- a/epoc32/include/mw/aknqueryvalueduration.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/mw/aknqueryvalueduration.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,229 @@
     1.4 -aknqueryvalueduration.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 +// AknQueryValueDuration.h
    1.23 +//
    1.24 +// Copyright (c) 2001 Symbian Ltd.  All rights reserved.
    1.25 +//
    1.26 +
    1.27 +#if !defined(__AKNQUERYVALUEDURATION_H__)
    1.28 +#define __AKNQUERYVALUEDURATION_H__
    1.29 +
    1.30 +#include <bamdesca.h>
    1.31 +#include <eikdialg.h>
    1.32 +#include "AknQueryValue.h"
    1.33 +
    1.34 +class CAknQueryValueDurationArray;
    1.35 +
    1.36 +/**
    1.37 + * Encapsulates a TTimeIntervalSeconds. Provides an interface to create a dialog
    1.38 + * containing a duration 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(CAknQueryValueDuration) : public CAknQueryValue
    1.43 +    {
    1.44 +public:
    1.45 +    /**
    1.46 +     * Two-phased constructor.
    1.47 +     *
    1.48 +    */
    1.49 +	IMPORT_C static CAknQueryValueDuration* NewL();
    1.50 +	
    1.51 +    /**
    1.52 +     * Two-phased constructor.
    1.53 +     *
    1.54 +    */
    1.55 +	IMPORT_C static CAknQueryValueDuration* NewLC();
    1.56 +    IMPORT_C virtual ~CAknQueryValueDuration();
    1.57 +    
    1.58 +    /**
    1.59 +     * Set the array.
    1.60 +     * 
    1.61 +     * @param aArray pointer to array, ownership is not passed
    1.62 +    */
    1.63 +	IMPORT_C void SetArrayL(const CAknQueryValueDurationArray* aArray);
    1.64 +	
    1.65 +    /**
    1.66 +     * Set the string used for the query caption to be a string other than the default.
    1.67 +     *
    1.68 +     * @param aResourceId		resource id of string to use for caption.
    1.69 +     *
    1.70 +    */
    1.71 +	IMPORT_C void SetQueryCaption(TInt aResourceId);
    1.72 +	
    1.73 +    /**
    1.74 +     * Return the current value, which may have been set by the user
    1.75 +     *
    1.76 +    */
    1.77 +	IMPORT_C TTimeIntervalSeconds Value() const;
    1.78 +	
    1.79 +public: // from MAknQueryValue
    1.80 +    IMPORT_C virtual const MDesCArray* MdcArray() const;
    1.81 +    IMPORT_C virtual HBufC* CurrentValueTextLC();
    1.82 +    IMPORT_C virtual TInt CurrentValueIndex() const;
    1.83 +    IMPORT_C virtual void SetCurrentValueIndex(const TInt aIndex);
    1.84 +    IMPORT_C virtual TBool CreateEditorL();
    1.85 +protected:
    1.86 +	CAknQueryValueDuration();
    1.87 +	
    1.88 +    /**
    1.89 +     * 2nd stage construction.
    1.90 +     *
    1.91 +    */
    1.92 +	void ConstructL();
    1.93 +	
    1.94 +	/**
    1.95 +     * Search for the current value in the list, and set the curent index 
    1.96 +     * to be the found index. If not found, set current index to 1 after the size of the array.
    1.97 +     *
    1.98 +     */
    1.99 +	void CalculateCurrentIndex();
   1.100 +	
   1.101 +	virtual void AppendValueIfNewL();
   1.102 +private: // from MAknQueryValue
   1.103 +	IMPORT_C void Reserved_MAknQueryValue();
   1.104 +private:
   1.105 +	// the following are member variables
   1.106 +	TInt iQueryCaptionId;
   1.107 +	TTimeIntervalSeconds iDuration;
   1.108 +	TInt iCurrentIndex;
   1.109 +	// the following are not owned
   1.110 +	const CAknQueryValueDurationArray* iArray;
   1.111 +    };
   1.112 +
   1.113 +
   1.114 +/**
   1.115 + * Wraps an array of numeric values, adapts it into a descriptor array.
   1.116 + *
   1.117 + */
   1.118 +NONSHARABLE_CLASS(CAknQueryValueDurationArray) : public CBase, public MDesCArray
   1.119 +	{
   1.120 +public:
   1.121 +    /**
   1.122 +     * Typedef for array containing TTimeIntervalSeconds items
   1.123 +     *
   1.124 +    */
   1.125 +	typedef CArrayFix<TTimeIntervalSeconds> DurationArray;
   1.126 +	
   1.127 +	enum {KSafeSizeOfDescriptorForDurationFormat = 32};
   1.128 +	
   1.129 +public:
   1.130 +    /**
   1.131 +     * Two-phased constructor..
   1.132 +     *
   1.133 +     * @param aResourceId	Recource id of a TBUF containing a duration format string. Client
   1.134 +     *							can use R_AVKON_TBUF_POPUP_FIELD_DEFAULT_DURATION_FORMAT
   1.135 +     *							if desired, or provide its own resource. (must be at least "%d%d%d")
   1.136 +    */
   1.137 +	IMPORT_C static CAknQueryValueDurationArray* NewL(TInt aResourceId);
   1.138 +	
   1.139 +    /**
   1.140 +     * See NewL
   1.141 +     *
   1.142 +    */
   1.143 +	IMPORT_C static CAknQueryValueDurationArray* NewLC(TInt aResourceId);
   1.144 +	
   1.145 +	IMPORT_C ~CAknQueryValueDurationArray();
   1.146 +	
   1.147 +    /**
   1.148 +     * Set the array of values. 
   1.149 +     * Note that client can use any implementation of array class, but must pass in a 
   1.150 +     * TArray generated from it (by calling the Array() method on the array class)
   1.151 +     *
   1.152 +     * @param aArray   array of values, ownership is not passed
   1.153 +    */
   1.154 +	IMPORT_C void SetArray(DurationArray& aArray);
   1.155 +	
   1.156 +    /**
   1.157 +     * Get the array of values as a TArray. 
   1.158 +     * Note that client can use any implementation of array class, but the array is 
   1.159 +     * treated as a TArray.
   1.160 +     *
   1.161 +     * @return array of values, ownership is not passed
   1.162 +    */
   1.163 +	IMPORT_C DurationArray* Array() const;
   1.164 +	
   1.165 +    /**
   1.166 +     * Return the TTime format string that is used to generate MDesCArray values
   1.167 +     *
   1.168 +     * @return format string
   1.169 +    */
   1.170 +	IMPORT_C const HBufC* FormatString() const;
   1.171 +	
   1.172 +    /**
   1.173 +     * Return the size of a maximal time string formated using the format string 
   1.174 +     * that was supplied during construction of this instance.
   1.175 +     * Two versions to eliminate compiler warnings.
   1.176 +     *
   1.177 +     * @return length of formatted string.
   1.178 +    */
   1.179 +#ifdef __WINS__    
   1.180 +	IMPORT_C const TInt FormattedStringSize() const;
   1.181 +#else
   1.182 +	IMPORT_C TInt FormattedStringSize() const;
   1.183 +#endif // __WINS__
   1.184 +
   1.185 +   /**
   1.186 +    * Format a descriptor with the textual version of a duration, formated according to the format string. 
   1.187 +     * Number of hours is not bounded.
   1.188 +     *
   1.189 +     * @param aText descriptor to be filled, must be of sufficient size
   1.190 +     * @param aDuration the interval to be formatted
   1.191 +     *
   1.192 +    */
   1.193 +	IMPORT_C void FormatDuration(TPtr& aText, TTimeIntervalSeconds aDuration) const;
   1.194 +	
   1.195 +public:
   1.196 +	// from MDesCArray
   1.197 +    /**
   1.198 +     * @return count of contained array
   1.199 +     *
   1.200 +    */    
   1.201 +    IMPORT_C virtual TInt MdcaCount() const;
   1.202 +    
   1.203 +    /**
   1.204 +     * Returns array element, converting value to text. 
   1.205 +     * <p> WARNING: the returned pointer is only valid until the next time this
   1.206 +     * method is invoked. 
   1.207 +     *
   1.208 +     * @param aIndex   index of element to return
   1.209 +     * @return descriptor representing array element, ownership is not passed
   1.210 +    */
   1.211 +    IMPORT_C virtual TPtrC MdcaPoint(TInt aIndex) const;
   1.212 +    
   1.213 +protected:
   1.214 +	CAknQueryValueDurationArray();
   1.215 +	
   1.216 +    /**
   1.217 +     * 2nd stage construction.
   1.218 +     *
   1.219 +    */
   1.220 +	void ConstructL(TInt aResourceId);
   1.221 +	
   1.222 +private:
   1.223 +	// the following members are owned
   1.224 +	HBufC* iLastGeneratedTextValue;
   1.225 +	HBufC* iFormatString;
   1.226 +	// the following members are not owned
   1.227 +	DurationArray* iArray;
   1.228 +	TInt iFormattedStringSize;
   1.229 +	};
   1.230 +
   1.231 +
   1.232 +#endif // __AKNQUERYVALUEDURATION_H__
   1.233 +