Home · All Namespaces · All Classes |
00001 /*************************************************************************** 00002 ** 00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 00004 ** All rights reserved. 00005 ** Contact: Nokia Corporation (directui@nokia.com) 00006 ** 00007 ** This file is part of mhome. 00008 ** 00009 ** If you have questions regarding the use of this file, please contact 00010 ** Nokia at directui@nokia.com. 00011 ** 00012 ** This library is free software; you can redistribute it and/or 00013 ** modify it under the terms of the GNU Lesser General Public 00014 ** License version 2.1 as published by the Free Software Foundation 00015 ** and appearing in the file LICENSE.LGPL included in the packaging 00016 ** of this file. 00017 ** 00018 ****************************************************************************/ 00019 #ifndef PAGEDPANNING_H 00020 #define PAGEDPANNING_H 00021 00022 #include <QObject> 00023 #include <mphysics2dpanning.h> 00024 00034 class PagedPanning : public MPhysics2DPanning 00035 { 00036 Q_OBJECT 00037 00038 public: 00043 PagedPanning(QObject* parent); 00044 00048 virtual ~PagedPanning(); 00049 00055 void setPageCount(int pageCount); 00056 00060 int pageCount() const; 00061 00065 void panToPage(int page); 00066 00072 void setPage(uint page); 00073 00077 void setVelocityThreshold(qreal value); 00078 00082 void setDragThreshold(qreal value); 00083 00087 void setSlideLimit(int value); 00088 00092 void setPageSnapSpringK(qreal value); 00093 00097 void setPageSnapFriction(qreal value); 00098 00102 void setPanThreshold(qreal value); 00103 00107 int activePage() const; 00108 00113 int targetPage() const; 00114 00118 float pageWidth() const; 00119 00126 void setPageWrapMode(bool enable); 00127 00131 bool pageWrapMode() const; 00132 00134 virtual void pointerPress(const QPointF &pos); 00135 virtual void pointerMove(const QPointF &pos); 00136 virtual void pointerRelease(); 00138 00139 protected: 00140 00142 virtual void integrateAxis( Qt::Orientation orientation, 00143 qreal &position, 00144 qreal &velocity, 00145 qreal &acceleration, 00146 qreal &pointerDifference, 00147 bool pointerPressed 00148 ); 00150 00151 signals: 00156 void pageChanged(int page); 00157 00162 void pageIsPanning(bool panning); 00163 00168 void pageWrapped(); 00169 00170 private slots: 00171 00175 void panToCurrentPage(); 00176 00177 private: 00178 void goToNextPageWithStrongEnoughFlick(); 00179 00180 private: 00182 int pageCount_; 00183 00185 int currentPage; 00186 00188 bool snapMode; 00189 00191 QRectF previousRange; 00192 00194 qreal velocityThreshold_; 00195 00197 qreal panThreshold; 00198 00200 qreal dragThreshold_; 00201 00203 int slideLimit_; 00204 00206 qreal pageSnapSpringK_; 00207 00209 qreal pageSnapFriction_; 00210 00212 qreal previousPosition; 00213 00215 int targetPage_; 00216 00218 int initialPage; 00219 00221 qreal previousPageWidth; 00222 00226 qreal slideDistance(qreal initialVelocity, qreal friction); 00227 00229 QPointF pointerPressPosition; 00230 00232 qreal latestSwipeLength; 00233 00235 bool wrapMode; 00236 00238 bool pageWrapping; 00239 00240 #ifdef UNIT_TEST 00241 00242 friend class Ut_PagedPanning; 00243 #endif 00244 00245 }; 00246 00247 #endif
Copyright © 2011 Nokia Corporation | Generated on Thu Jul 7 2011 22:14:50 Doxygen 1.7.1 |
MeeGo Touch |