45
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: CalenDayContentScrollArea class definition.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef CALENDAYCONTENTSCROLLAREA_H_
|
|
19 |
#define CALENDAYCONTENTSCROLLAREA_H_
|
|
20 |
|
|
21 |
// System includes
|
63
|
22 |
#include <HbScrollArea>
|
45
|
23 |
|
|
24 |
// User includes
|
|
25 |
#include "calendaycommonheaders.h"
|
|
26 |
|
70
|
27 |
/*!
|
|
28 |
Value [degree] defines the max. angle of swipe gesture which should change day.
|
|
29 |
*/
|
|
30 |
const qreal KCalenSwipeAngle = 30;
|
|
31 |
|
55
|
32 |
#ifdef CALENVIEWS_DLL
|
|
33 |
#define CALENDAYCONTENTSCROLLAREA_EXPORT Q_DECL_EXPORT
|
|
34 |
#else
|
|
35 |
#define CALENDAYCONTENTSCROLLAREA_EXPORT Q_DECL_IMPORT
|
|
36 |
#endif
|
|
37 |
|
45
|
38 |
// Class declaration
|
55
|
39 |
class CALENDAYCONTENTSCROLLAREA_EXPORT CalenDayContentScrollArea : public HbScrollArea
|
45
|
40 |
{
|
|
41 |
Q_OBJECT
|
|
42 |
|
|
43 |
public:
|
|
44 |
CalenDayContentScrollArea(QGraphicsItem *parent = 0);
|
|
45 |
virtual ~CalenDayContentScrollArea();
|
57
|
46 |
|
|
47 |
public:
|
|
48 |
/*!
|
|
49 |
\enum CalenPanDirection
|
|
50 |
\brief Enumeration identifies pan gesture directions.
|
|
51 |
*/
|
|
52 |
enum CalenPanDirection
|
|
53 |
{
|
|
54 |
ECalenPanNotSet = 0,
|
|
55 |
ECalenPanVertical,
|
|
56 |
ECalenPanHorizontal
|
|
57 |
};
|
45
|
58 |
|
|
59 |
signals:
|
|
60 |
void scrollAreaMoveStarted(CalenScrollDirection scrollTo);
|
|
61 |
void scrollAreaMoveFinished(CalenScrollDirection scrollTo);
|
|
62 |
|
|
63 |
public slots:
|
|
64 |
void scrollToMiddleWidget();
|
|
65 |
|
|
66 |
protected:
|
|
67 |
bool scrollByAmount(const QPointF &delta);
|
|
68 |
|
|
69 |
void gestureEvent(QGestureEvent *event);
|
|
70 |
bool eventFilter(QObject *obj, QEvent *event);
|
|
71 |
bool event(QEvent *e);
|
|
72 |
|
|
73 |
private: // private functions
|
|
74 |
void checkPanDirection(QPanGesture *panGesture);
|
|
75 |
void moveTo(const QPointF &newPosition, int time = 0);
|
57
|
76 |
bool isHorizontalSwipe(qreal angle) const;
|
45
|
77 |
|
|
78 |
private slots:
|
|
79 |
void moveFinished();
|
|
80 |
void orientationChanged(Qt::Orientation orientation);
|
|
81 |
|
|
82 |
private: // data
|
|
83 |
QPointF mStartPosition; //!< Start position of movement
|
|
84 |
|
|
85 |
qreal mContentWidth; //!< Content width
|
|
86 |
|
|
87 |
Qt::Orientation mOrientation; //!< Stores current orientation
|
|
88 |
|
|
89 |
/*!
|
|
90 |
\brief Pan gesture direction indicator
|
|
91 |
|
|
92 |
Member is used when switching widgets by panning gesture is enabled.
|
|
93 |
*/
|
|
94 |
CalenPanDirection mPanDayDirection;
|
|
95 |
|
|
96 |
bool mIsMoving; //!< Indicates if moving of scroll area is in progress
|
|
97 |
|
|
98 |
/*!
|
|
99 |
\brief Scroll area horizontal move direction
|
|
100 |
*/
|
|
101 |
CalenScrollDirection mMoveDirection;
|
|
102 |
};
|
|
103 |
|
|
104 |
#endif /* CALENDAYCONTENTSCROLLAREA_H_ */
|