homescreenapp/hsdomainmodel/inc/hspage.h
changeset 77 4b195f3bea29
parent 61 2b1b11a301d2
child 96 458d8c8d9580
--- a/homescreenapp/hsdomainmodel/inc/hspage.h	Tue Jul 06 14:06:53 2010 +0300
+++ b/homescreenapp/hsdomainmodel/inc/hspage.h	Wed Aug 18 09:40:07 2010 +0300
@@ -18,6 +18,7 @@
 #ifndef HSPAGE_H
 #define HSPAGE_H
 
+#include <QPointF>
 #include <HbWidget>
 #include <HbIconItem>
 #include "hsdomainmodel_global.h"
@@ -27,62 +28,60 @@
 class HsPageData;
 class HsWallpaper;
 class HsPageTouchArea;
+class HsPageVisual;
 
 HOMESCREEN_TEST_CLASS(TestHsDomainModel)
 
-class HSDOMAINMODEL_EXPORT HsPage : public HbWidget
+class HSDOMAINMODEL_EXPORT HsPage : public QObject
 {
     Q_OBJECT
     Q_PROPERTY(int pageIndex READ pageIndex)
 
 public:
-    HsPage(QGraphicsItem *parent = 0);
+    HsPage(QObject *parent = 0);
     ~HsPage();
-
     int databaseId() const;
     void setDatabaseId(int id);
-
-    void setGeometry(const QRectF &rect);
-
+   // void setGeometry(const QRectF &rect);
     bool load();
-
     HsWallpaper *wallpaper() const;
-
     bool addExistingWidget(HsWidgetHost *widgetHost);
     bool removeWidget(HsWidgetHost *widgeHost);
-
     QList<HsWidgetHost *> newWidgets();
     bool addNewWidget(HsWidgetHost *widgetHost, const QPointF &position = QPointF());
     void layoutNewWidgets();
     void resetNewWidgets();
     bool deleteFromDatabase();
-
     QList<HsWidgetHost *> widgets() const;
-
     bool isRemovable() const;
     void setRemovable(bool removable);
-
     bool isDefaultPage() const;
     bool isActivePage() const;
-    
     static HsPage *createInstance(const HsPageData &pageData);
-
-    QPointF mTouchPoint;
-
+    QPointF adjustedWidgetPosition(const QRectF &origWidgetRect);
+    QRectF contentGeometry();
+    QRectF contentGeometry(Qt::Orientation orientation);
+    QRectF contentRect();
+    QRectF contentRect(Qt::Orientation orientation);
+    HsPageVisual *visual() const;
+#ifdef HSWIDGETORGANIZER_ALGORITHM
+    enum sortOrder { height, width};
+#endif //HSWIDGETORGANIZER_ALGORITHM
 public slots:
     void showWidgets();
     void hideWidgets();
     void setOnline(bool online = true);
-
     void updateZValues();
-
     int pageIndex();
 
 private:
     Q_DISABLE_COPY(HsPage)
-    void setupTouchArea();
+  //  void setupTouchArea();
     void connectWidget(HsWidgetHost *widget);
     void disconnectWidget(HsWidgetHost *widget);
+#ifdef HSWIDGETORGANIZER_ALGORITHM
+    void sortWidgets(sortOrder order, QList<HsWidgetHost*> &widgets);
+#endif //HSWIDGETORGANIZER_ALGORITHM
 
 private slots:
     void onWidgetFinished();
@@ -90,18 +89,20 @@
     void onWidgetResized();
     void onWidgetAvailable();
     void onWidgetUnavailable();
-
     void onOrientationChanged(Qt::Orientation orientation);
+    void onPageMarginChanged(const QString &value);
 
 private:
     int mDatabaseId;
+    HsPageVisual *mPageVisual;
     HsWallpaper *mWallpaper;
     bool mRemovable;
     QList<HsWidgetHost*> mWidgets;
     QList<HsWidgetHost*> mNewWidgets;
     QList<HsWidgetHost*> mUnavailableWidgets;
-    HsPageTouchArea *mTouchArea;
-    
+    //HsPageTouchArea *mTouchArea;
+    QPointF mTouchPoint;    
+    qreal mPageMargin;
     HOMESCREEN_TEST_FRIEND_CLASS(TestHsDomainModel)
 };