homescreenapp/stateplugins/hshomescreenstateplugin/inc/hsidlewidget.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 23 Jun 2010 18:03:36 +0300
changeset 60 30f14686fb04
parent 36 cdae8c6c3876
child 61 2b1b11a301d2
permissions -rw-r--r--
Revision: 201023 Kit: 2010125

/*
* 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:
*
*/


#ifndef HSIDLEWIDGET_H
#define HSIDLEWIDGET_H

#include <HbWidget>

#include "hstest_global.h"
HOMESCREEN_TEST_CLASS(HomeScreenStatePluginTest)

class HsPage;
class HsTrashBinWidget;
class HsPageIndicator;

class HsIdleWidget : public HbWidget
{
    Q_OBJECT
    Q_PROPERTY(qreal sceneX READ sceneX WRITE setSceneX)

public:
    HsIdleWidget(QGraphicsItem *parent = 0);
	~HsIdleWidget();

    qreal sceneX() const;
    void setSceneX(qreal x);

    void setGeometry(const QRectF &rect);

    void captureDelayedPress(QGraphicsSceneMouseEvent *event);
    void sendDelayedPress();
    void clearDelayedPress();

    void setActivePage(int index);
    void insertPage(int index, HsPage *page);
    void removePage(int index);

    HbWidget *controlLayer() const { return mControlLayer; }
    HbWidget *pageLayer() const { return mPageLayer; }
    HbWidget *pageWallpaperLayer() const { return mPageWallpaperLayer; }
    HbWidget *sceneLayer() const { return mSceneLayer; }

    HsTrashBinWidget *trashBin() const { return mTrashBin; }
    HsPageIndicator *pageIndicator() const { return mPageIndicator; }

    qreal parallaxFactor() const;

signals:    
    void mousePressed(QGraphicsItem *watched, QGraphicsSceneMouseEvent *event, bool &filtered);
    void mouseMoved(QGraphicsItem *watched, QGraphicsSceneMouseEvent *event, bool &filtered);
    void mouseReleased(QGraphicsItem *watched, QGraphicsSceneMouseEvent *event, bool &filtered);

public slots:
    void showTrashBin();
    void showPageIndicator();

protected:
    bool eventFilter(QObject *object, QEvent *event);
    bool sceneEventFilter(QGraphicsItem *watched, QEvent *event);
    void polishEvent();

private:
    Q_DISABLE_COPY(HsIdleWidget)
    void loadControlLayer();
        
private:
    HbWidget *mControlLayer;
    HbWidget *mPageLayer;
    HbWidget *mPageWallpaperLayer;
    HbWidget *mSceneLayer;

    QMouseEvent *mDelayedPressEvent;

    HsTrashBinWidget *mTrashBin;
    HsPageIndicator *mPageIndicator;

    HOMESCREEN_TEST_FRIEND_CLASS(HomeScreenStatePluginTest)
};

#endif // HSIDLEWIDGET_H