emailuis/emailui/inc/ncssubjectfield.h
branchRCL_3
changeset 64 3533d4323edc
child 73 c8382f7b54ef
equal deleted inserted replaced
63:d189ee25cf9d 64:3533d4323edc
       
     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:  Container class for compose view
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CNCSSUBJECTFIELD_H
       
    21 #define CNCSSUBJECTFIELD_H
       
    22 
       
    23 
       
    24 #include <aknview.h>
       
    25 #include <AknDef.h>
       
    26 #include "ncseditor.h"
       
    27 #include "ncscontrol.h"
       
    28 #include"ncsconstants.h"
       
    29 
       
    30 
       
    31 class CEikImage;
       
    32 class MNcsFieldSizeObserver;
       
    33 class CNcsHeaderContainer;
       
    34 class CAknPhysics;
       
    35 
       
    36 // CLASS DECLARATION
       
    37 /**
       
    38 *  CNcsSubjectField container control class.
       
    39 *
       
    40 *  @lib -
       
    41 *  @since S60 v3.0
       
    42 */
       
    43 class CNcsSubjectField : public CCoeControl, public MEikEdwinSizeObserver, public MNcsControl
       
    44     {
       
    45 public: // Constructors and destructor
       
    46 
       
    47         /**
       
    48         * NewL.
       
    49         * Two-phased constructor.
       
    50         * Create a CNcsSubjectField object, which will draw itself to aRect
       
    51         * @since S60 v3.0
       
    52         * @param aParent parent window.
       
    53         * @param aText caption text
       
    54         * @return a pointer to the created instance of CNcsSubjectField.
       
    55         */
       
    56     static CNcsSubjectField* NewL( TInt aLabelTextId,
       
    57                                    MNcsFieldSizeObserver* aSizeObserver,
       
    58                                    CNcsHeaderContainer* aParentControl );
       
    59 
       
    60     virtual ~CNcsSubjectField();
       
    61 
       
    62 public: // new functions
       
    63     
       
    64     TInt MinimumHeight();
       
    65         
       
    66     void SetSubjectL( const TDesC& aSubject );
       
    67         
       
    68     CNcsEditor* Editor() const;
       
    69         
       
    70     TInt LineCount() const;
       
    71 
       
    72     TInt CursorLineNumber() const;
       
    73 
       
    74     TInt CursorPosition() const;
       
    75 
       
    76     TInt ScrollableLines() const;
       
    77 
       
    78     TInt GetNumChars() const;
       
    79 
       
    80     const TDesC& GetLabelText() const;
       
    81     
       
    82     // <cmail> Platform layout change       
       
    83     TInt LayoutLineCount() const;
       
    84     // </cmail> Platform layout change    
       
    85     
       
    86     void GetLineRectL( TRect& aLineRect ) const;
       
    87 
       
    88     void SetMaxLabelLength( TInt aMaxLength );
       
    89 
       
    90     TInt GetMinLabelLength() const;
       
    91 
       
    92     void SelectAllTextL();
       
    93 
       
    94     void SetTextColorL( TLogicalRgb aColor );
       
    95 		
       
    96     void EnableKineticScrollingL(CAknPhysics* aPhysics );
       
    97     
       
    98     void SetPhysicsEmulationOngoing( TBool aPhysOngoing );
       
    99     
       
   100 public: // from CoeControl
       
   101         /**
       
   102         * SetContainerWinowL
       
   103         * Set the cotainer window this control should raw in
       
   104         * @since S60 v3.0
       
   105         * @param aContainer The window continer that owns this control
       
   106         */
       
   107     void SetContainerWindowL(const CCoeControl& aContainer);
       
   108 
       
   109     /**
       
   110     * Draw
       
   111     * Draw this CNcsSubjectField to the screen.
       
   112     * @since S60 v3.0
       
   113     * @param aRect the rectangle of this view that needs updating
       
   114     */
       
   115     void Draw( const TRect& aRect ) const;
       
   116         
       
   117     /**
       
   118     * From CCoeControl
       
   119     */
       
   120     void SizeChanged();
       
   121 
       
   122     void PositionChanged();
       
   123         
       
   124     TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
       
   125         
       
   126     void FocusChanged(TDrawNow aDrawNow);                  
       
   127 
       
   128     void HandleResourceChange( TInt aType );
       
   129         
       
   130     /**
       
   131     * From MEikEdwinSizeObserver
       
   132     */
       
   133     TBool HandleEdwinSizeEventL( CEikEdwin* aEdwin, TEdwinSizeEvent aEventType, TSize aDesirableEdwinSize );
       
   134         
       
   135     inline void Reposition( TPoint& aPt, TInt aWidth );
       
   136 
       
   137 private:
       
   138     
       
   139     CNcsSubjectField( MNcsFieldSizeObserver* aSizeObserver, CNcsHeaderContainer* aParentControl );
       
   140         
       
   141     void ConstructL( TInt aLabelTextId );
       
   142     
       
   143     void UpdateColors();
       
   144     
       
   145     void UpdateFontSize();
       
   146     
       
   147     //<cmail>
       
   148     void HandlePointerEventL( const TPointerEvent& aPointerEvent );
       
   149     //</cmail>
       
   150         
       
   151 private: // data
       
   152     
       
   153     CNcsHeaderContainer* iParentControl; // not owned
       
   154     
       
   155     /*
       
   156     * text field
       
   157     * Own
       
   158     */
       
   159     CNcsLabel* iLabel;
       
   160         
       
   161 // <cmail> Platform layout changes
       
   162     const CFont* iFont; // not owned, needs to be released in the end
       
   163 // </cmail> Platform layout changes
       
   164     
       
   165     /*
       
   166     * text field
       
   167     * Own
       
   168     */
       
   169     CNcsEditor* iTextEditor;
       
   170         
       
   171     TInt iEditorMinimumHeight;
       
   172             
       
   173     TInt iMaximumLabelLength;         
       
   174       	
       
   175     TRgb iBorderColor;
       
   176     
       
   177     TRgb iBgColor;
       
   178     
       
   179     TBool iDrawAfterFocusChange;
       
   180    
       
   181 // <cmail> Platform layout changes
       
   182     TInt iEditorLineCount;
       
   183 // </cmail> Platform layout changes
       
   184     };
       
   185 
       
   186 #endif // CNCSSUBJECTFIELD_H