homescreenapp/hsdomainmodel/inc/hspage.h
branchRCL_3
changeset 82 5f0182e07bfb
equal deleted inserted replaced
79:f00a6757af32 82:5f0182e07bfb
       
     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 *
       
    16 */
       
    17 
       
    18 #ifndef HSPAGE_H
       
    19 #define HSPAGE_H
       
    20 
       
    21 #include <QPointF>
       
    22 #include <HbWidget>
       
    23 #include <HbIconItem>
       
    24 #include "hsdomainmodel_global.h"
       
    25 #include "hstest_global.h"
       
    26 
       
    27 class HsWidgetHost;
       
    28 class HsPageData;
       
    29 class HsWallpaper;
       
    30 class HsPageTouchArea;
       
    31 class HsPageVisual;
       
    32 
       
    33 HOMESCREEN_TEST_CLASS(TestHsDomainModel)
       
    34 
       
    35 class HSDOMAINMODEL_EXPORT HsPage : public QObject
       
    36 {
       
    37     Q_OBJECT
       
    38     Q_PROPERTY(int pageIndex READ pageIndex)
       
    39 
       
    40 public:
       
    41     HsPage(QObject *parent = 0);
       
    42     ~HsPage();
       
    43     int databaseId() const;
       
    44     void setDatabaseId(int id);
       
    45    // void setGeometry(const QRectF &rect);
       
    46     bool load();
       
    47     HsWallpaper *wallpaper() const;
       
    48     bool addExistingWidget(HsWidgetHost *widgetHost);
       
    49     bool removeWidget(HsWidgetHost *widgeHost);
       
    50     QList<HsWidgetHost *> newWidgets();
       
    51     bool addNewWidget(HsWidgetHost *widgetHost, const QPointF &position = QPointF());
       
    52     void layoutNewWidgets();
       
    53     void resetNewWidgets();
       
    54     bool deleteFromDatabase();
       
    55     QList<HsWidgetHost *> widgets() const;
       
    56     bool isRemovable() const;
       
    57     void setRemovable(bool removable);
       
    58     bool isDefaultPage() const;
       
    59     bool isActivePage() const;
       
    60     static HsPage *createInstance(const HsPageData &pageData);
       
    61     QPointF adjustedWidgetPosition(const QRectF &origWidgetRect);
       
    62     QRectF contentGeometry();
       
    63     QRectF contentGeometry(Qt::Orientation orientation);
       
    64     QRectF contentRect();
       
    65     QRectF contentRect(Qt::Orientation orientation);
       
    66     HsPageVisual *visual() const;
       
    67 #ifdef HSWIDGETORGANIZER_ALGORITHM
       
    68     enum sortOrder { height, width};
       
    69 #endif //HSWIDGETORGANIZER_ALGORITHM
       
    70 public slots:
       
    71     void showWidgets();
       
    72     void hideWidgets();
       
    73     void setOnline(bool online = true);
       
    74     void updateZValues();
       
    75     int pageIndex();
       
    76 
       
    77 private:
       
    78     Q_DISABLE_COPY(HsPage)
       
    79   //  void setupTouchArea();
       
    80     void connectWidget(HsWidgetHost *widget);
       
    81     void disconnectWidget(HsWidgetHost *widget);
       
    82 #ifdef HSWIDGETORGANIZER_ALGORITHM
       
    83     void sortWidgets(sortOrder order, QList<HsWidgetHost*> &widgets);
       
    84 #endif //HSWIDGETORGANIZER_ALGORITHM
       
    85 
       
    86 private slots:
       
    87     void onWidgetFinished();
       
    88     void onWidgetFaulted();
       
    89     void onWidgetResized();
       
    90     void onWidgetAvailable();
       
    91     void onWidgetUnavailable();
       
    92     void onOrientationChanged(Qt::Orientation orientation);
       
    93     void onPageMarginChanged(const QString &value);
       
    94 
       
    95 private:
       
    96     int mDatabaseId;
       
    97     HsPageVisual *mPageVisual;
       
    98     HsWallpaper *mWallpaper;
       
    99     bool mRemovable;
       
   100     QList<HsWidgetHost*> mWidgets;
       
   101     QList<HsWidgetHost*> mNewWidgets;
       
   102     QList<HsWidgetHost*> mUnavailableWidgets;
       
   103     //HsPageTouchArea *mTouchArea;
       
   104     QPointF mTouchPoint;    
       
   105     qreal mPageMargin;
       
   106     HOMESCREEN_TEST_FRIEND_CLASS(TestHsDomainModel)
       
   107 };
       
   108 
       
   109 #endif