diff -r 61bc0f252b2b -r bac7acad7cb3 camerauis/cameraapp/generic/common/src/CamCaptureSetupListItem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraapp/generic/common/src/CamCaptureSetupListItem.cpp Wed Sep 01 12:30:54 2010 +0100 @@ -0,0 +1,146 @@ +/* +* Copyright (c) 2007 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: A list box item with text and a bitmap +* +* Copyright © 2007 Nokia. All rights reserved. +* This material, including documentation and any related computer +* programs, is protected by copyright controlled by Nokia. All +* rights are reserved. Copying, including reproducing, storing, +* adapting or translating, any or all of this material requires the +* prior written consent of Nokia. This material also contains +* confidential information which may not be disclosed to others +* without the prior written consent of Nokia. +* +* +*/ + + +// INCLUDE FILES +#include "CamCaptureSetupListItem.h" +#include "CamUtility.h" +#include "camlogging.h" +#include // For CCoeAppUiBase +#include // For CEikApplication +#include +#include +#include +#include +// CONSTANTS + +// ================= MEMBER FUNCTIONS ======================= + +// ----------------------------------------------------------------------------- +// CCamCaptureSetupListItem::NewLC +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CCamCaptureSetupListItem* +CCamCaptureSetupListItem::NewLC( TResourceReader& aReader, + TAknLayoutRect& aIconLayout ) + { + CCamCaptureSetupListItem* self = + new( ELeave ) CCamCaptureSetupListItem( aIconLayout ); + CleanupStack::PushL( self ); + self->ConstructFromResourceL( aReader ); + return self; + } + +// ----------------------------------------------------------------------------- +// NewLC +// ----------------------------------------------------------------------------- +// +CCamCaptureSetupListItem* +CCamCaptureSetupListItem::NewLC( + const TDesC& aItemText, + TInt aSettingId, + TInt aBitmapId, + TAknLayoutRect aIconLayout ) + { + CCamCaptureSetupListItem* self = + new( ELeave ) CCamCaptureSetupListItem( aIconLayout ); + CleanupStack::PushL( self ); + self->ConstructFromValuesL( aItemText, aSettingId, aBitmapId ); + return self; + } + +// --------------------------------------------------------------------------- +// CCamCaptureSetupListItem::CCamCaptureSetupListItem +// C++ constructor +// --------------------------------------------------------------------------- +// +CCamCaptureSetupListItem::CCamCaptureSetupListItem( TAknLayoutRect& aLayoutRect ) +: iIconLayout( aLayoutRect ) + { + } + +// --------------------------------------------------------------------------- +// CCamCaptureSetupListItem::ConstructFromResourceL +// Extract the data from aReader to populate data members +// --------------------------------------------------------------------------- +// +void +CCamCaptureSetupListItem::ConstructFromResourceL( TResourceReader& aReader ) + { + // iListItemText = aReader.ReadTPtrC(); + iListItemText = aReader.ReadTPtrC().AllocL(); + iSettingItemValueId = aReader.ReadInt16(); + iBitmapId = aReader.ReadInt32(); + + ConstructL(); + } + + +// --------------------------------------------------------------------------- +// Construct the item from given data +// --------------------------------------------------------------------------- +// +void +CCamCaptureSetupListItem::ConstructFromValuesL( const TDesC& aItemText, + TInt aSettingId, + TInt aBitmapId ) + { + iListItemText = aItemText.AllocL(); + iSettingItemValueId = aSettingId; + iBitmapId = aBitmapId; + + ConstructL(); + } +// --------------------------------------------------------------------------- +// CCamCaptureSetupListItem::ConstructL +// Second phase construction +// --------------------------------------------------------------------------- +// +void CCamCaptureSetupListItem::ConstructL() + { + if ( iBitmapId != KErrNotFound ) + { + TFileName resFileName; + CamUtility::ResourceFileName( resFileName ); + TPtrC resname = resFileName; + + AknIconUtils::CreateIconL( iBitmap, iBitmapMask, resname, iBitmapId, iBitmapId ); + AknIconUtils::SetSize( iBitmap, TSize( iIconLayout.Rect().Width(), iIconLayout.Rect().Height() ) ); + } + } + + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CCamCaptureSetupListItem::~CCamCaptureSetupListItem() + { + } + +// End of File