emailuis/emailui/src/ncseditorcustomdraw.cpp
branchRCL_3
changeset 35 e64954c2c8e2
parent 0 8466d47a6819
child 24 b5fbb9b25d57
equal deleted inserted replaced
34:cd2816114bd1 35:e64954c2c8e2
    80     const TParam& aParam,
    80     const TParam& aParam,
    81     const TRgb& aBackground,
    81     const TRgb& aBackground,
    82     TRect& aDrawn ) const
    82     TRect& aDrawn ) const
    83     {
    83     {
    84     FUNC_LOG;
    84     FUNC_LOG;
    85     iCustomDrawer->DrawBackground( aParam, aBackground, aDrawn );
    85     if ( iPrevBrX == 0 )
    86     TInt lineHeigth( 0 );
    86         {
    87     TRAP_IGNORE( lineHeigth = iEditor->GetLineHeightL() );
    87         const_cast<CNcsEditorCustomDraw*>(this)->iPrevBrX = aParam.iDrawRect.iBr.iX;
    88 
    88         }
    89     TAknTextDecorationMetrics decorationMetrics( iTextPaneLayout.LayoutLine().FontId() );
       
    90     TInt topMargin, bottomMargin;
       
    91     decorationMetrics.GetTopAndBottomMargins( topMargin, bottomMargin );
       
    92 
       
    93     TInt lineOffset = iTextPaneLayout.H() + topMargin + bottomMargin;
       
    94     
    89     
    95     TRgb lineColor = NcsUtility::CalculateMsgBodyLineColor( KFSColorDarkeningDegree, 
    90     // draw background if text selection is ongoing
    96                                                             NcsUtility::SeparatorLineColor() );
    91     if ( iEditor->SelectionLength() )
    97     aParam.iGc.SetPenColor( lineColor );
    92     	{
    98 
    93 		iCustomDrawer->DrawBackground( aParam, aBackground, aDrawn );
    99     TInt margin( 0 );
    94     	}
   100     if ( aParam.iDrawRect.Height() < lineHeigth ||
    95     else
   101          aParam.iDrawRect.Height() == lineOffset )
    96     	{
       
    97         aDrawn = aParam.iDrawRect;
       
    98     	}
       
    99     	
       
   100     if ( aParam.iDrawRect.iTl.iX < iPrevBrX )
   102         {
   101         {
   103         margin = 1;
   102         aParam.iGc.SetPenColor( iLineColor );
   104         }
       
   105 
       
   106     TRect currentRect( aParam.iDrawRect.iTl , TPoint( aParam.iDrawRect.iBr.iX, aParam.iDrawRect.iTl.iY + lineOffset - margin ));
       
   107     
   103     
   108     while ( currentRect.iBr.iY <= aParam.iDrawRect.iBr.iY )
   104         TInt margin( 0 );
   109         {
   105         if ( aParam.iDrawRect.Height() < iLineHeigth ||
   110         if ( currentRect.iTl.iY >= aParam.iDrawRect.iTl.iY  )
   106              aParam.iDrawRect.Height() == iLineOffset )
   111             {
   107             {
   112             aParam.iGc.DrawLine( TPoint( currentRect.iTl.iX, currentRect.iBr.iY), currentRect.iBr );
   108             margin = 1;
   113             }
   109             }
   114         currentRect.Move( 0, lineHeigth );
   110     
       
   111         TRect currentRect( aParam.iDrawRect.iTl , TPoint( aParam.iDrawRect.iBr.iX, aParam.iDrawRect.iTl.iY + iLineOffset - margin ));
       
   112         
       
   113         while ( currentRect.iBr.iY <= aParam.iDrawRect.iBr.iY )
       
   114             {
       
   115             if ( currentRect.iTl.iY >= aParam.iDrawRect.iTl.iY  )
       
   116                 {
       
   117                 aParam.iGc.DrawLine( TPoint( currentRect.iTl.iX, currentRect.iBr.iY), currentRect.iBr );
       
   118                 }
       
   119             currentRect.Move( 0, iLineHeigth );
       
   120             }
       
   121         const_cast<CNcsEditorCustomDraw*>(this)->iPrevBrX = aParam.iDrawRect.iBr.iX;
   115         }
   122         }
   116     }
   123     }
   117 
   124 
   118 // ---------------------------------------------------------------------------
   125 // ---------------------------------------------------------------------------
   119 // CNcsEditorCustomDraw::DrawLineGraphics
   126 // CNcsEditorCustomDraw::DrawLineGraphics
   162 // ---------------------------------------------------------------------------
   169 // ---------------------------------------------------------------------------
   163 //
   170 //
   164 void CNcsEditorCustomDraw::UpdateLayout( TAknTextComponentLayout aLayout )
   171 void CNcsEditorCustomDraw::UpdateLayout( TAknTextComponentLayout aLayout )
   165     {
   172     {
   166     iTextPaneLayout = aLayout;
   173     iTextPaneLayout = aLayout;
       
   174     TRAP_IGNORE( iLineHeigth = iEditor->GetLineHeightL() );
       
   175     iLineColor = NcsUtility::CalculateMsgBodyLineColor( KFSColorDarkeningDegree, 
       
   176                                                             NcsUtility::SeparatorLineColor() );
       
   177     TAknTextDecorationMetrics decorationMetrics( iTextPaneLayout.LayoutLine().FontId() );
       
   178     TInt topMargin, bottomMargin;
       
   179     decorationMetrics.GetTopAndBottomMargins( topMargin, bottomMargin );
       
   180 
       
   181     iLineOffset = iTextPaneLayout.H() + topMargin + bottomMargin;
   167     }
   182     }