epoc32/include/mw/aknqueryvaluetime.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
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@4
     5
* under the terms of "Eclipse Public License v1.0"
williamr@2
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.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
// AknQueryValueTime.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(__AKNQUERYVALUETIME_H__)
williamr@2
    24
#define __AKNQUERYVALUETIME_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 CAknQueryValueTimeArray;
williamr@2
    31
williamr@2
    32
/**
williamr@2
    33
 * Encapsulates a TTime 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(CAknQueryValueTime) : public CAknQueryValue
williamr@2
    39
    {
williamr@2
    40
public:
williamr@2
    41
    /**
williamr@2
    42
     * First stage of two stage construction.
williamr@2
    43
    */
williamr@2
    44
	IMPORT_C static CAknQueryValueTime* NewL();
williamr@2
    45
	
williamr@2
    46
	/**
williamr@2
    47
     * First stage of two stage construction.
williamr@2
    48
    */
williamr@2
    49
	IMPORT_C static CAknQueryValueTime* NewLC();
williamr@2
    50
    
williamr@2
    51
    IMPORT_C virtual ~CAknQueryValueTime();
williamr@2
    52
	
williamr@2
    53
	/**
williamr@2
    54
     * Set the array.
williamr@2
    55
     *  
williamr@2
    56
     * @param aArray pointer to array, ownership is not passed
williamr@2
    57
    */
williamr@2
    58
	IMPORT_C void SetArrayL(const CAknQueryValueTimeArray* aArray);
williamr@2
    59
	
williamr@2
    60
	/**
williamr@2
    61
     * Set the string used for the query caption to be a string other than the default.
williamr@2
    62
     *
williamr@2
    63
     * @param aResourceId		resource id of string to use for caption.
williamr@2
    64
     *
williamr@2
    65
    */
williamr@2
    66
	IMPORT_C void SetQueryCaption(TInt aResourceId);
williamr@2
    67
	
williamr@2
    68
	/**
williamr@2
    69
     * Return the current value, which may have been set by the user
williamr@2
    70
     *
williamr@2
    71
     * @return The current value
williamr@2
    72
     *
williamr@2
    73
    */
williamr@2
    74
	IMPORT_C TTime Value() const;
williamr@2
    75
	
williamr@2
    76
public: // from MAknQueryValue
williamr@2
    77
    IMPORT_C virtual const MDesCArray* MdcArray() const;
williamr@2
    78
    IMPORT_C virtual HBufC* CurrentValueTextLC();
williamr@2
    79
    IMPORT_C virtual TInt CurrentValueIndex() const;
williamr@2
    80
    IMPORT_C virtual void SetCurrentValueIndex(const TInt aIndex);
williamr@2
    81
    IMPORT_C virtual TBool CreateEditorL();
williamr@2
    82
    
williamr@2
    83
protected:
williamr@2
    84
	CAknQueryValueTime();
williamr@2
    85
	
williamr@2
    86
	/**
williamr@2
    87
     * Two stage construction
williamr@2
    88
     *
williamr@2
    89
    */
williamr@2
    90
	void ConstructL();
williamr@2
    91
	
williamr@2
    92
	/**
williamr@2
    93
     * Search for the current time in the list, and set the curent index 
williamr@2
    94
     * to be the found index. If not found, set current index to 1 after the size of the array.
williamr@2
    95
     *
williamr@2
    96
    */
williamr@2
    97
	void CalculateCurrentIndex();
williamr@2
    98
	
williamr@2
    99
	virtual void AppendValueIfNewL();
williamr@2
   100
	
williamr@2
   101
private: // from MAknQueryValue
williamr@2
   102
	IMPORT_C void Reserved_MAknQueryValue();
williamr@2
   103
	
williamr@2
   104
private:
williamr@2
   105
	// the following are member variables
williamr@2
   106
	TInt iQueryCaptionId;
williamr@2
   107
	TTime iTime;
williamr@2
   108
	TInt iCurrentIndex;
williamr@2
   109
	// the following are not owned
williamr@2
   110
	const CAknQueryValueTimeArray* iArray;
williamr@2
   111
    };
williamr@2
   112
williamr@2
   113
williamr@2
   114
/**
williamr@2
   115
 * Wraps an array of TTime, adapts it into a descriptor array.
williamr@2
   116
 *
williamr@2
   117
 */
williamr@2
   118
