author | hgs |
Wed, 06 Oct 2010 14:53:41 +0300 | |
changeset 20 | a60f8b6b1d32 |
parent 17 | a10844a9914d |
permissions | -rw-r--r-- |
0
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
11 |
* |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
14 |
* Description: |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
15 |
* |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
|
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
18 |
#ifndef HGGRIDCONTAINER_H |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
#define HGGRIDCONTAINER_H |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
20 |
|
6 | 21 |
#include "hgcontainer.h" |
17 | 22 |
#include <QPropertyAnimation> |
23 |
#include <QQueue> |
|
0
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
24 |
|
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
25 |
class HgWidgetItem; |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
26 |
class HgMediaWallRenderer; |
17 | 27 |
class HbPinchGesture; |
0
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
28 |
|
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
29 |
class HgGridContainer : public HgContainer |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
30 |
{ |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
31 |
Q_OBJECT |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
32 |
Q_DISABLE_COPY(HgGridContainer) |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
33 |
|
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
34 |
public: |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
35 |
explicit HgGridContainer(QGraphicsItem *parent = 0); |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
36 |
|
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
37 |
virtual ~HgGridContainer(); |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
38 |
|
3
c863538fcbb6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
39 |
void setEffect3dEnabled(bool effect3dEnabled); |
c863538fcbb6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
40 |
bool effect3dEnabled() const; |
c863538fcbb6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
41 |
|
17 | 42 |
void setPinchEnabled(bool pinchEnabled); |
43 |
bool pinchEnabled() const; |
|
44 |
void setPinchLevels(QPair<int,int> levels, Qt::Orientation scrollDirection); |
|
45 |
QPair<int,int> pinchLevels(Qt::Orientation scrollDirection) const; |
|
46 |
||
47 |
void setRowCount(int count, Qt::Orientation scrollDirection = Qt::Horizontal); |
|
48 |
int rowCount(Qt::Orientation scrollDirection) const; |
|
49 |
||
20 | 50 |
void setReflectionsEnabled(bool reflectionsEnabled); |
51 |
bool reflectionsEnabled() const; |
|
52 |
||
17 | 53 |
signals: |
54 |
||
55 |
void emptySpacePressed(); |
|
56 |
||
0
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
57 |
protected: |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
58 |
|
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
59 |
// events |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
60 |
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
61 |
|
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
62 |
// from HgContainer |
1
e48454f237ca
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
63 |
virtual HgMediaWallRenderer* createRenderer(Qt::Orientation scrollDirection); |
0
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
64 |
virtual qreal getCameraDistance(qreal springVelocity); |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
65 |
virtual qreal getCameraRotationY(qreal springVelocity); |
17 | 66 |
virtual bool handleTapAction(const QPointF& pos, HgWidgetItem* hitItem, int hitItemIndex); |
67 |
virtual bool handleLongTapAction(const QPointF& pos, HgWidgetItem* hitItem, int hitItemindex); |
|
1
e48454f237ca
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
68 |
virtual void onScrollPositionChanged(qreal pos); |
17 | 69 |
virtual bool handleTap(Qt::GestureState state, const QPointF &pos); |
70 |
virtual bool handleLongTap(Qt::GestureState state, const QPointF &pos); |
|
71 |
virtual void setOrientation(Qt::Orientation orientation, bool animate=true); |
|
3
c863538fcbb6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
72 |
|
17 | 73 |
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); |
74 |
void mousePressEvent(QGraphicsSceneMouseEvent *event); |
|
75 |
void gestureEvent(QGestureEvent* event); |
|
76 |
bool event(QEvent *e); |
|
77 |
||
78 |
void handlePinchEnd(); |
|
79 |
void handlePinchUpdate(HbPinchGesture* pinch); |
|
80 |
||
20 | 81 |
void updateReflections(bool enable, int start, int end); |
82 |
||
83 |
virtual void addItems(int start, int end); |
|
84 |
virtual void removeItems(int start, int end); |
|
85 |
virtual void moveItems(int start, int end, int destination); |
|
86 |
||
17 | 87 |
public slots: |
88 |
||
89 |
void effectFinished(); |
|
90 |
||
3
c863538fcbb6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
91 |
private: |
c863538fcbb6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
92 |
|
c863538fcbb6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
93 |
bool mEffect3dEnabled; |
17 | 94 |
bool mPinchEnabled; |
95 |
bool mPinchingOngoing; |
|
96 |
int mTempImageHeightForLineGrid; //this is changed during pinching |
|
97 |
int mTempImageHeightFinal; //this is changed during pinching |
|
98 |
int mTempRowCount; //this is changed during pinching |
|
99 |
int mTargetRowCount; |
|
100 |
QQueue<qreal> iTargetRowCountList; |
|
101 |
QSizeF mTargetImageSize; |
|
102 |
bool mPinchEndAlreadyHandled; |
|
103 |
bool mReactToOnlyPanGestures; |
|
104 |
QPropertyAnimation iFadeAnimation; |
|
105 |
int mHorizontalRowCount; |
|
106 |
int mVerticalColumnCount; |
|
107 |
QPair<int,int> mHorizontalPinchLevels; |
|
108 |
QPair<int,int> mVerticalPinchLevels; |
|
0
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
109 |
}; |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
110 |
|
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
111 |
#endif |