classicui_plat/queries_api/inc/AknQueryValuePhone.h
changeset 49 31c16e0c5e3e
equal deleted inserted replaced
40:7165f928e888 49:31c16e0c5e3e
       
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     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".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 // AknQueryValuePhone.h
       
    19 //
       
    20 // Copyright (c) 2001 Symbian Ltd.  All rights reserved.
       
    21 //
       
    22 
       
    23 #if !defined(__AKNQUERYVALUEPHONE_H__)
       
    24 #define __AKNQUERYVALUEPHONE_H__
       
    25 
       
    26 #include <bamdesca.h>
       
    27 #include <eikdialg.h>
       
    28 #include "AknQueryValue.h"
       
    29 
       
    30 class CAknQueryValuePhoneArray;
       
    31 
       
    32 /**
       
    33  * Encapsulates a string. Provides an interface to create a dialog
       
    34  * containing a phone number query control, which will edit the value. Optionally 
       
    35  * allows the value to be changed by selecting from a list of values. 
       
    36  *
       
    37  */
       
    38 NONSHARABLE_CLASS(CAknQueryValuePhone) : public CAknQueryValue
       
    39     {
       
    40 public:
       
    41     /**
       
    42      * First stage of two stage construction.
       
    43      *
       
    44     */
       
    45 	IMPORT_C static CAknQueryValuePhone* NewL();
       
    46 	
       
    47 	/**
       
    48      * First stage of two stage construction.
       
    49      *
       
    50     */
       
    51 	IMPORT_C static CAknQueryValuePhone* NewLC();
       
    52 	
       
    53     IMPORT_C virtual ~CAknQueryValuePhone();
       
    54 	
       
    55 	/**
       
    56      * Set the array.
       
    57      * 
       
    58      * @param aArray pointer to array, ownership is not passed
       
    59     */
       
    60 	IMPORT_C void SetArrayL(const CAknQueryValuePhoneArray* aArray);
       
    61 	
       
    62 	/**
       
    63      * Set the string used for the query caption to be a string other than the default.
       
    64      *
       
    65      * @param aResourceId		resource id of string to use for caption.
       
    66      *
       
    67     */
       
    68 	IMPORT_C void SetQueryCaption(TInt aResourceId);
       
    69 	
       
    70     /**
       
    71      * Return the current value, which may have been set by the user
       
    72      *
       
    73      * @return The current value, ownership is not passed
       
    74      *
       
    75     */	
       
    76 	IMPORT_C HBufC* Value() const;
       
    77 	
       
    78 public: // from MAknQueryValue
       
    79     IMPORT_C virtual const MDesCArray* MdcArray() const;
       
    80     IMPORT_C virtual HBufC* CurrentValueTextLC();
       
    81     IMPORT_C virtual TInt CurrentValueIndex() const;
       
    82     IMPORT_C virtual void SetCurrentValueIndex(const TInt aIndex);
       
    83     IMPORT_C virtual TBool CreateEditorL();
       
    84     
       
    85 protected:
       
    86 	CAknQueryValuePhone();
       
    87 	
       
    88     /**
       
    89      * Two stage construction
       
    90      *
       
    91     */	
       
    92 	void ConstructL();
       
    93 	
       
    94 	/**
       
    95      * Search for the current value in the list, and set the curent index 
       
    96      * to be the found index. If not found, set current index to 1 after the size of the array.
       
    97      *
       
    98     */
       
    99 	void CalculateCurrentIndex();
       
   100 	
       
   101 	virtual void AppendValueIfNewL();
       
   102 	
       
   103 private: // from MAknQueryValue
       
   104 	IMPORT_C void Reserved_MAknQueryValue();
       
   105 	
       
   106 private:
       
   107 	// the following are member variables
       
   108 	TInt iQueryCaptionId;
       
   109 	HBufC* iText;
       
   110 	TInt iCurrentIndex;
       
   111 	// the following are not owned
       
   112 	const CAknQueryValuePhoneArray* iArray;
       
   113     };
       
   114 
       
   115 
       
   116 /**
       
   117  * Wraps a descriptor array.
       
   118  *
       
   119  */
       
   120 NONSHARABLE_CLASS(CAknQueryValuePhoneArray) : public CBase, public MDesCArray
       
   121 	{
       
   122 public:
       
   123     /**
       
   124      * Typedef for array
       
   125      *
       
   126     */
       
   127 	typedef CDesCArray TextArray;
       
   128 	
       
   129 	enum {KSafeSizeOfDescriptorForPhoneFormat = 64};
       
   130 	
       
   131 public:
       
   132     /**
       
   133      * Two-phased constructor.
       
   134      *
       
   135     */
       
   136 	IMPORT_C static CAknQueryValuePhoneArray* NewL();
       
   137 	
       
   138 	/**
       
   139      * Two-phased constructor.
       
   140      *
       
   141     */
       
   142 	IMPORT_C static CAknQueryValuePhoneArray* NewLC();
       
   143 	
       
   144 	IMPORT_C ~CAknQueryValuePhoneArray();
       
   145 	
       
   146 	/**
       
   147      * Set the array of values. 
       
   148      * Note that client can use any implementation of array class, but must pass in a 
       
   149      * TArray generated from it (by calling the Array() method on the array class)
       
   150      *
       
   151      * @param aArray  array of values, ownership is passed
       
   152     */
       
   153 	IMPORT_C void SetArray(TextArray& aArray);
       
   154 	
       
   155 	/**
       
   156      * Get the array of values as a TArray. 
       
   157      * Note that client can use any implementation of array class, but the array is 
       
   158      * treated as a TArray.
       
   159      *
       
   160      * @return array of values, ownership is not passed
       
   161     */
       
   162 	IMPORT_C TextArray* Array() const;
       
   163 
       
   164 /**
       
   165  * Return the size of a maximal time string formated using the format string 
       
   166  * that was supplied during construction of this instance.
       
   167  * Two versions to eliminate compiler warnings.
       
   168  *
       
   169  * @return length of formatted string.
       
   170  */	
       
   171 #ifdef __WINS__
       
   172 	IMPORT_C const TInt FormattedStringSize() const;
       
   173 #else
       
   174 	IMPORT_C TInt FormattedStringSize() const;
       
   175 #endif // __WINS__
       
   176 
       
   177 public:
       
   178 	// from MDesCArray
       
   179 	/**
       
   180      * @return count of contained array
       
   181      *
       
   182     */
       
   183     IMPORT_C virtual TInt MdcaCount() const;
       
   184     
       
   185     /**
       
   186      * Returns array element, pass through to contained descriptor array
       
   187      *
       
   188      * @param aIndex   index of element to return
       
   189      * @return descriptor representing array element, ownership is not passed
       
   190     */
       
   191     IMPORT_C virtual TPtrC MdcaPoint(TInt aIndex) const;
       
   192     
       
   193 protected:
       
   194 	CAknQueryValuePhoneArray();
       
   195 	
       
   196     /**
       
   197      * 2nd stage construction.
       
   198      *
       
   199     */
       
   200 	void ConstructL();
       
   201 	
       
   202 private:
       
   203 	// the following members are not owned
       
   204 	TextArray* iArray;
       
   205 	TInt iFormattedStringSize;
       
   206 	};
       
   207 
       
   208 #endif // __AKNQUERYVALUEPHONE_H__
       
   209