meetingrequest/mrgui/mrfieldbuildercommon/inc/cesmreditor.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:  ESMR editor impl.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CESMREDITOR_H
       
    20 #define CESMREDITOR_H
       
    21 
       
    22 #include <eikrted.h>
       
    23 #include <eikedwob.h>
       
    24 #include "mesmrlistobserver.h"
       
    25 
       
    26 
       
    27 class CESMRLayoutManager;
       
    28 
       
    29 NONSHARABLE_CLASS( CESMREditor ): public CEikRichTextEditor,
       
    30                                   public MEikEdwinObserver
       
    31     {
       
    32 public:
       
    33     /**
       
    34      * Two phase constructor.
       
    35      */
       
    36     IMPORT_C static CESMREditor* NewL();
       
    37 
       
    38     /**
       
    39      * Two phase constructor.
       
    40      *
       
    41      * @param aParent parent control
       
    42      * @param aNumberOfLines number of visible editor lines
       
    43      * @param aTextLimit limit for text length
       
    44      * @param aEdwinFlags flags for underlying CEikEdwin
       
    45      */
       
    46     IMPORT_C static CESMREditor* NewL(
       
    47             const CCoeControl* aParent,
       
    48             TInt aNumberOfLines,
       
    49             TInt aTextLimit,
       
    50             TInt aEdwinFlags );
       
    51 
       
    52     /**
       
    53      * Destructor.
       
    54      */
       
    55     IMPORT_C virtual ~CESMREditor();
       
    56 
       
    57 public: // From CCoeControl
       
    58     IMPORT_C void PositionChanged();
       
    59     IMPORT_C TKeyResponse OfferKeyEventL(
       
    60     		const TKeyEvent& aKeyEvent,
       
    61     		TEventCode aType);
       
    62     IMPORT_C void FocusChanged(TDrawNow aDrawNow);
       
    63 
       
    64 public: // From MEikEdwinObserver
       
    65     IMPORT_C void HandleEdwinEventL(CEikEdwin* aEdwin,TEdwinEvent aEventType);
       
    66 
       
    67 public:
       
    68     /**
       
    69      * Clears selection and sets new text.
       
    70      *
       
    71      * @param aText new text
       
    72      */
       
    73     IMPORT_C void ClearSelectionAndSetTextL( const TDesC& aText );
       
    74 
       
    75     /**
       
    76      * Set font for editor.
       
    77      *
       
    78      * @param aFont new font
       
    79      * @param aLayout
       
    80      */
       
    81     IMPORT_C void SetFontL( const CFont* aFont, CESMRLayoutManager* aLayout );
       
    82 
       
    83     /**
       
    84      * Returns cursor line number.
       
    85      *
       
    86      * @return cursor line number
       
    87      */
       
    88     IMPORT_C TInt CursorLinePos() const;
       
    89 
       
    90     /**
       
    91      * Returns text line count.
       
    92      *
       
    93      * @return line count
       
    94      */
       
    95     IMPORT_C TInt LineCount() const;
       
    96 
       
    97     
       
    98     /**
       
    99 	 * Set observer.
       
   100 	 *
       
   101 	 * @param aObserver pointer to observer
       
   102 	 */
       
   103     IMPORT_C void SetListObserver( MESMRListObserver* aObserver );
       
   104 
       
   105     /**
       
   106      * Returns height of one row.
       
   107      *
       
   108      * @return row's height
       
   109      */
       
   110     IMPORT_C TInt RowHeight();
       
   111         
       
   112     /**
       
   113      * Returns line number of currenly 
       
   114      * focused row starting from one.
       
   115      * 
       
   116      * @return row's height
       
   117      */
       
   118     IMPORT_C TInt CurrentLineNumber();
       
   119 
       
   120     /**
       
   121     * Sets the default text for editor field
       
   122     * Ownership is transferred
       
   123     * @param aDefaultText default text.
       
   124     */
       
   125     IMPORT_C void SetDefaultTextL( HBufC* aDefaultText);
       
   126 
       
   127     /**
       
   128     * Returns the default text, if not set, KNullDesC is returned
       
   129     * @return TDesC default text
       
   130     */
       
   131     IMPORT_C const TDesC& DefaultText();
       
   132 
       
   133     /**
       
   134      * Returns the limited length
       
   135      * @return max length of field
       
   136      */
       
   137     IMPORT_C TInt GetLimitLength() const;
       
   138     
       
   139 private:
       
   140     /**
       
   141      * Constructor.
       
   142      */
       
   143     CESMREditor();
       
   144 
       
   145     /**
       
   146      * Second phase constructor.
       
   147      *
       
   148      * @param aParent parent control
       
   149      * @param aNumberOfLines number of visible lines in editor
       
   150      * @param aTextLimit limit for editor text length
       
   151      * @param aEdwinFlags flags passed to underlying CEikEdwin
       
   152      */
       
   153     void ConstructL(
       
   154             const CCoeControl* aParent,
       
   155             TInt aNumberOfLines,
       
   156             TInt aTextLimit,
       
   157             TInt aEdwinFlags );
       
   158 
       
   159     void TryToSetSelectionL();
       
   160 
       
   161 private:    
       
   162 	/// Ref:
       
   163     MESMRListObserver* iObserver;
       
   164 
       
   165     /// Own:
       
   166     HBufC* iDefaultText;
       
   167     
       
   168     /// Own;
       
   169     TInt iLimitLength;
       
   170     };
       
   171 
       
   172 #endif  // CESMREDITOR_H
       
   173