1.1 --- a/epoc32/include/mw/eikfpne.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/mw/eikfpne.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,272 @@
1.4 -eikfpne.h
1.5 +/*
1.6 +* Copyright (c) 1997-2001 Nokia Corporation and/or its subsidiary(-ies).
1.7 +* All rights reserved.
1.8 +* This component and the accompanying materials are made available
1.9 +* 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
1.10 +* which accompanies this distribution, and is available
1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.12 +*
1.13 +* Initial Contributors:
1.14 +* Nokia Corporation - initial contribution.
1.15 +*
1.16 +* Contributors:
1.17 +*
1.18 +* Description:
1.19 +*
1.20 +*/
1.21 +
1.22 +
1.23 +#ifndef __EIKFPNE_H__
1.24 +#define __EIKFPNE_H__
1.25 +
1.26 +#ifndef __EIKEDWIN_H__
1.27 +#include <eikedwin.h>
1.28 +#endif
1.29 +
1.30 +#ifndef __AKNNUMEDWIN_H__
1.31 +#include <aknnumed.h>
1.32 +#endif
1.33 +
1.34 +/**
1.35 +* This class presents an editor modifying a real. The decimal place can occur anywhere.
1.36 +* Exponential notation is allowed.
1.37 +*
1.38 +* Validation, consisting of a check that the contents are parsable as a number
1.39 +* (using TLex::Val()) and a range check, is carried out when PrepareForFocusLossL is called.
1.40 +* Invalid contents cause a leave of that method.
1.41 +*
1.42 +* Value() only returns a value corresponding reliably to the value in the editor after a
1.43 +* non-leaving call to PrepareForFocusLossL.
1.44 +*
1.45 +*/
1.46 +class CEikFloatingPointEditor : public CAknNumericEdwin
1.47 + {
1.48 +public:
1.49 + /**
1.50 + * C++ constructor
1.51 + */
1.52 + IMPORT_C CEikFloatingPointEditor();
1.53 + /**
1.54 + * 2nd stage constructor
1.55 + */
1.56 + IMPORT_C void ConstructL(const TReal& aMin,const TReal& aMax,TInt aTextLimit);
1.57 + /**
1.58 + * Read out the value from the editor as a Real. Value can only be relied on after
1.59 + * a non-leaving call to PrepareForFocusLossL().
1.60 + *
1.61 + * @return Value in the editor
1.62 + */
1.63 + IMPORT_C TReal Value() const;
1.64 + /**
1.65 + * Read out the value from the editor as a Real.
1.66 + * @return Validation status of the current value
1.67 + */
1.68 + IMPORT_C TValidationStatus GetValueAsReal( TReal& aValue );
1.69 + /**
1.70 + * Set the value in the editor.
1.71 + *
1.72 + * @param aValue pointer to value to set
1.73 + */
1.74 + IMPORT_C void SetValueL(const TReal* aValue);
1.75 + /**
1.76 + * Set minimum and maximum valid values.
1.77 + *
1.78 + * @param aMin TInt minimum value
1.79 + * @param aMax TInt maximum value
1.80 + */
1.81 + IMPORT_C void SetMinMax(TReal aMin,TReal aMax);
1.82 + /**
1.83 + * Get minimum and maximum valid values.
1.84 + *
1.85 + * @param aMin TReal& minimum value
1.86 + * @param aMax TReal& maximum value
1.87 + */
1.88 + IMPORT_C void GetMinMax(TReal& aMin,TReal& aMax) const;
1.89 +public: // framework
1.90 + /**
1.91 + * From resource constructor. Refer to eikon.rh for the FLPTED resource structure
1.92 + *
1.93 + * @param aReader Resource reader positioned at a FLPTED resource location
1.94 + */
1.95 + IMPORT_C virtual void ConstructFromResourceL(TResourceReader& aReader);
1.96 + /**
1.97 + * Called by framework when focus is being taken off editor. May be called
1.98 + * by client code.
1.99 + */
1.100 + IMPORT_C virtual void PrepareForFocusLossL();
1.101 + /**
1.102 + * Sets the input capabilities of the editor
1.103 + */
1.104 + IMPORT_C virtual TCoeInputCapabilities InputCapabilities() const;
1.105 +
1.106 +
1.107 + /**
1.108 + * Specific Key handling for numeric editor
1.109 + */
1.110 + IMPORT_C virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
1.111 +
1.112 + /**
1.113 + * Update contents of editor on certain resource change events
1.114 + */
1.115 + IMPORT_C virtual void HandleResourceChange(TInt aType);
1.116 +
1.117 + /**
1.118 + * From CCoeControl.
1.119 + * Handles pointer events
1.120 + * @param aPointerEvent The pointer event.
1.121 + */
1.122 + IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
1.123 +private:
1.124 + /**
1.125 + * From CAknControl
1.126 + */
1.127 + IMPORT_C void* ExtensionInterface( TUid aInterface );
1.128 +private: // from CEikEdwin
1.129 + IMPORT_C void Reserved_3();
1.130 +
1.131 +private:
1.132 + TReal iValue;
1.133 + TReal iMin;
1.134 + TReal iMax;
1.135 + TInt iSpare;
1.136 + };
1.137 +
1.138 +
1.139 +/**
1.140 +* This class presents an editor modifying a real. A fixed number of decimal places is
1.141 +* permitted, set by API. Exponential notation is not permitted.
1.142 +*
1.143 +* Validation, consisting of a check that the contents are parsable as a number
1.144 +* (using TLex::Val()) and a range check, is carried out when PrepareForFocusLossL is called.
1.145 +* Invalid contents cause a leave of that method.
1.146 +*
1.147 +* Value() only returns a value corresponding reliably to the value in the editor after a
1.148 +* non-leaving call to PrepareForFocusLossL.
1.149 +*
1.150 +* All values, defaults, minima and maxima set by API or resource are TInts. The Real value
1.151 +* is obtained by dividing by 10^<number of decimal places>
1.152 +*
1.153 +* The number of characters in the editor is calculated from the number of allowed decimal places.
1.154 +* TODO but there is a bug - cannot handle + or - signs in front, nor missing leading 0s
1.155 +* before the decimal place.
1.156 +*/
1.157 +class CEikFixedPointEditor : public CAknNumericEdwin
1.158 + {
1.159 +public:
1.160 + /**
1.161 + * C++ constructor
1.162 + */
1.163 + IMPORT_C CEikFixedPointEditor();
1.164 + /**
1.165 + * 2nd stage Constructor
1.166 + */
1.167 + IMPORT_C void ConstructL(TInt aMin,TInt aMax);
1.168 + /**
1.169 + * Access the value in the editor. The returned value is multiplied by 10^(decimal places)
1.170 + * before formatting to text in the editor.
1.171 + *
1.172 + * The value is reliable only immediately after setting and after a non-leaving call to
1.173 + * PrepareForFocusLossL
1.174 + *
1.175 + * @return TInt current value in the editor.
1.176 + */
1.177 + IMPORT_C TInt Value() const;
1.178 + /**
1.179 + * Read out the value from the editor as a integer.
1.180 + * @return Validation status of the current value
1.181 + */
1.182 + IMPORT_C TValidationStatus GetValueAsInteger( TInt& aValue );
1.183 + /**
1.184 + * Set the value in the editor. The passed value is divided by 10^(decimal places)
1.185 + * before formatting to text in the editor.
1.186 + *
1.187 + * @param TInt* pointer to value to set
1.188 + */
1.189 + IMPORT_C void SetValueL(const TInt* aValue);
1.190 + /**
1.191 + * Set minimum and maximum valid values.
1.192 + *
1.193 + * @param aMin TInt minimum value multiplied by 10^(number of decimal places)
1.194 + * @param aMax TInt maximum value multiplied by 10^(number of decimal places)
1.195 + */
1.196 + IMPORT_C void SetMinMax(TInt aMin, TInt aMax);
1.197 + /**
1.198 + * Get minimum and maximum valid values.
1.199 + *
1.200 + * @param aMin TInt& minimum value multiplied by 10^(number of decimal places)
1.201 + * @param aMax TInt& maximum value multiplied by 10^(number of decimal places)
1.202 + */
1.203 + IMPORT_C void GetMinMax(TInt& aMin, TInt& aMax) const;
1.204 + /**
1.205 + * This sets the number of allowed decimal places in the displayed text. The number
1.206 + * is also used to set the power of 10 by which all integer values in the API are divided
1.207 + * by before use, and the power of 10 by which all displayed values are multiplied by
1.208 + * when turning them into integers.
1.209 + *
1.210 + * @param TInt number of decimal places displayed
1.211 + */
1.212 + IMPORT_C void SetDecimalPlaces(TInt aDecimalPlaces);
1.213 + /**
1.214 + * This returns the number of allowed decimal places in the displayed text. The number
1.215 + * is that used to set the power of 10 by which all integer values in the API are divided
1.216 + * by before use, and the power of 10 by which all displayed values are multiplied by
1.217 + * when turning them into integers.
1.218 + *
1.219 + * @return TInt number of decimal places displayed
1.220 + */
1.221 + IMPORT_C TInt DecimalPlaces() const;
1.222 +public: // framework
1.223 + /**
1.224 + * From resource constructor. Refer to eikon.rh for the FIXPTED resource structure
1.225 + *
1.226 + * @param aReader Resource reader positioned at FIXPTED resource location
1.227 + */
1.228 + IMPORT_C virtual void ConstructFromResourceL(TResourceReader& aReader);
1.229 + /**
1.230 + * Called by framework when focus is being taken off editor. May be called
1.231 + * by client code.
1.232 + */
1.233 + IMPORT_C virtual void PrepareForFocusLossL();
1.234 + /**
1.235 + * Sets the input capabilities of the editor
1.236 + */
1.237 + IMPORT_C virtual TCoeInputCapabilities InputCapabilities() const;
1.238 +
1.239 + /**
1.240 + * Specific Key handling for numeric editor
1.241 + */
1.242 + IMPORT_C virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
1.243 +
1.244 + /**
1.245 + * Update contents of editor on certain resource change events
1.246 + */
1.247 + IMPORT_C virtual void HandleResourceChange(TInt aType);
1.248 +
1.249 + /**
1.250 + * From CCoeControl.
1.251 + * Handles pointer events
1.252 + * @param aPointerEvent The pointer event.
1.253 + */
1.254 + IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
1.255 +
1.256 +private:
1.257 + /**
1.258 + * Calculates the maximum number of characters needed by the editor. Returned values
1.259 + * is used internally to set CEikEdwin::iTextLimit
1.260 + */
1.261 + TInt RequiredNumberOfCharacters() const;
1.262 +private:
1.263 + /**
1.264 + * From CAknControl
1.265 + */
1.266 + IMPORT_C void* ExtensionInterface( TUid aInterface );
1.267 +private: // from CEikEdwin
1.268 + IMPORT_C void Reserved_3();
1.269 +private:
1.270 + TInt iValue;
1.271 + TInt iMin;
1.272 + TInt iMax;
1.273 + TInt iDecimalPlaces;
1.274 + TInt iSpare;
1.275 + };
1.276 +#endif