landmarksui/uicontrols/inc/CLmkEditorNumberField.h
branchRCL_3
changeset 17 1fc85118c3ae
parent 16 8173571d354e
child 18 870918037e16
equal deleted inserted replaced
16:8173571d354e 17:1fc85118c3ae
     1 /*
       
     2 * Copyright (c) 2002 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 "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:    LandmarksUi Content File -    Landmark editor distance field.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 #ifndef __CLMKEDITORNUMBERFIELD_H__
       
    25 #define __CLMKEDITORNUMBERFIELD_H__
       
    26 
       
    27 //  INCLUDES
       
    28 #include "CLmkEditorFieldBase.h"
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class MLmkEditorUiBuilder;
       
    32 class CEikCaptionedControl;
       
    33 class CLmkDistanceEditor;
       
    34 class CAknUnitEditor;
       
    35 class CLmkCentralRepository;
       
    36 
       
    37 
       
    38 // CLASS DECLARATION
       
    39 
       
    40 /**
       
    41  * Landmark editor distance field.
       
    42  */
       
    43 class CLmkEditorNumberField : public CLmkEditorFieldBase
       
    44     {
       
    45     public:  // Constructors and destructor
       
    46         /**
       
    47          * Creates a new instance of this class - number editor to a field.
       
    48 		 * @param aField the to be edited field
       
    49 		 * @param aUiBuilder reference to UI builder
       
    50 		 * //@param aIconInfoContainer reference to icon info container
       
    51          */
       
    52 		static CLmkEditorNumberField* NewL(
       
    53                 MLmkFieldData& aField,
       
    54                 MLmkEditorUiBuilder& aUiBuilder);
       
    55 
       
    56         /**
       
    57          * Destructor.
       
    58          */
       
    59         ~CLmkEditorNumberField();
       
    60 
       
    61     public:  // from MLmkEditorField
       
    62     	/**
       
    63     	* Saves current value to the database
       
    64     	*/
       
    65         TBool SaveFieldL();
       
    66         void ActivateL();
       
    67         /**
       
    68         * Updates the new value to the database.
       
    69         */
       
    70         void UpdateL();
       
    71         /**
       
    72         * This function handles the unit change, by applying conversion to the current
       
    73         * value based on the current unit.
       
    74         */
       
    75         void HandleUnitChangeL();
       
    76        	/**
       
    77          * Resets the field
       
    78          */
       
    79     	void ResetL();
       
    80 
       
    81     protected:  // Implementation
       
    82         CLmkEditorNumberField(
       
    83 				MLmkFieldData& aField,
       
    84 				MLmkEditorUiBuilder& aUiBuilder);
       
    85 
       
    86     private:    // implementation
       
    87         void ConstructL();
       
    88         void CreateAvkonUnitEditorL();
       
    89         //from CLmkEditorFieldBase
       
    90         TReal FieldValue() const;
       
    91         void ResolveUnitL();
       
    92         TBool IsSystemUnitMetric();
       
    93         void ConvertFromFootToMeters(TReal32& aValue);
       
    94         void ConvertFromMetersToFoot(TReal32& aValue);
       
    95 
       
    96     protected:  // Data
       
    97         /// Ref: Fields editor
       
    98        CAknUnitEditor* iControl;
       
    99        /// Ref: fields captioned control
       
   100        CEikCaptionedControl* iCaptionedCtrl;
       
   101        //owns
       
   102        CLmkCentralRepository* iRepository;
       
   103 
       
   104        //represents the current value in db
       
   105        TReal32 iDbData;
       
   106        //represents the converted value either metric or imperial.
       
   107        TReal32 iConvertedData;
       
   108     };
       
   109 
       
   110 #endif // __CLMKEDITORNUMBERFIELD_H__
       
   111 
       
   112 // End of File