meetingrequest/mrgui/mrfieldbuilderpluginextension/inc/cesmrncseditor.h
changeset 0 8466d47a6819
child 16 4ce476e64c59
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2007-2009 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 CESMRNcsEditor.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CESMRNCSEDITOR_H
       
    19 #define CESMRNCSEDITOR_H
       
    20 
       
    21 #include <eikrted.h>
       
    22 #include <AknUtils.h>
       
    23 
       
    24 class CAknsBasicBackgroundControlContext;
       
    25 class CNcsCustomDraw;
       
    26 class CESMRLayoutManager;
       
    27 
       
    28 /**
       
    29  *  CESMRNcsEditor is a specialised CEikRichTextEditor for 
       
    30  *  the email address lists for attendee fields.
       
    31  */
       
    32 NONSHARABLE_CLASS( CESMRNcsEditor ) : public CEikRichTextEditor
       
    33     {
       
    34 public:
       
    35     /** 
       
    36      * Constructor of this class
       
    37      * @param default text of the editor
       
    38      * @param aHeaderField set if editor contains a headerfield
       
    39      * @returns CESMRClsItem instance
       
    40      */
       
    41     CESMRNcsEditor( HBufC* aDefaultText );
       
    42 
       
    43     /**
       
    44      * C++ Virtual Destructor.
       
    45      */
       
    46     virtual ~CESMRNcsEditor();
       
    47 
       
    48 public: // new functions
       
    49     /**
       
    50      * Get the size and position rectangle of the editor
       
    51      * @param aLineRect rectangle of the editor
       
    52      */
       
    53     void GetLineRectL( TRect& aLineRect ) const;
       
    54 
       
    55     /**
       
    56      * Get the number of scrollable lines of the rich text editor
       
    57      * @return number of scrollable lines
       
    58      */
       
    59     virtual TInt ScrollableLines() const;
       
    60 
       
    61     /**
       
    62      * Get the current line number of the selection
       
    63      * @return current selected line number 
       
    64      */
       
    65     virtual TInt CursorLineNumber() const;
       
    66 
       
    67     /**
       
    68      * Get the number of lines in the editor
       
    69      * @return number of lines in the editor
       
    70      */
       
    71     virtual TInt LineCount() const;
       
    72 
       
    73     /**
       
    74      * Get the current position in the editor line
       
    75      * @return position in the current line of the editor
       
    76      */
       
    77     virtual TInt CursorPositionL() const;
       
    78 
       
    79     /**
       
    80      * Get the descriptor content of the editor label
       
    81      * @return descriptor of the label
       
    82      */
       
    83     virtual const TDesC& GetLabelText() const;
       
    84 
       
    85     /**
       
    86      * Set the maximum length for the label
       
    87      * @param aSize maximum length for the label
       
    88      */
       
    89     void SetMaximumLabelLength( TSize aSize );
       
    90 
       
    91     /**
       
    92      * Initialise/reset the rich text editor
       
    93      */
       
    94     void SetupEditorL();
       
    95 
       
    96     /**
       
    97      * Update editor content
       
    98      */
       
    99     void UpdateEditorL();
       
   100 
       
   101     /**
       
   102      * Update editor position
       
   103      */
       
   104     void PositionChanged();
       
   105 
       
   106     /**
       
   107      * Get the height of the text in the editor
       
   108      * @return height of the text in the editor
       
   109      */
       
   110     TInt TextHeight() const;
       
   111 
       
   112     /**
       
   113      * Get the height of the single line of text in the editor
       
   114      * @return height of the single line of text in the editor
       
   115      */
       
   116     TInt GetLineHeightL() const;
       
   117 
       
   118     /**
       
   119      * Get the number of characters in the editor
       
   120      * @return number of characters in the editor
       
   121      */
       
   122     TInt GetNumChars() const;
       
   123 
       
   124     /**
       
   125       * Get the length of the editor document
       
   126       * @return length of the editor document
       
   127       */
       
   128     TInt DocumentLength() const;
       
   129 
       
   130     /**
       
   131       * Get the number of pixels above the current editor line
       
   132       * @return number of pixels above the current editor line
       
   133       */
       
   134     TInt PixelsAboveBand() const;
       
   135 
       
   136     /**
       
   137       * Change the number of pixels above the current editor line
       
   138       * @param aPixels set the  number of pixels above the current editor line
       
   139       */
       
   140     TInt ChangeBandTopL(TInt aPixels);
       
   141 
       
   142     /**
       
   143       * Set the color of the text in the editor
       
   144       * @param aColor color of the text in the editor
       
   145       */
       
   146     void SetTextColorL( TLogicalRgb aColor );
       
   147 
       
   148     /**
       
   149       * check if the editor has default text available
       
   150       * @param ETrue if editor has default text available
       
   151       */
       
   152     TBool HasDefaultText();
       
   153 
       
   154     /**
       
   155       * Get length of text after trim
       
   156       * return length of text after trim
       
   157       */
       
   158     TInt TrimmedTextLengthL();
       
   159 
       
   160     /**
       
   161       * Set the font of the editor
       
   162       * @param aFont font of the editor
       
   163       * @param aLayout pointer to layout manager to get the font and sizes
       
   164       */
       
   165     void SetFontL( const CFont* aFont, CESMRLayoutManager* aLayout );
       
   166     
       
   167 #ifdef _DEBUG
       
   168     void DebugDump();
       
   169 #endif
       
   170 
       
   171 public: // from CoeControl
       
   172     TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
       
   173     void SetTextL( const TDesC* aDes );
       
   174     void SetRect( const TRect& aRect );
       
   175 
       
   176 protected: // from CEikEdwin
       
   177     virtual void HandleResourceChange( TInt aType );
       
   178 
       
   179 protected: // from MEditObserver
       
   180     virtual void EditObserver( TInt aStart, TInt aExtent );
       
   181 
       
   182 private: // Implementation
       
   183     void UpdateColors();
       
   184     void UpdateGraphics();
       
   185     void DoUpdateGraphicsL();
       
   186 
       
   187 private: // data
       
   188     TInt iPreviousFontHeight;
       
   189     TInt32 iPreviousLineSpacingInTwips;
       
   190     HBufC* iDefaultText;//not own
       
   191     TBool iHasDefaultText;
       
   192     TRgb iTextColor;
       
   193 
       
   194     // background control context. Owned.
       
   195     CAknsBasicBackgroundControlContext* iBgContext;
       
   196     };
       
   197 
       
   198 
       
   199 #endif