epoc32/include/mw/aknqueryvaluedate.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     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
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description: 
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
// AknQueryValueDate.h
williamr@2
    19
//
williamr@2
    20
// Copyright (c) 2001 Symbian Ltd.  All rights reserved.
williamr@2
    21
//
williamr@2
    22
williamr@2
    23
#if !defined(__AKNQUERYVALUEDATE_H__)
williamr@2
    24
#define __AKNQUERYVALUEDATE_H__
williamr@2
    25
williamr@2
    26
#include <bamdesca.h>
williamr@2
    27
#include <eikdialg.h>
williamr@2
    28
#include "AknQueryValue.h"
williamr@2
    29
williamr@2
    30
class CAknQueryValueDateArray;
williamr@2
    31
williamr@2
    32
/**
williamr@2
    33
 * Encapsulates a date value. Provides an interface to create a dialog
williamr@2
    34
 * containing a time query control, which will edit the value. Optionally 
williamr@2
    35
 * Allows the value to be changed by selecting from a list of values. 
williamr@2
    36
 *
williamr@2
    37
 */
williamr@2
    38
NONSHARABLE_CLASS(CAknQueryValueDate) : public CAknQueryValue
williamr@2
    39
    {
williamr@2
    40
public:
williamr@2
    41
    /**
williamr@2
    42
     * Two-phased constructor.
williamr@2
    43
     *
williamr@2
    44
    */
williamr@2
    45
	IMPORT_C static CAknQueryValueDate* NewL();
williamr@2
    46
	
williamr@2
    47
    /**
williamr@2
    48
     * Two-phased constructor.
williamr@2
    49
     *
williamr@2
    50
    */	
williamr@2
    51
	IMPORT_C static CAknQueryValueDate* NewLC();
williamr@2
    52
williamr@2
    53
    /**
williamr@2
    54
     * destructor
williamr@2
    55
     *
williamr@2
    56
    */
williamr@2
    57
	IMPORT_C virtual ~CAknQueryValueDate();
williamr@2
    58
	
williamr@2
    59
    /**
williamr@2
    60
     * Set the array.
williamr@2
    61
     * 
williamr@2
    62
     * @param aArray pointer to array, ownership is not passed
williamr@2
    63
    */	
williamr@2
    64
	IMPORT_C void SetArrayL(const CAknQueryValueDateArray* aArray);
williamr@2
    65
	
williamr@2
    66
    /**
williamr@2
    67
     * Set the string used for the query caption to be a string other than the default.
williamr@2
    68
     *
williamr@2
    69
     * @param aResourceId		resource id of string to use for caption.
williamr@2
    70
     *
williamr@2
    71
    */	
williamr@2
    72
	IMPORT_C void SetQueryCaption(TInt aResourceId);
williamr@2
    73
	
williamr@2
    74
    /**
williamr@2
    75
     * Return the current value, which may have been set by the user
williamr@2
    76
     *
williamr@2
    77
    */	
williamr@2
    78
	IMPORT_C TTime Value() const;
williamr@2
    79
williamr@2
    80
public: // from MAknQueryValue
williamr@2
    81
    IMPORT_C virtual const MDesCArray* MdcArray() const;
williamr@2
    82
    IMPORT_C virtual HBufC* CurrentValueTextLC();
williamr@2
    83
    IMPORT_C virtual TInt CurrentValueIndex() const;
williamr@2
    84
    IMPORT_C virtual void SetCurrentValueIndex(const TInt aIndex);
williamr@2
    85
    IMPORT_C virtual TBool CreateEditorL();
williamr@2
    86
    
williamr@2
    87
protected:
williamr@2
    88
	CAknQueryValueDate();
williamr@2
    89
	
williamr@2
    90
	/**
williamr@2
    91
     * 2nd stage construction.
williamr@2
    92
     *
williamr@2
    93
    */
williamr@2
    94
	void ConstructL();
williamr@2
    95
	
williamr@2
    96
    /**
williamr@2
    97
     * Search for the current time in the list, and set the current index 
williamr@2
    98
     * to be the found index. If not found, set current index to 1 after the size of the array.
williamr@2
    99
     *
williamr@2
   100
    */	
williamr@2
   101
	void CalculateCurrentIndex();
williamr@2
   102
	
williamr@2
   103
	virtual void AppendValueIfNewL();
williamr@2
   104
	
williamr@2
   105
private: // from MAknQueryValue
williamr@2
   106
	IMPORT_C void Reserved_MAknQueryValue();
williamr@2
   107
williamr@2
   108
private:
williamr@2
   109
	// the following are member variables
williamr@2
   110
	TInt iQueryCaptionId;
williamr@2
   111
	TTime iTime;
williamr@2
   112
	TInt iCurrentIndex;
williamr@2
   113
	// the following are not owned
williamr@2
   114
	const CAknQueryValueDateArray* iArray;
williamr@2
   115
    };
williamr@2
   116
williamr@2
   117
williamr@2
   118
/**
williamr@2
   119
 * Wraps an array of dates, adapts it into a descriptor array.
williamr@2
   120
 *
williamr@2
   121
 */
williamr@2
   122
