emailuis/emailui/src/ncscontrol.cpp
changeset 2 5253a20d2a1e
parent 0 8466d47a6819
equal deleted inserted replaced
1:12c456ceeff2 2:5253a20d2a1e
    20 #include <AknsConstants.h>
    20 #include <AknsConstants.h>
    21 #include <AknsUtils.h>
    21 #include <AknsUtils.h>
    22 #include <AknsSkinInstance.h>
    22 #include <AknsSkinInstance.h>
    23 #include <gulcolor.h>
    23 #include <gulcolor.h>
    24 #include <eikdef.h>
    24 #include <eikdef.h>
       
    25 #include <AknUtils.h>
    25 
    26 
    26 #include "ncscontrol.h"
    27 #include "ncscontrol.h"
    27 #include "FreestyleEmailUiLayoutData.h"
    28 #include "FreestyleEmailUiLayoutData.h"
    28 // <cmail> Plaform layout change
       
    29 #include "ncsutility.h"
    29 #include "ncsutility.h"
    30 // </cmail> Plaform layout change
       
    31 
    30 
    32 // ---------------------------------------------------------------------------
    31 // ---------------------------------------------------------------------------
    33 // MNcsControl::MNcsControl
    32 // MNcsControl::MNcsControl
    34 // ---------------------------------------------------------------------------
    33 // ---------------------------------------------------------------------------
    35 //
    34 //
    42 
    41 
    43 // ---------------------------------------------------------------------------
    42 // ---------------------------------------------------------------------------
    44 // CNcsLabel::CNcsLabel
    43 // CNcsLabel::CNcsLabel
    45 // ---------------------------------------------------------------------------
    44 // ---------------------------------------------------------------------------
    46 //
    45 //
    47 // <cmail> Platform layout changes
    46 CNcsLabel::CNcsLabel( 
    48 CNcsLabel::CNcsLabel( const CCoeControl& aParent, MNcsFieldSizeObserver* aSizeObserver ) :
    47         const CCoeControl& aParent, 
       
    48         MNcsFieldSizeObserver* aSizeObserver ) :
    49     MNcsControl( aSizeObserver ), iParent( aParent )
    49     MNcsControl( aSizeObserver ), iParent( aParent )
    50     {
    50     {
    51     FUNC_LOG;
    51     FUNC_LOG;
    52     UpdateTextColor();
    52     UpdateTextColor();
    53     }
    53     }
    54 // </cmail> Platform layout changes
       
    55 
    54 
    56 // ---------------------------------------------------------------------------
    55 // ---------------------------------------------------------------------------
    57 // CNcsLabel::Reposition
    56 // CNcsLabel::Reposition
    58 // ---------------------------------------------------------------------------
    57 // ---------------------------------------------------------------------------
    59 //
    58 //
    60 void CNcsLabel::Reposition( TPoint& aPt, TInt /*aWidth <Cmail>*/ )
    59 void CNcsLabel::Reposition( TPoint& aPt, TInt /*aWidth*/ )
    61     {
    60     {
    62     FUNC_LOG;
    61     FUNC_LOG;
    63     // <cmail> Platform layout changes
       
    64     /*
       
    65     TInt ht = Font()->HeightInPixels() + Font()->DescentInPixels();
       
    66     ht += 2 * KAifLabelMarginHorizontal;
       
    67     TSize sz( aWidth, ht );
       
    68     if ( Rect() != TRect( aPt, sz ) )
       
    69         {
       
    70         SetExtent( aPt, sz );
       
    71         }
       
    72     aPt.iY += Size().iHeight;
       
    73     */
       
    74     // </cmail> Platform layout changes
       
    75     SetPosition( aPt );
    62     SetPosition( aPt );
    76     }
    63     }
    77 
    64 
    78 // ---------------------------------------------------------------------------
    65 // ---------------------------------------------------------------------------
    79 // CNcsLabel::FocusChanged
    66 // CNcsLabel::FocusChanged
   143 // CNcsLabel::LayoutLineCount
   130 // CNcsLabel::LayoutLineCount
   144 // ---------------------------------------------------------------------------
   131 // ---------------------------------------------------------------------------
   145 //
   132 //
   146 TInt CNcsLabel::LayoutLineCount() const
   133 TInt CNcsLabel::LayoutLineCount() const
   147     {
   134     {
       
   135     FUNC_LOG;
   148     return IsVisible() ? 1 : 0;
   136     return IsVisible() ? 1 : 0;
   149     }
   137     }
       
   138 
       
   139 // ---------------------------------------------------------------------------
       
   140 // CNcsLabel::TextHitAreaRect
       
   141 // ---------------------------------------------------------------------------
       
   142 //
       
   143 TRect CNcsLabel::TextHitAreaRect()
       
   144     {
       
   145     FUNC_LOG;
       
   146     TRect rect;
       
   147     if ( Font() && Text() )
       
   148         {
       
   149         rect = Rect();
       
   150         rect.SetWidth( Font()->TextWidthInPixels( *Text() ) );
       
   151         if( AknLayoutUtils::LayoutMirrored() )
       
   152             {
       
   153             rect.Move( Rect().Size().iWidth - 
       
   154                        rect.Size().iWidth - 
       
   155                        rect.iTl.iX - 2, 0 );
       
   156             }
       
   157         }
       
   158     return rect;
       
   159     }