src/hbcore/gui/hbscrollarea_p.h
changeset 1 f7ac710697a9
parent 0 16d8024aca5e
child 6 c3690ec91ef8
equal deleted inserted replaced
0:16d8024aca5e 1:f7ac710697a9
    41 #include <hbwidget_p.h>
    41 #include <hbwidget_p.h>
    42 
    42 
    43 #include <QTimer>
    43 #include <QTimer>
    44 #include <QTime>
    44 #include <QTime>
    45 
    45 
    46 class HbGestureSceneFilter;
       
    47 class HbScrollBar;
    46 class HbScrollBar;
    48 class QEasingCurve;
    47 class QEasingCurve;
       
    48 class QPanGesture;
    49 
    49 
    50 class HB_CORE_PRIVATE_EXPORT HbScrollAreaPrivate: public HbWidgetPrivate
    50 class HB_CORE_PRIVATE_EXPORT HbScrollAreaPrivate: public HbWidgetPrivate
    51 {
    51 {
    52     Q_DECLARE_PUBLIC( HbScrollArea )
    52     Q_DECLARE_PUBLIC( HbScrollArea )
    53 
    53 
    65 
    65 
    66     void setScrollBarPolicy(Qt::Orientation orientation, HbScrollArea::ScrollBarPolicy policy);
    66     void setScrollBarPolicy(Qt::Orientation orientation, HbScrollArea::ScrollBarPolicy policy);
    67     void replaceScrollBar(Qt::Orientation orientation, HbScrollBar *scrollBar);
    67     void replaceScrollBar(Qt::Orientation orientation, HbScrollBar *scrollBar);
    68 
    68 
    69     void changeLayoutDirection(Qt::LayoutDirection aNewDirection);
    69     void changeLayoutDirection(Qt::LayoutDirection aNewDirection);
    70 
       
    71     void updateGestures();
       
    72 
    70 
    73     // returns true if it was able to scroll in either direction
    71     // returns true if it was able to scroll in either direction
    74     bool scrollByAmount(const QPointF& delta);
    72     bool scrollByAmount(const QPointF& delta);
    75 
    73 
    76     void startAnimating();
    74     void startAnimating();
    88     // private slot functions
    86     // private slot functions
    89     void _q_animateScrollTimeout();
    87     void _q_animateScrollTimeout();
    90     void _q_hideScrollBars();
    88     void _q_hideScrollBars();
    91     void _q_thumbPositionChanged(qreal value, Qt::Orientation orientation);
    89     void _q_thumbPositionChanged(qreal value, Qt::Orientation orientation);
    92     void _q_groovePressed(qreal value, Qt::Orientation orientation);
    90     void _q_groovePressed(qreal value, Qt::Orientation orientation);
       
    91     void _q_thumbPressed();
       
    92     void _q_thumbReleased();
    93 
    93 
    94     //void bounceBackValueChanged(qreal value);
    94     //void bounceBackValueChanged(qreal value);
    95     virtual void updateScrollMetrics();
    95     virtual void updateScrollMetrics();
    96     void prepareScrollBars();
    96     void prepareScrollBars();
    97 
    97 
    99 
    99 
   100     bool sceneEvent(QEvent *event);
   100     bool sceneEvent(QEvent *event);
   101 
   101 
   102     bool positionOutOfBounds ();
   102     bool positionOutOfBounds ();
   103 
   103 
   104     void mousePressEvent(QGraphicsSceneMouseEvent *event);
   104     bool pan(QPanGesture *gesture);
   105     void mouseReleaseEvent(QGraphicsSceneMouseEvent * event);
   105 
   106     void adjustContent();
   106     void adjustContent();
   107 
   107 
   108     virtual void ensureVisible(QPointF position, qreal xMargin, qreal yMargin);
   108     virtual void ensureVisible(QPointF position, qreal xMargin, qreal yMargin);
   109 
   109 
   110     void startTargetAnimation (QPointF delta, const int time);
   110     void startTargetAnimation (QPointF delta, const int time);
   112     void createPrimitives();
   112     void createPrimitives();
   113     void updatePrimitives();
   113     void updatePrimitives();
   114     void updateIndicators(QPointF newPosition);
   114     void updateIndicators(QPointF newPosition);
   115 
   115 
   116     void hideChildComponents();
   116     void hideChildComponents();
   117     void orientationChanged();
       
   118 
   117 
   119     virtual void setContentPosition( qreal value, Qt::Orientation orientation, bool animate );
   118     virtual void setContentPosition( qreal value, Qt::Orientation orientation, bool animate );
   120 
   119 
   121     virtual qreal topBoundary ()
   120     virtual qreal topBoundary ()
   122     {
   121     {
   141     QGraphicsWidget* mContents;
   140     QGraphicsWidget* mContents;
   142     // We need our own copy of this in order to pass it to the animation state machines
   141     // We need our own copy of this in order to pass it to the animation state machines
   143     // valid during animation
   142     // valid during animation
   144     QPointF mScrollPosition;
   143     QPointF mScrollPosition;
   145 
   144 
   146     Qt::Orientations mScrollDirections;
   145     Qt::Orientations mScrollDirections;    
   147 
       
   148     HbGestureSceneFilter* mGestureFilter;
       
   149 
   146 
   150     HbScrollBar* mHorizontalScrollBar;
   147     HbScrollBar* mHorizontalScrollBar;
   151     HbScrollBar* mVerticalScrollBar;
   148     HbScrollBar* mVerticalScrollBar;
   152 
   149 
   153     HbScrollArea::ScrollBarPolicy mVerticalScrollBarPolicy;
   150     HbScrollArea::ScrollBarPolicy mVerticalScrollBarPolicy;
   173 
   170 
   174     QTimer mScrollBarHideTimer;
   171     QTimer mScrollBarHideTimer;
   175 
   172 
   176     bool mFrictionEnabled;
   173     bool mFrictionEnabled;
   177     bool mScrollbarVisible;
   174     bool mScrollbarVisible;
       
   175     bool mResetAlignment;
   178 
   176 
   179     HbScrollArea::ClampingStyle mClampingStyle;
   177     HbScrollArea::ClampingStyle mClampingStyle;
   180     HbScrollArea::ScrollingStyle mScrollingStyle;
   178     HbScrollArea::ScrollingStyle mScrollingStyle;    
   181 
       
   182     bool mHandleLongPress;
       
   183 
       
   184     bool mOrientationChanged;
       
   185 
   179 
   186     // TODO/Q: All circular array related members could go
   180     // TODO/Q: All circular array related members could go
   187     // to circular array class if so wanted.
   181     // to circular array class if so wanted.
   188 
   182 
   189     // circular array to keep track of last N event positions
   183     // circular array to keep track of last N event positions
   194     qreal mEventTimeQueue[10];
   188     qreal mEventTimeQueue[10];
   195     uint mEventPositionQueueSize;
   189     uint mEventPositionQueueSize;
   196     uint mEventPositionQueueLastIndex;
   190     uint mEventPositionQueueLastIndex;
   197     bool mEventPositionQueueIsFull;
   191     bool mEventPositionQueueIsFull;
   198     Qt::LayoutDirection mLayoutDirection;
   192     Qt::LayoutDirection mLayoutDirection;
   199     #if 0
       
   200     QTime *mFlickTimer;
       
   201     Qt::DirectionType mPanDirection;
       
   202     #endif //HB_NEW_GESTURE_FW
       
   203 
   193 
   204     Qt::Alignment mAlignment;
   194     Qt::Alignment mAlignment;
   205     bool mContinuationIndicators;
   195     bool mContinuationIndicators;
   206     QGraphicsItem *continuationIndicatorTopItem;
   196     QGraphicsItem *continuationIndicatorTopItem;
   207     QGraphicsItem *continuationIndicatorBottomItem;
   197     QGraphicsItem *continuationIndicatorBottomItem;
   208     QGraphicsItem *continuationIndicatorLeftItem;
   198     QGraphicsItem *continuationIndicatorLeftItem;
   209     QGraphicsItem *continuationIndicatorRightItem;
   199     QGraphicsItem *continuationIndicatorRightItem;    
   210 
   200 
   211 private:
   201 private:
   212     // Private access for the fute application to enable setting tweaking
   202     // Private access for the fute application to enable setting tweaking
   213     // should be removed at some point
   203     // should be removed at some point
   214     static HbScrollAreaPrivate *d_ptr(HbScrollArea *scrollArea) {
   204     static HbScrollAreaPrivate *d_ptr(HbScrollArea *scrollArea) {
   223     qreal mMaxScrollSpeed;
   213     qreal mMaxScrollSpeed;
   224     qreal mSpringStrength;
   214     qreal mSpringStrength;
   225     qreal mSpringDampingFactor;
   215     qreal mSpringDampingFactor;
   226     qreal mFrictionPerMilliSecond;
   216     qreal mFrictionPerMilliSecond;
   227     bool mMultiFlickEnabled;
   217     bool mMultiFlickEnabled;
   228 
       
   229 };
   218 };
   230 
   219 
   231 #endif // HBSCROLLAREA_P_H
   220 #endif // HBSCROLLAREA_P_H