epoc32/include/mw/aknnumedwin.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) 2002-2006 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:  Numeric Editor derived from Uikon's CEikEdwin
williamr@2
    15
*                These specializations of CEikEdwin maintain a numeric content, 
williamr@2
    16
*                access methods and validation.
williamr@2
    17
*
williamr@2
    18
*/
williamr@2
    19
williamr@2
    20
williamr@2
    21
williamr@2
    22
#if !defined(__AKNNUMEDWIN_H__)
williamr@2
    23
#define __AKNNUMEDWIN_H__
williamr@2
    24
williamr@2
    25
// INCLUDES
williamr@2
    26
#include <eikedwin.h>
williamr@2
    27
#include <aknnumed.h> // CAknNumericEdwin
williamr@2
    28
williamr@2
    29
// CONSTANTS
williamr@2
    30
_LIT( KAknIntegerFormat, "%d" );
williamr@2
    31
williamr@2
    32
// CLASS DECLARATION
williamr@2
    33
williamr@2
    34
/**
williamr@2
    35
*  The CAknIntegerEdwin class implements an editor for an integer values.
williamr@2
    36
*
williamr@2
    37
*  The editor has an associated resource struct @c AVKON_INTEGER_EDWIN and 
williamr@2
    38
*  control factory identifier @c EAknCtIntegerEdwin.
williamr@2
    39
*
williamr@2
    40
*  @since Series 60 0.9
williamr@2
    41
*/
williamr@2
    42
class CAknIntegerEdwin : public CAknNumericEdwin
williamr@2
    43
	{
williamr@2
    44
public:
williamr@2
    45
	/**
williamr@2
    46
    * Two-phased constructor.
williamr@2
    47
    * @param aMin The minimum allowable value.
williamr@2
    48
    * @param aMax The maximum allowable value.
williamr@2
    49
    * @param aMaxChars  The maximum allowable number of the digits.
williamr@2
    50
    * @return Pointer to a fully constructed editor object.
williamr@2
    51
    */
williamr@2
    52
	IMPORT_C static CAknIntegerEdwin* NewL(TInt aMin, 
williamr@2
    53
	                                       TInt aMax, 
williamr@2
    54
	                                       TInt aMaxChars);
williamr@2
    55
	
williamr@2
    56
	/**
williamr@2
    57
    * Constructs controls from a resource file.
williamr@2
    58
    * Function reads needed values from a @c AVKON_INTEGER_EDWIN resource. 
williamr@2
    59
    * Essential for Dialog/Form construction.
williamr@2
    60
    * @param aReader The resource reader with which to access the control's
williamr@2
    61
    * resource values.
williamr@2
    62
    */
williamr@2
    63
	IMPORT_C virtual void ConstructFromResourceL(TResourceReader& aReader);
williamr@2
    64
	
williamr@2
    65
	/**
williamr@2
    66
    * 2nd phase constructor.
williamr@2
    67
    * @param aMin The minimum allowable value.
williamr@2
    68
    * @param aMax The maximum allowable value.
williamr@2
    69
    * @param aMaxChars  The maximum allowable number of the digits.
williamr@2
    70
    */
williamr@2
    71
	IMPORT_C void ConstructL( TInt aMin, TInt aMax, TInt aMaxChars );
williamr@2
    72
williamr@2
    73
	// New methods
williamr@2
    74
	
williamr@2
    75
    /**
williamr@2
    76
    * Sets the current value of the editor.
williamr@2
    77
    * The control is not redrawn. 
williamr@2
    78
    * @param aValue Current value of the editor.
williamr@2
    79
    */
williamr@2
    80
	IMPORT_C void SetValueL(TInt aValue);
williamr@2
    81
	
williamr@2
    82
	/**
williamr@2
    83
    * Sets the value that is returned when the editor field is left empty or
williamr@2
    84
    * is not valid.
williamr@2
    85
    * @param aUnsetValue The default value to be returned.
williamr@2
    86
    */
williamr@2
    87
	IMPORT_C void SetUnsetValue( TInt aUnsetValue);
williamr@2
    88
	
williamr@2
    89
    /**
williamr@2
    90
    * Gets the current value of the editor.
williamr@2
    91
    * Validity of the value is checked, if the editor is empty, the unset value
williamr@2
    92
    * is used. The value is put into aValue parameter even if it is not valid.
williamr@2
    93
    * @param aValue Reference to the integer used to store the value got from
williamr@2
    94
    * the editor field.
williamr@2
    95
    * @return Indicates the validation status.
williamr@2
    96
    */
williamr@2
    97
	IMPORT_C TValidationStatus GetTextAsInteger( TInt& aValue );
williamr@2
    98
	
williamr@2
    99
	/**
williamr@2
   100
    * Sets the minimum allowable value of the editor.
williamr@2
   101
    * @param aMinimumValue The minimum value.
williamr@2
   102
    */
williamr@2
   103
	IMPORT_C void SetMinimumIntegerValue( TInt aMinimumValue );
williamr@2
   104
	
williamr@2
   105
	/**
williamr@2
   106
    * Sets the maximum allowable value of the editor.
williamr@2
   107
    * @param aMaximumValue The maximum value.
williamr@2
   108
    */
williamr@2
   109
	IMPORT_C void SetMaximumIntegerValue( TInt aMaximumValue );
williamr@2
   110
williamr@2
   111
	
williamr@2
   112
	/**
williamr@2
   113
    * From @c CCoeControl. Prepares for focus loss.
williamr@2
   114
    * Called by the framework just before focus is removed from the control.
williamr@2
   115
    */
williamr@2
   116
	IMPORT_C void PrepareForFocusLossL();
williamr@2
   117
	
williamr@2
   118
	/**
williamr@2
   119
    * From @c CCoeControl. Handles a change to the control's resources.
williamr@2
   120
    * @since Series 60 2.0
williamr@2
   121
    * @param aType a message UID value.
williamr@2
   122
    */
williamr@2
   123
	IMPORT_C void HandleResourceChange(TInt aType);
williamr@2
   124
	
williamr@2
   125
	/**
williamr@2
   126
    * From @c CCoeControl. Handles key events.
williamr@2
   127
    * Called by framework when a key event occurs.
williamr@2
   128
    * @since Series 60 2.0
williamr@2
   129
    * @param aKeyEvent The key event that occured.
williamr@2
   130
	* @param aType The type of key event that occured.
williamr@2
   131
    * @return @c EKeyWasConsumed if the event was processed,
williamr@2
   132
    * @c EKeyWasNotConsumed if the event was not processed.
williamr@2
   133
    */
williamr@2
   134
	IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
williamr@2
   135
	                                     TEventCode aType);
