uifw/uiklaf/src/laflbi.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2009 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:
       
    15 *
       
    16 */
       
    17 
       
    18 #include <w32std.h>
       
    19 #include "laflbi.h"
       
    20 #include "laflbx.h"
       
    21 #include "lafpublc.h"
       
    22 #include "LAFSTD.H"
       
    23 
       
    24 const TInt KLafListItemDrawerDefaultMarkColumnWidth = 10;
       
    25 const TInt KLafListItemDrawerDefaultPostMarkColumnSpace = 2;
       
    26 
       
    27 EXPORT_C LafListItemDrawer::TLidColors::TLidColors(TRgb aTextColor,
       
    28 												TRgb aBackColor,
       
    29 												TRgb aHighlightedTextColor,
       
    30 												TRgb aHighlightedBackColor,
       
    31 												TRgb aDimmedTextColor,
       
    32 												TRgb aDimmedBackColor,
       
    33 												TRgb aMarkColor)
       
    34 	:iTextColor(aTextColor), iBackColor(aBackColor),iHighlightedTextColor(aHighlightedTextColor)
       
    35 	,iHighlightedBackColor(aHighlightedBackColor),iDimmedTextColor(aDimmedTextColor)
       
    36 	,iDimmedBackColor(aDimmedBackColor), iMarkColor(aMarkColor)
       
    37 	{}
       
    38 						
       
    39 
       
    40 EXPORT_C void LafListItemDrawer::DrawFrame(CWindowGc& aGc,const TRect& aRect,TInt aFlags,const TLidColors& aColors)
       
    41 	{ // static
       
    42 	if(!(aFlags&SLafListBox::EEmphasized))
       
    43 		{
       
    44 		if(aFlags&SLafListBox::ECurrent)
       
    45 			{
       
    46 			aGc.SetPenStyle(CGraphicsContext::ESolidPen);
       
    47 			aGc.SetPenColor(aColors.iTextColor);
       
    48 			aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
       
    49 			aGc.DrawRect(aRect);
       
    50 			}
       
    51 		}
       
    52 	}
       
    53 
       
    54 /**
       
    55  * Returns a constant value according to aConstantType.
       
    56  * @internal
       
    57  */
       
    58 EXPORT_C TInt LafListItemDrawer::Constant(TConstantType aConstant)
       
    59 	{//static
       
    60 	TInt retValue = 0;
       
    61 	switch (aConstant)
       
    62 		{
       
    63 	case EDefaultMarkColumnWidth:
       
    64 		retValue = KLafListItemDrawerDefaultMarkColumnWidth;
       
    65 		break;
       
    66 	case EDefaultPostMarkColumnSpace:
       
    67 		retValue = KLafListItemDrawerDefaultPostMarkColumnSpace;
       
    68 		break;
       
    69 	default:
       
    70 		__ASSERT_DEBUG(EFalse, Panic(ELafPanicConstantNotKnown));
       
    71 		break;
       
    72 		}
       
    73 	return retValue;
       
    74 	}
       
    75 
       
    76 EXPORT_C void LafTextListItemDrawer::DrawNormalText(const TDesC& aDes,const CFont& /*aFont*/,CWindowGc& aGc,
       
    77 										 const TRect& aItemTextRect,const TInt aBaseLineOffset,
       
    78 										 const CGraphicsContext::TTextAlign aAlign)
       
    79 	{//static
       
    80 	aGc.DrawText(aDes,aItemTextRect,aBaseLineOffset,aAlign,LafListBox::InnerGutter());
       
    81 	}
       
    82 
       
    83 EXPORT_C TInt LafTextListItemDrawer::PrepareItemAttribute(TInt /*aFlags*/,TBool aItemIsCurrent,
       
    84 												TBool aItemIsSelected,TBool aViewIsEmphasized)
       
    85 	{//static
       
    86 	TInt attribute=0;
       
    87 	if(aItemIsCurrent)
       
    88 		attribute|=SLafListBox::ECurrent;
       
    89 	if(aViewIsEmphasized)
       
    90 		attribute|=SLafListBox::EEmphasized;
       
    91 	if(aItemIsSelected)
       
    92 		attribute|=SLafListBox::ESelected;
       
    93 	return attribute;
       
    94 	}