| Home · All Namespaces · All Classes |
00001 /* 00002 * This file is part of mhome 00003 * 00004 * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 00005 * All rights reserved. 00006 * 00007 * Contact: Tomas Junnonen <tomas.junnonen@nokia.com> 00008 * 00009 * This software, including documentation, is protected by copyright 00010 * controlled by Nokia Corporation. All rights are reserved. Copying, 00011 * including reproducing, storing, adapting or translating, any or all of 00012 * this material requires the prior written consent of Nokia Corporation. 00013 * This material also contains confidential information which may not be 00014 * disclosed to others without the prior written consent of Nokia. 00015 */ 00016 #ifndef PAGEDPANNING_H 00017 #define PAGEDPANNING_H 00018 00019 #include <QObject> 00020 #include <mphysics2dpanning.h> 00021 00031 class PagedPanning : public MPhysics2DPanning 00032 { 00033 Q_OBJECT 00034 00035 public: 00040 PagedPanning(QObject* parent); 00041 00045 virtual ~PagedPanning(); 00046 00052 void setPageCount(int pageCount); 00053 00057 int pageCount() const; 00058 00062 void panToPage(int page); 00063 00069 void setPage(uint page); 00070 00074 void setVelocityThreshold(qreal value); 00075 00079 void setDragThreshold(qreal value); 00080 00084 void setSlideLimit(int value); 00085 00089 void setPageSnapSpringK(qreal value); 00090 00094 void setPageSnapFriction(qreal value); 00095 00099 void setPanThreshold(qreal value); 00100 00104 int activePage() const; 00105 00110 int targetPage() const; 00111 00115 float pageWidth() const; 00116 00123 void setPageWrapMode(bool enable); 00124 00128 bool pageWrapMode() const; 00129 00130 protected: 00131 00133 virtual void integrateAxis( Qt::Orientation orientation, 00134 qreal &position, 00135 qreal &velocity, 00136 qreal &acceleration, 00137 qreal &pointerDifference, 00138 bool pointerPressed 00139 ); 00140 00141 virtual void pointerPress(const QPointF &pos); 00142 00143 virtual void pointerMove(const QPointF &pos); 00144 00145 virtual void pointerRelease(); 00146 00148 00149 signals: 00154 void pageChanged(int page); 00155 00160 void pageIsPanning(bool panning); 00161 00166 void pageWrapped(); 00167 00168 private slots: 00169 00173 void panToCurrentPage(); 00174 00175 private: 00176 void goToNextPageWithStrongEnoughFlick(); 00177 00178 private: 00180 int pageCount_; 00181 00183 int currentPage; 00184 00186 bool snapMode; 00187 00189 QRectF previousRange; 00190 00192 qreal velocityThreshold_; 00193 00195 qreal panThreshold; 00196 00198 qreal dragThreshold_; 00199 00201 int slideLimit_; 00202 00204 qreal pageSnapSpringK_; 00205 00207 qreal pageSnapFriction_; 00208 00210 qreal previousPosition; 00211 00213 int targetPage_; 00214 00216 int initialPage; 00217 00219 qreal previousPageWidth; 00220 00224 qreal slideDistance(qreal initialVelocity, qreal friction); 00225 00227 qreal latestSwipeLenght; 00228 00230 bool wrapMode; 00231 00233 bool pageWrapping; 00234 00235 #ifdef UNIT_TEST 00237 friend class Ut_PagedPanning; 00238 #endif 00239 00240 }; 00241 00242 #endif
| Copyright © 2010 Nokia Corporation | Generated on Sun Feb 6 23:02:42 2011 Doxygen 1.6.1 |
MeeGo Touch |