epoc32/include/mw/eikfpne.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
     1 /*
     2 * Copyright (c) 1997-2001 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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:
    15 *
    16 */
    17 
    18 
    19 #ifndef __EIKFPNE_H__
    20 #define __EIKFPNE_H__
    21 
    22 #ifndef __EIKEDWIN_H__
    23 #include <eikedwin.h>
    24 #endif
    25 
    26 #ifndef __AKNNUMEDWIN_H__
    27 #include <aknnumed.h>
    28 #endif
    29 
    30 /**
    31 * This class presents an editor modifying a real. The decimal place can occur anywhere.
    32 * Exponential notation is allowed. 
    33 * 
    34 * Validation, consisting of a check that the contents are parsable as a number 
    35 * (using TLex::Val()) and a range check, is carried out when PrepareForFocusLossL is called.
    36 * Invalid contents cause a leave of that method.
    37 *
    38 * Value() only returns a value corresponding reliably to the value in the editor after a 
    39 * non-leaving call to PrepareForFocusLossL. 
    40 *
    41 */
    42 class CEikFloatingPointEditor : public CAknNumericEdwin
    43 	{
    44 public:
    45 	/**
    46 	* C++ constructor
    47 	*/
    48 	IMPORT_C CEikFloatingPointEditor();
    49 	/**
    50 	* 2nd stage constructor
    51 	*/
    52 	IMPORT_C void ConstructL(const TReal& aMin,const TReal& aMax,TInt aTextLimit);
    53 	/**
    54 	* Read out the value from the editor as a Real. Value can only be relied on after 
    55 	* a non-leaving call to PrepareForFocusLossL().
    56 	*
    57 	* @return	Value in the editor	
    58 	*/
    59 	IMPORT_C TReal Value() const;
    60 	/**
    61 	* Read out the value from the editor as a Real. 
    62 	* @return	Validation status of the current value
    63 	*/
    64 	IMPORT_C TValidationStatus GetValueAsReal( TReal& aValue );
    65 	/**
    66 	* Set the value in the editor. 
    67 	*
    68 	* @param aValue pointer to value to set 
    69 	*/
    70 	IMPORT_C void SetValueL(const TReal* aValue);
    71 	/**
    72 	* Set minimum and maximum valid values.
    73 	*
    74 	* @param aMin	TInt minimum value
    75 	* @param aMax	TInt maximum value
    76 	*/
    77 	IMPORT_C void SetMinMax(TReal aMin,TReal aMax);
    78 	/**
    79 	* Get minimum and maximum valid values.
    80 	*
    81 	* @param aMin	TReal& minimum value
    82 	* @param aMax	TReal& maximum value
    83 	*/
    84 	IMPORT_C void GetMinMax(TReal& aMin,TReal& aMax) const;
    85 public: // framework
    86 	/**
    87 	* From resource constructor. Refer to eikon.rh for the FLPTED resource structure 
    88 	*
    89 	* @param	aReader		Resource reader positioned at a FLPTED resource location
    90 	*/
    91 	IMPORT_C virtual void ConstructFromResourceL(TResourceReader& aReader);
    92 	/**
    93 	* Called by framework when focus is being taken off editor. May be called
    94 	* by client code.
    95 	*/
    96 	IMPORT_C virtual void PrepareForFocusLossL();
    97 	/**
    98 	* Sets the input capabilities of the editor
    99 	*/
   100 	IMPORT_C virtual TCoeInputCapabilities InputCapabilities() const;
   101 
   102 	
   103 	/**
   104 	* Specific Key handling for numeric editor
   105 	*/
   106 	IMPORT_C virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
   107 
   108 	/** 
   109 	* Update contents of editor on certain resource change events
   110 	*/
   111 	IMPORT_C virtual void HandleResourceChange(TInt aType);
   112 
   113     /**
   114     * From CCoeControl.     
   115     * Handles pointer events
   116     * @param aPointerEvent     The pointer event.
   117     */
   118     IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
   119 private:
   120     /**
   121     * From CAknControl
   122     */
   123     IMPORT_C void* ExtensionInterface( TUid aInterface );
   124 private: // from CEikEdwin
   125 		IMPORT_C void Reserved_3();
   126 
   127 private:
   128 	TReal iValue;
   129 	TReal iMin;
   130 	TReal iMax;
   131 	TInt iSpare;
   132 	};
   133 
   134 
   135 /**
   136 * This class presents an editor modifying a real. A fixed number of decimal places is 
   137 * permitted, set by API. Exponential notation is not permitted.
   138 * 
   139 * Validation, consisting of a check that the contents are parsable as a number 
   140 * (using TLex::Val()) and a range check, is carried out when PrepareForFocusLossL is called.
   141 * Invalid contents cause a leave of that method.
   142 *
   143 * Value() only returns a value corresponding reliably to the value in the editor after a 
   144 * non-leaving call to PrepareForFocusLossL. 
   145 *
   146 * All values, defaults, minima and maxima set by API or resource are TInts.  The Real value
   147 * is obtained by dividing by 10^<number of decimal places>  
   148 * 
   149 * The number of characters in the editor is calculated from the number of allowed decimal places.
   150 * TODO but there is a bug - cannot handle + or - signs in front, nor missing leading 0s 
   151 * before the decimal place.
   152 */
   153 class CEikFixedPointEditor : public CAknNumericEdwin
   154 	{
   155 public:
   156 	/**
   157 	* C++ constructor
   158 	*/
   159 	IMPORT_C CEikFixedPointEditor();
   160 	/**
   161 	* 2nd stage Constructor
   162 	*/
   163 	IMPORT_C void ConstructL(TInt aMin,TInt aMax);
   164 	/**
   165 	* Access the value in the editor. The returned value is multiplied by 10^(decimal places) 
   166 	* before formatting to text in the editor.
   167 	* 
   168 	* The value is reliable only immediately after setting and after a non-leaving call to 
   169 	* PrepareForFocusLossL
   170 	*
   171 	* @return TInt current value in the editor. 
   172 	*/
   173 	IMPORT_C TInt Value() const;
   174 	/**
   175 	* Read out the value from the editor as a integer.
   176     * @return	Validation status of the current value
   177 	*/
   178     IMPORT_C TValidationStatus GetValueAsInteger( TInt& aValue );
   179 	/**
   180 	* Set the value in the editor. The passed value is divided by 10^(decimal places) 
   181 	* before formatting to text in the editor.
   182 	*
   183 	* @param TInt* pointer to value to set 
   184 	*/
   185 	IMPORT_C void SetValueL(const TInt* aValue);
   186 	/**
   187 	* Set minimum and maximum valid values.
   188 	*
   189 	* @param aMin	TInt minimum value multiplied by 10^(number of decimal places)
   190 	* @param aMax	TInt maximum value multiplied by 10^(number of decimal places)
   191 	*/
   192 	IMPORT_C void SetMinMax(TInt aMin, TInt aMax);
   193 	/**
   194 	* Get minimum and maximum valid values.
   195 	*
   196 	* @param aMin	TInt& minimum value multiplied by 10^(number of decimal places)
   197 	* @param aMax	TInt& maximum value multiplied by 10^(number of decimal places)
   198 	*/
   199 	IMPORT_C void GetMinMax(TInt& aMin, TInt& aMax) const;
   200 	/**
   201 	* This sets the number of allowed decimal places in the displayed text. The number
   202 	* is also used to set the power of 10 by which all integer values in the API are divided
   203 	* by before use, and the power of 10 by which all displayed values are multiplied by 
   204 	* when turning them into integers.
   205 	* 
   206 	* @param	TInt number of decimal places displayed
   207 	*/
   208 	IMPORT_C void SetDecimalPlaces(TInt aDecimalPlaces);
   209 	/**
   210 	* This returns the number of allowed decimal places in the displayed text. The number
   211 	* is that used to set the power of 10 by which all integer values in the API are divided
   212 	* by before use, and the power of 10 by which all displayed values are multiplied by 
   213 	* when turning them into integers.
   214 	* 
   215 	* @return	TInt number of decimal places displayed
   216 	*/
   217 	IMPORT_C TInt DecimalPlaces() const;
   218 public:	// framework
   219 	/**
   220 	* From resource constructor. Refer to eikon.rh for the FIXPTED resource structure 
   221 	*
   222 	* @param	aReader		Resource reader positioned at FIXPTED resource location
   223 	*/
   224 	IMPORT_C virtual void ConstructFromResourceL(TResourceReader& aReader);
   225 	/**
   226 	* Called by framework when focus is being taken off editor. May be called
   227 	* by client code.
   228 	*/
   229 	IMPORT_C virtual void PrepareForFocusLossL();
   230 	/**
   231 	* Sets the input capabilities of the editor
   232 	*/
   233 	IMPORT_C virtual TCoeInputCapabilities InputCapabilities() const;
   234 
   235 	/**
   236 	* Specific Key handling for numeric editor
   237 	*/
   238 	IMPORT_C virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
   239 
   240 	/** 
   241 	* Update contents of editor on certain resource change events
   242 	*/
   243 	IMPORT_C virtual void HandleResourceChange(TInt aType);
   244 
   245     /**
   246     * From CCoeControl.     
   247     * Handles pointer events
   248     * @param aPointerEvent     The pointer event.
   249     */
   250     IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
   251 
   252 private:
   253 	/**
   254 	* Calculates the maximum number of characters needed by the editor.  Returned values 
   255 	* is used internally to set CEikEdwin::iTextLimit 
   256 	*/
   257 	TInt RequiredNumberOfCharacters() const;
   258 private:
   259     /**
   260     * From CAknControl
   261     */
   262     IMPORT_C void* ExtensionInterface( TUid aInterface );
   263 private: // from CEikEdwin
   264 		IMPORT_C void Reserved_3();
   265 private:
   266 	TInt iValue;
   267 	TInt iMin;
   268 	TInt iMax;
   269 	TInt iDecimalPlaces;
   270 	TInt iSpare;
   271 	};
   272 #endif