emailuis/emailui/inc/ncscustomdraw.h
branchRCL_3
changeset 25 3533d4323edc
parent 0 8466d47a6819
equal deleted inserted replaced
24:d189ee25cf9d 25: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:  Custom draw component for message editor
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CNCSCUSTOMDRAW_H
       
    20 #define CNCSCUSTOMDRAW_H
       
    21 
       
    22 #include <lafmain.h>
       
    23 
       
    24 class CNcsEditor;
       
    25 
       
    26 /**
       
    27 * Class which handles setting editor background color, selected text color,
       
    28 * and selected text background color.
       
    29 *
       
    30 * Text color setting is done by editor itself.
       
    31 */
       
    32 class CNcsCustomDraw : public CLafEdwinCustomDrawBase
       
    33     {
       
    34 public: // constructor and destructor
       
    35 
       
    36     CNcsCustomDraw( 
       
    37         const MLafEnv& aEnv,
       
    38         const CCoeControl& aControl,
       
    39         CLafEdwinCustomDrawBase* aCustomDrawer,
       
    40         CNcsEditor* aEditor,
       
    41         TBool aHeaderField );
       
    42     
       
    43     virtual ~CNcsCustomDraw();
       
    44 
       
    45 public: // new methods
       
    46 
       
    47     void UpdateColors();
       
    48 
       
    49 public: // from CLafEdwinCustomDrawBase
       
    50 
       
    51 	virtual void DrawBackground(
       
    52         const TParam& aParam,
       
    53         const TRgb& aBackground,
       
    54         TRect& aDrawn) const;
       
    55 	
       
    56     virtual void DrawLineGraphics(
       
    57         const TParam& aParam,
       
    58         const TLineInfo& aLineInfo ) const;
       
    59 	
       
    60     virtual void DrawText(
       
    61         const TParam& aParam,
       
    62         const TLineInfo& aLineInfo,
       
    63         const TCharFormat& aFormat,
       
    64         const TDesC& aText,
       
    65         const TPoint& aTextOrigin,
       
    66         TInt aExtraPixels) const;
       
    67 
       
    68     virtual TRgb SystemColor(
       
    69         TUint aColorIndex,
       
    70         TRgb aDefaultColor) const;
       
    71 
       
    72 private: // methods used internally
       
    73 
       
    74     enum TColors
       
    75         {
       
    76         EColorBackground = 0x1,
       
    77         EColorSelectionText = 0x2,
       
    78         EColorSelectionBackground = 0x4
       
    79         };
       
    80 
       
    81     void SetHasColor( TColors aColor );
       
    82 
       
    83     TBool HasColor( TColors aColor ) const;
       
    84 
       
    85 private:
       
    86 
       
    87     TInt iColors;
       
    88 
       
    89     CLafEdwinCustomDrawBase* iCustomDrawer;
       
    90     CNcsEditor* iEditor;
       
    91     TBool iHeaderField;
       
    92 
       
    93     TRgb iBackgroundColor;
       
    94     TRgb iSelectionTextColor;
       
    95     TRgb iSelectionBackgroundColor;
       
    96 
       
    97     };
       
    98 
       
    99 #endif