27 #define HBPROGRESSSLIDERHANDLE_P_H |
27 #define HBPROGRESSSLIDERHANDLE_P_H |
28 |
28 |
29 #include "hbnamespace_p.h" |
29 #include "hbnamespace_p.h" |
30 #include <hbwidget.h> |
30 #include <hbwidget.h> |
31 #include <hbprogressslider.h> |
31 #include <hbprogressslider.h> |
|
32 #include <QTimeLine> |
32 |
33 |
33 class HbStyleOptionProgressSliderHandle; |
34 class HbStyleOptionProgressSliderHandle; |
|
35 |
|
36 static const int TOUCHAREA_ZVALUE = 1000; |
34 |
37 |
35 class HbHandleParent |
38 class HbHandleParent |
36 { |
39 { |
37 public: |
40 public: |
38 virtual HbStyle* style() const = 0; |
41 |
39 virtual void emitSliderPressed() = 0; |
42 virtual void emitSliderPressed() = 0; |
40 virtual void emitSliderMoved(int vlaue) = 0; |
43 virtual void emitSliderMoved(int vlaue) = 0; |
41 virtual void emitSliderReleased() = 0; |
44 virtual void emitSliderReleased() = 0; |
42 virtual QRectF boundingRect() const = 0; |
45 virtual QRectF boundingRect() const = 0; |
43 virtual QGraphicsItem* parentGraphicsItem() const = 0; |
46 virtual QGraphicsItem* parentGraphicsItem() const = 0; |
44 virtual HbWidget* parentGraphicsWidget() const = 0; |
47 virtual HbWidget* parentGraphicsWidget() const = 0; |
45 |
|
46 virtual ~HbHandleParent(){}; |
48 virtual ~HbHandleParent(){}; |
47 virtual int progressValue()const = 0; |
49 virtual int progressValue()const = 0; |
48 virtual int maximum() const = 0; |
50 virtual int maximum() const = 0; |
49 virtual int minimum() const = 0; |
51 virtual int minimum() const = 0; |
50 virtual bool invertedAppearance() const = 0; |
52 virtual bool invertedAppearance() const = 0; |
75 int pointToValue(QPointF point) const ; |
77 int pointToValue(QPointF point) const ; |
76 QPointF valueToHandlePos(int value) const; |
78 QPointF valueToHandlePos(int value) const; |
77 enum { Type = HbPrivate::ItemType_ProgressSliderHandle }; |
79 enum { Type = HbPrivate::ItemType_ProgressSliderHandle }; |
78 int type() const { return Type; } |
80 int type() const { return Type; } |
79 void setHandleIcon(const HbIcon &icon); |
81 void setHandleIcon(const HbIcon &icon); |
80 void handleTrackRelease(QGraphicsSceneMouseEvent * event); |
82 void handleTrackRelease(QGestureEvent *event); |
81 void handleTrackPress(QGraphicsSceneMouseEvent * event); |
83 void handleTrackPress(QGestureEvent *event); |
82 QVariant processItemChange(const QVariant &value); |
84 QVariant processItemChange(const QVariant &value); |
83 void setHandlePosForValue(int progressValue); |
85 void setHandlePosForValue(int progressValue); |
84 QPointF normalizedPos(const QPointF& pos,bool inverted) const; |
86 QPointF normalizedPos(const QPointF& pos,bool inverted) const; |
85 bool isHandlePressed() const; |
87 bool isHandlePressed() const; |
86 bool isHandleMoving() const; |
88 bool isHandleMoving() const; |
87 |
89 void setGeometry(const QRectF & rect); |
88 QGraphicsItem* primitive(HbStyle::Primitive primitive) const; |
90 QGraphicsItem *primitive(const QString &itemName) const; |
|
91 void setHandleNormalState(); |
89 |
92 |
90 public slots: |
93 public slots: |
91 void updatePrimitives(); |
94 void updatePrimitives(); |
|
95 void frameChanged(int val); |
92 |
96 |
93 protected: |
97 protected: |
94 virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); |
98 virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); |
95 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); |
99 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); |
96 virtual void mouseMoveEvent ( QGraphicsSceneMouseEvent * event ); |
100 virtual void mouseMoveEvent ( QGraphicsSceneMouseEvent * event ); |
97 virtual void gestureEvent(QGestureEvent *event); |
101 virtual void gestureEvent(QGestureEvent *event); |
98 void initStyleOption( HbStyleOptionProgressSliderHandle *option ) const; |
102 void initStyleOption( HbStyleOptionProgressSliderHandle *option ) const; |
|
103 void initPrimitiveData(HbStylePrimitiveData *primitiveData, const QGraphicsObject *primitive); |
99 |
104 |
100 private: |
105 private: |
101 StateFlags mFlags; |
106 StateFlags mFlags; |
102 HbHandleParent *q; |
107 HbHandleParent *q; |
103 QPointF mMousePressPos; |
108 QPointF mMousePressPos; |
104 QPointF mItemPosAtPress; |
109 QPointF mItemPosAtPress; |
105 QPointF mItemCurPos; |
110 QPointF mItemCurPos; |
106 QGraphicsItem *mHandleIconItem; |
111 QPointF oldCord; |
107 QGraphicsItem *mTouchItem; |
112 |
|
113 |
|
114 QGraphicsObject *mHandleIconItem; |
|
115 QGraphicsObject *mTouchItem; |
|
116 |
108 HbIcon mHandleIcon; |
117 HbIcon mHandleIcon; |
|
118 bool mPressedState; |
|
119 QTimeLine *mTimeline; |
|
120 QPointF mStartPoint; |
|
121 qreal mIncrValue; |
|
122 bool mOutOfBound; |
109 }; |
123 }; |
110 |
124 |
111 #endif //HBPROGRESSSLIDERHANDLE_P_H |
125 #endif //HBPROGRESSSLIDERHANDLE_P_H |
112 |
126 |