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