emailuis/emailui/inc/ncseditor.h
changeset 0 8466d47a6819
child 1 12c456ceeff2
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2007 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: This file defines class CNcsEditor.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CNCSEDITOR_H
       
    21 #define CNCSEDITOR_H
       
    22 
       
    23 
       
    24 #include <eikrted.h>
       
    25 #include <AknUtils.h>
       
    26 #include "ncscontrol.h"
       
    27 #include "ncsutility.h"
       
    28 #include "ncsconstants.h"
       
    29 
       
    30 class CAknsBasicBackgroundControlContext;
       
    31 class CNcsCustomDraw;
       
    32 class CNcsEditorCustomDraw;
       
    33 
       
    34 /**
       
    35 *  CNcsEditor
       
    36 */
       
    37 class CNcsEditor : public CEikRichTextEditor, public MNcsControl
       
    38     {
       
    39 public: // construction and destruction
       
    40     
       
    41     CNcsEditor(
       
    42         MNcsFieldSizeObserver* aSizeObserver = NULL,
       
    43         TBool aHeaderField = ETrue,
       
    44         TNcsEditorUsage aEditorUsage = ENcsEditorDefault );
       
    45     
       
    46     void ConstructL( const CCoeControl* aParent,
       
    47                      TInt aNumberOfLines,
       
    48                      TInt aTextLimit );    
       
    49 
       
    50     virtual ~CNcsEditor();
       
    51 
       
    52 public: // new functions
       
    53     
       
    54     void OpenVirtualKeyBoardL();
       
    55     
       
    56     void GetLineRectL( TRect& aLineRect ) const;
       
    57         
       
    58     virtual TInt ScrollableLines() const;
       
    59     
       
    60     virtual TInt CursorLineNumber() const;
       
    61     
       
    62     virtual TInt LineCount() const;
       
    63         
       
    64     virtual TInt CursorPosition() const;
       
    65         
       
    66     virtual const TDesC& GetLabelText() const;
       
    67 		
       
    68     // <cmail> Platform layout change       
       
    69     TInt LayoutLineCount() const;
       
    70     // </cmail> Platform layout change    
       
    71     
       
    72     virtual void Reposition(TPoint& /*aPt*/, TInt /*aWidth*/) {}
       
    73 
       
    74     void SetMaximumLabelLength( TSize aSize );
       
    75 		
       
    76     void SetupEditorL();
       
    77 		
       
    78     void PositionChanged();
       
    79         
       
    80     TInt TextHeight() const;
       
    81         
       
    82     TInt GetLineHeightL() const;
       
    83         
       
    84     TInt GetNumChars() const;
       
    85         
       
    86     TInt DocumentLength() const;
       
    87 
       
    88     TInt PixelsAboveBand() const;
       
    89     
       
    90     TInt ChangeBandTopL(TInt aPixels);
       
    91     
       
    92 	void UpdateFontSize();
       
    93 	
       
    94 	TBool HasSemicolonAtTheEndL() const;
       
    95 	
       
    96 	//<cmail>
       
    97 	void SetRealRect( TRect aRect );
       
    98 	
       
    99 	void FormatAllTextNowL();
       
   100 	//<cmail>
       
   101 
       
   102 	void UpdateCustomDrawer();
       
   103 	
       
   104 #ifdef _DEBUG
       
   105     void DebugDump();
       
   106 #endif
       
   107         
       
   108     void SetTextColorL( TLogicalRgb aColor );
       
   109 
       
   110     TInt TrimmedTextLength();
       
   111 
       
   112 // <cmail> Platform layout changes   
       
   113     void SetNcsFontType( NcsUtility::TNcsLayoutFont aFontType );
       
   114 // </cmail> Platform layout changes
       
   115 
       
   116 public: // from CoeControl
       
   117     
       
   118     virtual TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
       
   119 
       
   120     virtual void SetRect( const TRect& aRect );
       
   121     void ActivateL();
       
   122     
       
   123 public: // from CEikEdwin
       
   124 
       
   125     virtual void SetTextL( const TDesC* aDes );
       
   126 
       
   127     virtual void HandleResourceChange( TInt aType );
       
   128 
       
   129 protected: // from CEikEdwin    
       
   130     
       
   131     //<cmail> Platform layout change
       
   132     // virtual CLafEdwinCustomDrawBase* CreateCustomDrawL();
       
   133     // </cmail>
       
   134 
       
   135 protected: // from MEditObserver
       
   136 
       
   137     virtual void EditObserver( TInt aStart, TInt aExtent );
       
   138     
       
   139 private: // methods used internally
       
   140     
       
   141 	// <cmail> Platform layout change 
       
   142     void UpdateFontL();
       
   143     // </cmail> Platform layout change 
       
   144 	
       
   145     void UpdateColors();
       
   146 
       
   147     void UpdateGraphics();
       
   148     
       
   149     void DoUpdateGraphicsL();
       
   150     
       
   151     TAknTextComponentLayout GetLayout();
       
   152     //<cmail>
       
   153     void Draw( const TRect& aRect ) const;
       
   154     //</cmail>
       
   155 private: // data
       
   156     
       
   157     TInt iPreviousFontHeight;
       
   158     TInt32 iPreviousLineSpacingInTwips;
       
   159 
       
   160     TRgb iTextColor;
       
   161     CCharFormatLayer* iGlobalCharFormat;
       
   162     
       
   163     // Flag indicating whether this control is header field.
       
   164     // Header fields have different backgrounds than message field.
       
   165     TBool iHeaderField;
       
   166 
       
   167     // background control context. Owned.
       
   168     CAknsBasicBackgroundControlContext* iBgContext;
       
   169 
       
   170     // Custom drawer. Not owned.
       
   171     CNcsCustomDraw* iCustomDrawer;
       
   172 
       
   173     // Platform layout change
       
   174     NcsUtility::TNcsLayoutFont iNcsFontType;
       
   175 
       
   176     // Custom drawer for row lines. Own  
       
   177     CNcsEditorCustomDraw* iEditorCustomDrawer;
       
   178     
       
   179     // what purpose editor is used to
       
   180     TNcsEditorUsage iEditorUsage;
       
   181     
       
   182     // Real screen rectangle
       
   183     TRect iRealRect;
       
   184     };
       
   185 
       
   186 
       
   187 #endif