emailuis/emailui/inc/ncssubjectfield.h
changeset 0 8466d47a6819
child 8 e1b6206813b4
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:  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 
       
    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 public: // from CoeControl
       
    97         /**
       
    98         * SetContainerWinowL
       
    99         * Set the cotainer window this control should raw in
       
   100         * @since S60 v3.0
       
   101         * @param aContainer The window continer that owns this control
       
   102         */
       
   103     void SetContainerWindowL(const CCoeControl& aContainer);
       
   104 
       
   105     /**
       
   106     * Draw
       
   107     * Draw this CNcsSubjectField to the screen.
       
   108     * @since S60 v3.0
       
   109     * @param aRect the rectangle of this view that needs updating
       
   110     */
       
   111     void Draw( const TRect& aRect ) const;
       
   112         
       
   113     /**
       
   114     * From CCoeControl
       
   115     */
       
   116     void SizeChanged();
       
   117 
       
   118     void PositionChanged();
       
   119         
       
   120     TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
       
   121         
       
   122     void FocusChanged(TDrawNow aDrawNow);                  
       
   123 
       
   124     void HandleResourceChange( TInt aType );
       
   125         
       
   126     /**
       
   127     * From MEikEdwinSizeObserver
       
   128     */
       
   129     TBool HandleEdwinSizeEventL( CEikEdwin* aEdwin, TEdwinSizeEvent aEventType, TSize aDesirableEdwinSize );
       
   130         
       
   131     inline void Reposition( TPoint& aPt, TInt aWidth );
       
   132 
       
   133 private:
       
   134     
       
   135     CNcsSubjectField( MNcsFieldSizeObserver* aSizeObserver, CNcsHeaderContainer* aParentControl );
       
   136         
       
   137     void ConstructL( TInt aLabelTextId );
       
   138     
       
   139     void UpdateColors();
       
   140     
       
   141     void UpdateFontSize();
       
   142     
       
   143 
       
   144     void HandleFocusChangedL();
       
   145     
       
   146     static TInt DoHandleFocusChanged( TAny* aSelfPtr ); 
       
   147     
       
   148     //<cmail>
       
   149     void HandlePointerEventL( const TPointerEvent& aPointerEvent );
       
   150     //</cmail>
       
   151         
       
   152 private: // data
       
   153     
       
   154     CNcsHeaderContainer* iParentControl; // not owned
       
   155     
       
   156     /*
       
   157     * text field
       
   158     * Own
       
   159     */
       
   160     CNcsLabel* iLabel;
       
   161         
       
   162 // <cmail> Platform layout changes
       
   163     const CFont* iFont; // not owned, needs to be released in the end
       
   164 // </cmail> Platform layout changes
       
   165     
       
   166     /*
       
   167     * text field
       
   168     * Own
       
   169     */
       
   170     CNcsEditor* iTextEditor;
       
   171         
       
   172     TInt iEditorMinimumHeight;
       
   173             
       
   174     TInt iMaximumLabelLength;         
       
   175       	
       
   176     TRgb iBorderColor;
       
   177     
       
   178     TRgb iBgColor;
       
   179     
       
   180     CAsyncCallBack* iFocusChangeHandler;
       
   181     
       
   182     TBool iDrawAfterFocusChange;
       
   183    
       
   184 // <cmail> Platform layout changes
       
   185     TInt iEditorLineCount;
       
   186 // </cmail> Platform layout changes
       
   187     };
       
   188 
       
   189 #endif // CNCSSUBJECTFIELD_H