emailuis/emailui/inc/ncsattachmentfield.h
branchRCL_3
changeset 64 3533d4323edc
child 80 726fba06891a
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 CNCSATTACHMENTFIELD_H
       
    21 #define CNCSATTACHMENTFIELD_H
       
    22 
       
    23 
       
    24 #include "ncscontrol.h"
       
    25 
       
    26 
       
    27 class MNcsFieldSizeObserver;
       
    28 class CNcsHeaderContainer;
       
    29 
       
    30 
       
    31 /**
       
    32  *  CNcsAttachmentField
       
    33  */
       
    34 class CNcsAttachmentField: 
       
    35 	public CCoeControl,
       
    36 	public MNcsControl
       
    37     {
       
    38 public: // construct & destruct
       
    39 
       
    40     static CNcsAttachmentField* NewL( 
       
    41     	TInt aLabelTextId,
       
    42         MNcsFieldSizeObserver* aSizeObserver,
       
    43         CNcsHeaderContainer* aParentControl );
       
    44 
       
    45     virtual ~CNcsAttachmentField();
       
    46 
       
    47 public: // methods
       
    48 
       
    49     TInt MinimumHeight() const;
       
    50 
       
    51     void SetMaxLabelLength( TInt aMaxLength );
       
    52 
       
    53     TInt GetMinLabelLength() const;
       
    54     
       
    55     void SetTextsLD( CDesCArray* aAttachmentNames, 
       
    56                      CDesCArray* aAttachmentSizes );
       
    57 
       
    58     TInt FocusedAttachmentLabelIndex();
       
    59   
       
    60 public: // from MNcsControl
       
    61     
       
    62     TInt LineCount() const;
       
    63 
       
    64     TInt ScrollableLines() const;
       
    65 
       
    66     TInt GetNumChars() const;
       
    67 
       
    68     TInt CursorLineNumber() const;
       
    69 
       
    70     TInt CursorPosition() const;
       
    71 
       
    72     void Reposition( TPoint& aPt, TInt aWidth );
       
    73 
       
    74     const TDesC& GetLabelText() const;
       
    75     
       
    76     TInt LayoutLineCount() const;
       
    77     
       
    78 public: // from CCoeControl
       
    79 
       
    80     void Draw( const TRect& aRect ) const;
       
    81         
       
    82     void SizeChanged();
       
    83 
       
    84     void PositionChanged();
       
    85 
       
    86     void SetContainerWindowL( const CCoeControl& aContainer );
       
    87 
       
    88     void FocusChanged( TDrawNow aDrawNow );                  
       
    89 
       
    90     void HandleResourceChange( TInt aType );
       
    91 
       
    92     void HandlePointerEventL( const TPointerEvent& aPointerEvent );
       
    93     
       
    94 private: // methods
       
    95     
       
    96     CNcsAttachmentField( TInt aLabelTextId,
       
    97                          MNcsFieldSizeObserver* aSizeObserver, 
       
    98                          CNcsHeaderContainer* aParentControl );
       
    99         
       
   100     void ConstructL();
       
   101     
       
   102     void UpdateColors();
       
   103     void UpdateColors( CNcsLabel* aLabel );
       
   104     
       
   105 	void UpdateFontSize();
       
   106 	void UpdateFontSize( CNcsLabel* aLabel );
       
   107 
       
   108     void LayoutControls();
       
   109 	
       
   110 	void UpdateIconPositions( const TRect& aRect );
       
   111 
       
   112     void UpdateAttachmentTextsL();
       
   113     
       
   114     /**
       
   115      * Resizes icons 
       
   116      */
       
   117     void ResizeIcons();
       
   118     
       
   119     TInt CreateIcons();
       
   120     void CreateIconsL();
       
   121     
       
   122     void UpdateComponentArrayL();
       
   123     
       
   124     void UpdateSingleAttachmentLabelTextL( CNcsLabel* aLabel, TInt aIndex );
       
   125     
       
   126 private: // data
       
   127     
       
   128     CNcsHeaderContainer* iParentControl; // not owned
       
   129     
       
   130     // attachment labels (within the array) owned
       
   131     RPointerArray<CNcsLabel> iAttachmentLabels;
       
   132     
       
   133     const CFont* iLabelFont; // not owned
       
   134     const CFont* iEditorFont; // not owned
       
   135     
       
   136     CDesCArray* iAttachmentNames;
       
   137     CDesCArray* iAttachmentSizes;
       
   138     
       
   139     TInt iMaximumLabelLength;         
       
   140 
       
   141     TRgb iBgColor;
       
   142     
       
   143     TRgb iBorderColor;
       
   144     
       
   145     // Attachment icon
       
   146     CFbsBitmap* iAttachmentBitmap;
       
   147     CFbsBitmap* iAttachmentMask;
       
   148     TPoint iAttachmentIconPos;
       
   149     
       
   150     TInt iLabelTextId;
       
   151     TInt iAttachmentLabelCount;
       
   152     TInt iFocusedLabelIndex;
       
   153     };
       
   154 
       
   155 #endif