diff -r 000000000000 -r 8466d47a6819 meetingrequest/mrgui/mrfieldbuildercommon/src/cesmrviewerlabelfield.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/meetingrequest/mrgui/mrfieldbuildercommon/src/cesmrviewerlabelfield.cpp Thu Dec 17 08:39:21 2009 +0200 @@ -0,0 +1,154 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base class for most of the fields in viewer +* +*/ + + +#include "emailtrace.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +// +#include "esmrdef.h" +// +#include "cesmrviewerlabelfield.h" +#include "cesmreditor.h" +#include "mesmrlistobserver.h" + +// --------------------------------------------------------------------------- +// CESMRViewerLabelField::NewL +// --------------------------------------------------------------------------- +// +EXPORT_C CESMRViewerLabelField* CESMRViewerLabelField::NewL() + { + FUNC_LOG; + CESMRViewerLabelField* self = new (ELeave) CESMRViewerLabelField(); + CleanupStack::PushL( self ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CESMRViewerLabelField::~CESMRViewerLabelField +// --------------------------------------------------------------------------- +// +EXPORT_C CESMRViewerLabelField::~CESMRViewerLabelField() + { + FUNC_LOG; + // Do nothing + } + +// --------------------------------------------------------------------------- +// CESMRViewerLabelField::CESMRViewerLabelField +// --------------------------------------------------------------------------- +// +EXPORT_C CESMRViewerLabelField::CESMRViewerLabelField() + { + FUNC_LOG; + // Do nothing + } + +// --------------------------------------------------------------------------- +// CESMRViewerLabelField::InitializeL +// --------------------------------------------------------------------------- +// +EXPORT_C void CESMRViewerLabelField::InitializeL() + { + FUNC_LOG; + iLabel->SetFont( iLayout->Font( iCoeEnv, iFieldId )); + + if( CESMRLayoutManager::IsMirrored() ) + { + iLabel->iMargin.iRight = iLayout->TextSideMargin(); + } + else + { + iLabel->iMargin.iLeft = iLayout->TextSideMargin(); + } + + // Set the text color. + if ( IsFocused() ) + { + AknLayoutUtils::OverrideControlColorL( *iLabel, EColorLabelText, + iLayout->ViewerListAreaHighlightedTextColor() ); + } + else + { + AknLayoutUtils::OverrideControlColorL( *iLabel, EColorLabelText, + iLayout->ViewerListAreaTextColor() ); + } + } + +// --------------------------------------------------------------------------- +// CESMRViewerLabelField::ConstructL +// --------------------------------------------------------------------------- +// +EXPORT_C void CESMRViewerLabelField::ConstructL( TAknsItemID aIconID ) + { + FUNC_LOG; + // If field id is not specified, make this field a "basic" field: + // Basic field can't be hidden from the list. + if( iFieldId == 0 ) + { + SetFieldId( EESMRFieldViewerBasic ); + } + + iLabel = new (ELeave) CEikLabel(); + iLabel->SetLabelAlignment(CESMRLayoutManager::IsMirrored() ? + ELayoutAlignRight : + ELayoutAlignLeft ); + + _LIT( KEmptyText, "" ); + iLabel->SetTextL( KEmptyText ); + CESMRIconField::ConstructL( aIconID, iLabel, EESMRHighlightFocus ); + } + +// --------------------------------------------------------------------------- +// CESMRViewerLabelField::FocusChanged +// --------------------------------------------------------------------------- +// +EXPORT_C void CESMRViewerLabelField::FocusChanged( TDrawNow /*aDrawNow*/ ) + { + FUNC_LOG; + // Focus received + if ( IsFocused() ) + { + // If function leaves we continue w/o changing the color + TRAP_IGNORE( AknLayoutUtils::OverrideControlColorL( + *iLabel, EColorLabelText, + iLayout->ViewerListAreaHighlightedTextColor() ) ); + DrawDeferred(); + } + else + { + // If function leaves we continue w/o changing the color + TRAP_IGNORE( AknLayoutUtils::OverrideControlColorL( + *iLabel, EColorLabelText, + iLayout->ViewerListAreaTextColor() ) ); + DrawDeferred(); + } + } + +// EOF +