williamr@2
   136
williamr@2
   137
    IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);	
williamr@2
   138
williamr@2
   139
    /**
williamr@2
   140
    * Checks if the number of the editor is within the min and max boundaries.
williamr@2
   141
    * If not, the method set the number to closest legal value and highlights the 
williamr@2
   142
    * number text in the editor.
williamr@2
   143
    */
williamr@2
   144
    IMPORT_C TBool CheckNumber();    
williamr@2
   145
williamr@2
   146
private:
williamr@2
   147
	void CommonConstructL(TInt aMin, 
williamr@2
   148
	                      TInt aMax, 
williamr@2
   149
	                      TInt aMaxChars, 
williamr@2
   150
	                      TInt aFlags, 
williamr@2
   151
	                      TInt aUnset);
williamr@2
   152
	
williamr@2
   153
	void RefreshFromLocale();
williamr@2
   154
private:
williamr@2
   155
    /**
williamr@2
   156
    * From CAknControl
williamr@2
   157
    */
williamr@2
   158
    IMPORT_C void* ExtensionInterface( TUid aInterface );
williamr@2
   159
williamr@2
   160
private: // from CEikEdwin
williamr@2
   161
    IMPORT_C void Reserved_3();
williamr@2
   162
williamr@2
   163
private:
williamr@2
   164
	TInt iMinimumValue;
williamr@2
   165
	TInt iMaximumValue;
williamr@2
   166
	TInt iUnsetValue;
williamr@2
   167
	TAny* iUnsetText;
williamr@2
   168
	TDigitType iDigitType;
williamr@2
   169
	TInt iSpare_Integer_2;
williamr@2
   170
	};
williamr@2
   171
williamr@2
   172
#endif