NONSHARABLE_CLASS(CAknQueryValueTimeArray) : public CBase, public MDesCArray
williamr@2
   119
	{
williamr@2
   120
public:
williamr@2
   121
    /**
williamr@2
   122
     * Typedef for array containing TTime items
williamr@2
   123
     *
williamr@2
   124
    */
williamr@2
   125
	typedef CArrayFix<TTime> TimeArray;
williamr@2
   126
	
williamr@2
   127
	enum {KSafeSizeOfDescriptorForTTimeFormat = 128};
williamr@2
   128
	
williamr@2
   129
public:
williamr@2
   130
williamr@2
   131
    /**
williamr@2
   132
     * NewL.
williamr@2
   133
     *
williamr@2
   134
     * @param aResourceId	Recource id of a TBUF containing a TTime format string. Client
williamr@2
   135
     *							can use R_AVKON_TBUF_POPUP_FIELD_DEFAULT_TIME_FORMAT
williamr@2
   136
     *							if desired, or provide its own resource.
williamr@2
   137
    */
williamr@2
   138
	IMPORT_C static CAknQueryValueTimeArray* NewL(TInt aResourceId);
williamr@2
   139
	
williamr@2
   140
	/**
williamr@2
   141
     * See NewL
williamr@2
   142
     *
williamr@2
   143
    */
williamr@2
   144
	IMPORT_C static CAknQueryValueTimeArray* NewLC(TInt aResourceId);
williamr@2
   145
	
williamr@2
   146
	IMPORT_C ~CAknQueryValueTimeArray();
williamr@2
   147
	
williamr@2
   148
	/**
williamr@2
   149
     * Set the array of values. 
williamr@2
   150
     * Note that client can use any implementation of array class, but must pass in a 
williamr@2
   151
     * TArray generated from it (by calling the Array() method on the array class)
williamr@2
   152
     *
williamr@2
   153
     * @param aArray   array of values, ownership is not passed
williamr@2
   154
    */
williamr@2
   155
	IMPORT_C void SetArray(TimeArray& aArray);
williamr@2
   156
	
williamr@2
   157
	/**
williamr@2
   158
     * Get the array of values as a TArray. 
williamr@2
   159
     * Note that client can use any implementation of array class, but the array is 
williamr@2
   160
     * treated as a TArray.
williamr@2
   161
     *
williamr@2
   162
     * @return array of values, ownership is not passed
williamr@2
   163
    */
williamr@2
   164
	IMPORT_C TimeArray* Array() const;
williamr@2
   165
	
williamr@2
   166
	/**
williamr@2
   167
     * Return the TTime format string that is used to generate MDesCArray values
williamr@2
   168
     *
williamr@2
   169
     * @return format string
williamr@2
   170
    */
williamr@2
   171
	IMPORT_C const HBufC* FormatString() const;
williamr@2
   172
    
williamr@2
   173
    /**
williamr@2
   174
     * Return the size of a maximal time string formated using the format string 
williamr@2
   175
     * that was supplied during construction of this instance.
williamr@2
   176
     * Two versions to eliminate compiler warnings.
williamr@2
   177
     *
williamr@2
   178
     * @return length of formatted string.
williamr@2
   179
    */	
williamr@2
   180
#ifdef __WINS__
williamr@2
   181
	IMPORT_C const TInt FormattedStringSize() const;
williamr@2
   182
#else
williamr@2
   183
	IMPORT_C TInt FormattedStringSize() const;
williamr@2
   184
#endif // __WINS__
williamr@2
   185
williamr@2
   186
public:
williamr@2
   187
	// from MDesCArray
williamr@2
   188
	/**
williamr@2
   189
     * @return count of contained array
williamr@2
   190
     *
williamr@2
   191
    */
williamr@2
   192
    IMPORT_C virtual TInt MdcaCount() const;
williamr@2
   193
    
williamr@2
   194
    /**
williamr@2
   195
     * Returns array element, converting value to text. 
williamr@2
   196
     * <p> WARNING: the returned pointer is only valid until the next time this
williamr@2
   197
     * method is invoked. 
williamr@2
   198
     *
williamr@2
   199
     * @param aIndex  index of element to return
williamr@2
   200
     * @return descriptor representing array element, ownership is not passed
williamr@2
   201
    */
williamr@2
   202
    IMPORT_C virtual TPtrC MdcaPoint(TInt aIndex) const;
williamr@2
   203
    
williamr@2
   204
protected:
williamr@2
   205
	CAknQueryValueTimeArray();
williamr@2
   206
	
williamr@2
   207
	/**
williamr@2
   208
     * ConstructL
williamr@2
   209
     *
williamr@2
   210
     * @param aResourceId	id of a resource containing a time format string
williamr@2
   211
    */
williamr@2
   212
	void ConstructL(TInt aResourceId);
williamr@2
   213
	
williamr@2
   214
private:
williamr@2
   215
	// the following members are owned
williamr@2
   216
	HBufC* iLastGeneratedTextValue;
williamr@2
   217
	HBufC* iFormatString;
williamr@2
   218
	// the following members are not owned
williamr@2
   219
	TimeArray* iArray;
williamr@2
   220
	TInt iFormattedStringSize;
williamr@2
   221
	};
williamr@2
   222
williamr@2
   223
#endif // __AKNQUERYVALUETIME_H__
williamr@2
   224