NONSHARABLE_CLASS(CAknQueryValueDateArray) : public CBase, public MDesCArray
williamr@2
   123
	{
williamr@2
   124
public:
williamr@2
   125
    /**
williamr@2
   126
     * Typedef for array containing TTime items
williamr@2
   127
     *
williamr@2
   128
    */
williamr@2
   129
	typedef CArrayFix<TTime> TimeArray;
williamr@2
   130
	
williamr@2
   131
williamr@2
   132
	enum {KSafeSizeOfDescriptorForTTimeFormat = 128};
williamr@2
   133
	
williamr@2
   134
public:
williamr@2
   135
    /**
williamr@2
   136
     * Two-phased constructor.
williamr@2
   137
     *
williamr@2
   138
    */
williamr@2
   139
	IMPORT_C static CAknQueryValueDateArray* NewL(TInt aResourceId);
williamr@2
   140
	
williamr@2
   141
    /**
williamr@2
   142
     * Two-phased constructor.
williamr@2
   143
     *
williamr@2
   144
    */	
williamr@2
   145
	IMPORT_C static CAknQueryValueDateArray* NewLC(TInt aResourceId);
williamr@2
   146
	
williamr@2
   147
	IMPORT_C ~CAknQueryValueDateArray();
williamr@2
   148
	
williamr@2
   149
    /**
williamr@2
   150
     * Set the array of values. 
williamr@2
   151
     * Note that client can use any implementation of array class, but must pass in a 
williamr@2
   152
     * TArray generated from it (by calling the Array() method on the array class)
williamr@2
   153
     *
williamr@2
   154
     * @param aArray  array of values, ownership is not passed
williamr@2
   155
    */
williamr@2
   156
	IMPORT_C void SetArray(TimeArray& aArray);
williamr@2
   157
	
williamr@2
   158
	/**
williamr@2
   159
     * Get the array of values as a TArray. 
williamr@2
   160
     * Note that client can use any implementation of array class, but the array is 
williamr@2
   161
     * treated as a TArray.
williamr@2
   162
     *
williamr@2
   163
     * @return array of values, ownership is not passed
williamr@2
   164
    */
williamr@2
   165
	IMPORT_C TimeArray* Array() const;
williamr@2
   166
	
williamr@2
   167
    /**
williamr@2
   168
     * Return the TTime format string that is used to generate MDesCArray values
williamr@2
   169
     *
williamr@2
   170
     * @return format string
williamr@2
   171
    */	
williamr@2
   172
	IMPORT_C const HBufC* FormatString() const;
williamr@2
   173
	
williamr@2
   174
#ifdef __WINS__
williamr@2
   175
    /**
williamr@2
   176
     * Return the size of a maximal time string formated using the format string 
williamr@2
   177
     * that was supplied during construction of this instance.
williamr@2
   178
     * Two versions to eliminate compiler warnings.
williamr@2
   179
     *	
williamr@2
   180
     * @return length of formatted string.
williamr@2
   181
    */
williamr@2
   182
	IMPORT_C const TInt FormattedStringSize() const;
williamr@2
   183
#else
williamr@2
   184
    /**
williamr@2
   185
     * See const TInt FormattedStringSize() const;
williamr@2
   186
     *
williamr@2
   187
    */
williamr@2
   188
	IMPORT_C TInt FormattedStringSize() const;
williamr@2
   189
#endif // __WINS__
williamr@2
   190
williamr@2
   191
public:
williamr@2
   192
	// from MDesCArray
williamr@2
   193
    /**
williamr@2
   194
	 * @return count of contained array
williamr@2
   195
     *
williamr@2
   196
    */
williamr@2
   197
    IMPORT_C virtual TInt MdcaCount() const;
williamr@2
   198
    
williamr@2
   199
    /**
williamr@2
   200
     * Returns array element, converting value to text. 
williamr@2
   201
     * <p> WARNING: the returned pointer is only valid until the next time this
williamr@2
   202
     * method is invoked. 
williamr@2
   203
     *
williamr@2
   204
     * @param aIndex of element to return
williamr@2
   205
     * @return descriptor representing array element, ownership is not passed
williamr@2
   206
    */
williamr@2
   207
    IMPORT_C virtual TPtrC MdcaPoint(TInt aIndex) const;
williamr@2
   208
    
williamr@2
   209
protected:
williamr@2
   210
	CAknQueryValueDateArray();
williamr@2
   211
	
williamr@2
   212
    /**
williamr@2
   213
     * 2nd stage construction.
williamr@2
   214
     *
williamr@2
   215
    */
williamr@2
   216
	void ConstructL(TInt aResourceId);
williamr@2
   217
	
williamr@2
   218
private:
williamr@2
   219
	// the following members are owned
williamr@2
   220
	HBufC* iLastGeneratedTextValue;
williamr@2
   221
	HBufC* iFormatString;
williamr@2
   222
	// the following members are not owned
williamr@2
   223
	TimeArray* iArray;
williamr@2
   224
	TInt iFormattedStringSize;
williamr@2
   225
	};
williamr@2
   226
williamr@2
   227
#endif // __AKNQUERYVALUEDATE_H__
williamr@2
   228