diff -r c743ef5928ba -r f9ce957a272c homescreenapp/hsutils/src/hstrashbinwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreenapp/hsutils/src/hstrashbinwidget.cpp Fri Mar 19 09:27:44 2010 +0200 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 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: Trash bin widget. +* +*/ + +#include +#include + +#include "hstrashbinwidget.h" + +const char* KTrashBinNormalItemImageName = "qtg_graf_hs_delete_normal"; +const char* KTrashBinHighlightItemImageName = "qtg_graf_hs_delete_highlight"; + +/*! + \internal + \class HsTrashBinWidget + \ingroup group_hsutils + \brief Trash bin widget. +*/ + +/*! + \internal + Constructor. + + \a parent Owner. +*/ +HsTrashBinWidget::HsTrashBinWidget(QGraphicsItem *parent) + : HbWidget(parent), + mIconItem(0), + mNormalIcon(0), + mHighlightIcon(0), + mNormalIconVisible(false) +{ + mIconItem = new HbIconItem(this); + + mNormalIcon = new HbIcon(KTrashBinNormalItemImageName); + mHighlightIcon = new HbIcon(KTrashBinHighlightItemImageName); + + mIconItem->setIcon(*mNormalIcon); + setPreferredSize(80,80); // workaround for icon updating problem when changing theme + QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Horizontal); + layout->addItem(mIconItem); + setLayout(layout); +} + +/*! + \internal + Destructor. +*/ +HsTrashBinWidget::~HsTrashBinWidget() +{ + +} + +/*! + \internal +*/ +void HsTrashBinWidget::activate() +{ + if (mNormalIconVisible) { + mIconItem->setIcon(*mHighlightIcon); + mNormalIconVisible = false; + } +} + +/*! + \internal +*/ +void HsTrashBinWidget::deactivate() +{ + if (!mNormalIconVisible) { + mIconItem->setIcon(*mNormalIcon); + mNormalIconVisible = true; + } +}