landmarksui/uicontrols/inc/CLmkMfneFloat.h
branchRCL_3
changeset 17 1fc85118c3ae
parent 16 8173571d354e
child 18 870918037e16
equal deleted inserted replaced
16:8173571d354e 17:1fc85118c3ae
     1 /*
       
     2 * Copyright (c) 2005 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 -    Floating point field for CEikMFne
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 #ifndef CLmkMfneFloat_H
       
    24 #define CLmkMfneFloat_H
       
    25 
       
    26 //  INCLUDES
       
    27 #include <eikmfne.h>
       
    28 
       
    29 // CLASS DECLARATION
       
    30 
       
    31 /**
       
    32 * CLmkMfneFloat class
       
    33 * Contain two number editor and one separator.
       
    34 */
       
    35 class CLmkMfneFloat : public CEikMfneField
       
    36     {
       
    37     public:
       
    38         virtual ~CLmkMfneFloat();
       
    39         static CLmkMfneFloat* NewL(
       
    40             TInt aMaxDigits,
       
    41             TInt aMaxDecimalDigits);
       
    42 
       
    43         TBool SetLimits(
       
    44             TReal aMinimumValue,
       
    45             TReal aMaximumValue);
       
    46 
       
    47         void GetLimits(
       
    48             TReal& aMinimumValue,
       
    49             TReal& aMaximumValue) const;
       
    50 
       
    51         void SetValue(TReal aValue);
       
    52         TReal Value() const;
       
    53 
       
    54         void HandleHighlight();
       
    55 
       
    56     private:
       
    57         CLmkMfneFloat(
       
    58             TInt aMaxDigits,
       
    59             TInt aMaxDecimalDigits);
       
    60 
       
    61         void ConstructL();
       
    62 
       
    63     // From CEikMfneField
       
    64     public:
       
    65         virtual TInt MaximumWidthInPixels(
       
    66             const CFont& aFont,
       
    67             TBool aShrinkToMinimumSize);
       
    68 
       
    69         virtual TCoeInputCapabilities InputCapabilities() const;
       
    70 
       
    71         virtual TBool IsEditable() const;
       
    72 
       
    73         // these functions may only be called if
       
    74         // IsEditable returns ETrue - all TBool&/TInt& parameters
       
    75         // in these functions must be first set to EFalse/0 by the caller
       
    76         virtual THighlightType HighlightType() const;
       
    77 
       
    78         virtual void HandleKey(
       
    79             const CFont& aFont,
       
    80             const TKeyEvent& aKeyEvent,
       
    81             TBool aInterpretLeftAndRightAsEarEvents,
       
    82             TBool& aDataAltered,
       
    83             TInt& aHighlightIncrement);
       
    84 
       
    85         virtual void HandleDeHighlight(
       
    86             const CFont& aFont,
       
    87             CEikonEnv& aEikonEnv,
       
    88             TBool& aDataAltered,
       
    89             TBool& aError);
       
    90 
       
    91     private:
       
    92         virtual const TDesC& Text() const;
       
    93 
       
    94     // New internal methods
       
    95     private:
       
    96         TBool   EnsureValueInLimits(TReal aValue);
       
    97         TInt    MaxNumOfChars() const;
       
    98 
       
    99         TBool   IsDecimalSeparatorAllowed(const TDesC& aText) const;
       
   100         TBool   IsMoreDigitsAllowed(const TDesC& aText) const;
       
   101 
       
   102         TReal   ValueFromText(const TDesC& aText) const;
       
   103         void    TextFromValue(TReal aValue, TDes& aText) const;
       
   104 
       
   105     private:
       
   106         TReal   iMinimumValue;
       
   107         TReal   iMaximumValue;
       
   108         TInt    iMaxDigits;
       
   109         TInt    iMaxDecimalDigits;
       
   110 
       
   111         HBufC*  iText;
       
   112 
       
   113         TBool   iIsBeingEditedWithCursor;
       
   114         TBool   iFocus;
       
   115     };
       
   116 
       
   117 #endif
       
   118 
       
   119 // end of File