clock/clockui/clockcityselectionlist/src/clockcityselectionlistprototype.cpp
changeset 45 b6db4fd4947b
parent 23 fd30d51f876b
child 46 ecd7b9840282
equal deleted inserted replaced
23:fd30d51f876b 45:b6db4fd4947b
     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 * The definition file for class ClockCitySelectionListPrototype.
       
    16 *
       
    17 */
       
    18 
       
    19 // System includes
       
    20 #include <QGraphicsItem>
       
    21 #include <HbTextItem>
       
    22 
       
    23 // User includes
       
    24 #include "clockcityselectionlistprototype.h"
       
    25 
       
    26 /*!
       
    27 	\class ClockCitySelectionListPrototype
       
    28 
       
    29 	This is the custom prototype class for HbListView. It sub-classes
       
    30 	HbListViewItem and re-implements HbListViewItem::createItem() and
       
    31 	HbListViewItem::updateChildItems().
       
    32 
       
    33 	\sa HbListViewItem, HbAbstractViewItem.
       
    34  */
       
    35 
       
    36 /*!
       
    37 	Default constructor.
       
    38 
       
    39 	\param parent of type QGraphicsItem.
       
    40  */
       
    41 ClockCitySelectionListPrototype::ClockCitySelectionListPrototype(
       
    42 		QGraphicsItem *parent)
       
    43 :HbListViewItem(parent),
       
    44  mCityNameItem(0)
       
    45 {
       
    46 	// Nothing yet.
       
    47 }
       
    48 
       
    49 /*!
       
    50 	Destructor.
       
    51  */
       
    52 ClockCitySelectionListPrototype::~ClockCitySelectionListPrototype()
       
    53 {
       
    54 	if (mCityNameItem) {
       
    55 		delete mCityNameItem;
       
    56 		mCityNameItem = 0;
       
    57 	}
       
    58 }
       
    59 
       
    60 /*!
       
    61 	From HbListViewItem.
       
    62 	Constructs the custom list view item.
       
    63 
       
    64 	\sa HbListViewItem, HbAbstractViewItem.
       
    65  */
       
    66 HbAbstractViewItem *ClockCitySelectionListPrototype::createItem()
       
    67 {
       
    68 	return new ClockCitySelectionListPrototype(*this);
       
    69 }
       
    70 
       
    71 /*!
       
    72 	From HbListViewItem.
       
    73 	Updates the child items of the cutsom prototype.
       
    74 
       
    75 	\sa HbListViewItem, HbAbstractViewItem.
       
    76  */
       
    77 void ClockCitySelectionListPrototype::updateChildItems()
       
    78 {
       
    79 	HbListViewItem::updateChildItems();
       
    80 
       
    81 	if (!mCityNameItem) {
       
    82 		mCityNameItem = new HbTextItem(this);
       
    83 		style()->setItemName(mCityNameItem, "cityNameItem");
       
    84 		mCityNameItem->setTextWrapping(Hb::TextWordWrap);
       
    85 	}
       
    86 	mCityNameItem->setText(
       
    87 			modelIndex().data(Qt::UserRole + 100).value<QString>());
       
    88 }
       
    89 
       
    90 // End of file	--Don't remove this.