emailcontacts/contactactionmenu/src/cfsccontactactionmenuborder.cpp
branchRCL_3
changeset 25 3533d4323edc
parent 0 8466d47a6819
equal deleted inserted replaced
24:d189ee25cf9d 25:3533d4323edc
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Implementation of the class CFscContactActionMenuBorder.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCUDES
       
    20 #include "emailtrace.h"
       
    21 #include <gdi.h>
       
    22 
       
    23 #include "cfsccontactactionmenuborder.h"
       
    24 #include "fsccontactactionmenuuidefines.h"
       
    25 
       
    26 // ======== LOCAL FUNCTIONS ========
       
    27 
       
    28 // ======== MEMBER FUNCTIONS ========
       
    29 
       
    30 // ---------------------------------------------------------------------------
       
    31 // CFscContactActionMenuBorder::NewL
       
    32 // ---------------------------------------------------------------------------
       
    33 //
       
    34 CFscContactActionMenuBorder* CFscContactActionMenuBorder::NewL(
       
    35     const TRect& aRect,
       
    36     TCornerType aCornerType )
       
    37     {
       
    38     FUNC_LOG;
       
    39 
       
    40     CFscContactActionMenuBorder* self = 
       
    41         new (ELeave) CFscContactActionMenuBorder( aRect, aCornerType );
       
    42     CleanupStack::PushL( self );
       
    43     self->ConstructL();
       
    44     CleanupStack::Pop( self );
       
    45         
       
    46     return self;
       
    47     }
       
    48 
       
    49 // ---------------------------------------------------------------------------
       
    50 // CFscContactActionMenuBorder::~CFscContactActionMenuBorder
       
    51 // ---------------------------------------------------------------------------
       
    52 //
       
    53 CFscContactActionMenuBorder::~CFscContactActionMenuBorder()
       
    54     {
       
    55     FUNC_LOG;
       
    56     }
       
    57 
       
    58 // ---------------------------------------------------------------------------
       
    59 // CFscContactActionMenuBorder::Draw
       
    60 // ---------------------------------------------------------------------------
       
    61 //
       
    62 void CFscContactActionMenuBorder::Draw(const TRect& /*aRect*/) const
       
    63     {
       
    64     FUNC_LOG;
       
    65     CWindowGc& gc = SystemGc();
       
    66     gc.SetPenColor( iColor );
       
    67     gc.SetBrushStyle( CWindowGc::ENullBrush );
       
    68     
       
    69     TSize ellipse( 0, 0 );
       
    70     switch ( iCornerType )
       
    71         {
       
    72         case EWindowCorner1:
       
    73             {
       
    74             ellipse = KCORNERSIZE1;
       
    75             break;
       
    76             }
       
    77         case EWindowCorner2:
       
    78             {
       
    79             ellipse = KCORNERSIZE2;
       
    80             break;
       
    81             }
       
    82         case EWindowCorner3:
       
    83             {
       
    84             ellipse = KCORNERSIZE3;
       
    85             break;
       
    86             }
       
    87         case EWindowCorner5:
       
    88             {
       
    89             ellipse = KCORNERSIZE4;
       
    90             break;
       
    91             }   
       
    92         default:
       
    93             {
       
    94             break;
       
    95             }
       
    96         }
       
    97     gc.DrawRoundRect( iRect, ellipse );
       
    98     }
       
    99 
       
   100 // ---------------------------------------------------------------------------
       
   101 // CFscContactActionMenuBorder::SetRect
       
   102 // ---------------------------------------------------------------------------
       
   103 //
       
   104 void CFscContactActionMenuBorder::SetRect( const TRect& aRect )
       
   105     {
       
   106     FUNC_LOG;
       
   107     iRect = aRect;
       
   108     CCoeControl::SetRect( iRect );
       
   109     }
       
   110 
       
   111 // ---------------------------------------------------------------------------
       
   112 // CFscContactActionMenuBorder::SetCornerType
       
   113 // ---------------------------------------------------------------------------
       
   114 //
       
   115 void CFscContactActionMenuBorder::SetCornerType( TCornerType aCornerType )
       
   116     {
       
   117     FUNC_LOG;
       
   118     iCornerType = aCornerType;
       
   119     }  
       
   120 
       
   121 // ---------------------------------------------------------------------------
       
   122 // CFscContactActionMenuBorder::SetColor
       
   123 // ---------------------------------------------------------------------------
       
   124 //
       
   125 void CFscContactActionMenuBorder::SetColor( TRgb aColor )
       
   126     {
       
   127     FUNC_LOG;
       
   128     iColor = aColor;
       
   129     }  
       
   130     
       
   131 // ---------------------------------------------------------------------------
       
   132 // CFscContactActionMenuBorder::CFscContactActionMenuBorder
       
   133 // ---------------------------------------------------------------------------
       
   134 //
       
   135 CFscContactActionMenuBorder::CFscContactActionMenuBorder(
       
   136     const TRect& aRect, TCornerType aCornerType )
       
   137     : iRect( aRect ), iCornerType( aCornerType ), iColor( KRgbGray )
       
   138     {
       
   139     FUNC_LOG;
       
   140     }
       
   141 
       
   142 // ---------------------------------------------------------------------------
       
   143 // CFscContactActionMenuBorder::ConstructL
       
   144 // ---------------------------------------------------------------------------
       
   145 //
       
   146 void CFscContactActionMenuBorder::ConstructL()
       
   147     {
       
   148     FUNC_LOG;
       
   149     CCoeControl::SetRect( iRect );
       
   150       
       
   151     SetNonFocusing();
       
   152     MakeVisible( ETrue );
       
   153     ActivateL();
       
   154     }
       
   155