2 * Copyright (c) 1997-2001 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
22 #ifndef __EIKEDWIN_H__
26 #ifndef __AKNNUMEDWIN_H__
31 * This class presents an editor modifying a real. The decimal place can occur anywhere.
32 * Exponential notation is allowed.
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.
38 * Value() only returns a value corresponding reliably to the value in the editor after a
39 * non-leaving call to PrepareForFocusLossL.
42 class CEikFloatingPointEditor : public CAknNumericEdwin
48 IMPORT_C CEikFloatingPointEditor();
50 * 2nd stage constructor
52 IMPORT_C void ConstructL(const TReal& aMin,const TReal& aMax,TInt aTextLimit);
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().
57 * @return Value in the editor
59 IMPORT_C TReal Value() const;
61 * Read out the value from the editor as a Real.
62 * @return Validation status of the current value
64 IMPORT_C TValidationStatus GetValueAsReal( TReal& aValue );
66 * Set the value in the editor.
68 * @param aValue pointer to value to set
70 IMPORT_C void SetValueL(const TReal* aValue);
72 * Set minimum and maximum valid values.
74 * @param aMin TInt minimum value
75 * @param aMax TInt maximum value
77 IMPORT_C void SetMinMax(TReal aMin,TReal aMax);
79 * Get minimum and maximum valid values.
81 * @param aMin TReal& minimum value
82 * @param aMax TReal& maximum value
84 IMPORT_C void GetMinMax(TReal& aMin,TReal& aMax) const;
87 * From resource constructor. Refer to eikon.rh for the FLPTED resource structure
89 * @param aReader Resource reader positioned at a FLPTED resource location
91 IMPORT_C virtual void ConstructFromResourceL(TResourceReader& aReader);
93 * Called by framework when focus is being taken off editor. May be called
96 IMPORT_C virtual void PrepareForFocusLossL();
98 * Sets the input capabilities of the editor
100 IMPORT_C virtual TCoeInputCapabilities InputCapabilities() const;
104 * Specific Key handling for numeric editor
106 IMPORT_C virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
109 * Update contents of editor on certain resource change events
111 IMPORT_C virtual void HandleResourceChange(TInt aType);
115 * Handles pointer events
116 * @param aPointerEvent The pointer event.
118 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
123 IMPORT_C void* ExtensionInterface( TUid aInterface );
124 private: // from CEikEdwin
125 IMPORT_C void Reserved_3();
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.
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.
143 * Value() only returns a value corresponding reliably to the value in the editor after a
144 * non-leaving call to PrepareForFocusLossL.
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>
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.
153 class CEikFixedPointEditor : public CAknNumericEdwin
159 IMPORT_C CEikFixedPointEditor();
161 * 2nd stage Constructor
163 IMPORT_C void ConstructL(TInt aMin,TInt aMax);
165 * Access the value in the editor. The returned value is multiplied by 10^(decimal places)
166 * before formatting to text in the editor.
168 * The value is reliable only immediately after setting and after a non-leaving call to
169 * PrepareForFocusLossL
171 * @return TInt current value in the editor.
173 IMPORT_C TInt Value() const;
175 * Read out the value from the editor as a integer.
176 * @return Validation status of the current value
178 IMPORT_C TValidationStatus GetValueAsInteger( TInt& aValue );
180 * Set the value in the editor. The passed value is divided by 10^(decimal places)
181 * before formatting to text in the editor.
183 * @param TInt* pointer to value to set
185 IMPORT_C void SetValueL(const TInt* aValue);
187 * Set minimum and maximum valid values.
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)
192 IMPORT_C void SetMinMax(TInt aMin, TInt aMax);
194 * Get minimum and maximum valid values.
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)
199 IMPORT_C void GetMinMax(TInt& aMin, TInt& aMax) const;
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.
206 * @param TInt number of decimal places displayed
208 IMPORT_C void SetDecimalPlaces(TInt aDecimalPlaces);
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.
215 * @return TInt number of decimal places displayed
217 IMPORT_C TInt DecimalPlaces() const;
220 * From resource constructor. Refer to eikon.rh for the FIXPTED resource structure
222 * @param aReader Resource reader positioned at FIXPTED resource location
224 IMPORT_C virtual void ConstructFromResourceL(TResourceReader& aReader);
226 * Called by framework when focus is being taken off editor. May be called
229 IMPORT_C virtual void PrepareForFocusLossL();
231 * Sets the input capabilities of the editor
233 IMPORT_C virtual TCoeInputCapabilities InputCapabilities() const;
236 * Specific Key handling for numeric editor
238 IMPORT_C virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
241 * Update contents of editor on certain resource change events
243 IMPORT_C virtual void HandleResourceChange(TInt aType);
247 * Handles pointer events
248 * @param aPointerEvent The pointer event.
250 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
254 * Calculates the maximum number of characters needed by the editor. Returned values
255 * is used internally to set CEikEdwin::iTextLimit
257 TInt RequiredNumberOfCharacters() const;
262 IMPORT_C void* ExtensionInterface( TUid aInterface );
263 private: // from CEikEdwin
264 IMPORT_C void Reserved_3();