|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * |
|
5 * This program is free software: you can redistribute it and/or modify |
|
6 * it under the terms of the GNU Lesser General Public License as published by |
|
7 * the Free Software Foundation, version 2.1 of the License. |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU Lesser General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU Lesser General Public License |
|
15 * along with this program. If not, |
|
16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". |
|
17 * |
|
18 * Description: |
|
19 * |
|
20 */ |
|
21 |
|
22 #ifndef QSTMMAYBETAPGESTURERECOGNISER_H_ |
|
23 #define QSTMAYBEMTAPGESTURERECOGNISER_H_ |
|
24 |
|
25 #include <qstmgestureengine_if.h> |
|
26 #include <qstmgesture_if.h> |
|
27 #include <qstmgesturelistener_if.h> |
|
28 #include "uitimer.h" |
|
29 |
|
30 namespace qstmGesture |
|
31 { |
|
32 |
|
33 class QStm_MaybeTapGestureRecogniser : public QStm_GestureRecogniser |
|
34 { |
|
35 Q_OBJECT |
|
36 public: |
|
37 static const QStm_GestureUid KUid = EGestureUidMaybeTap; |
|
38 |
|
39 virtual ~QStm_MaybeTapGestureRecogniser(); |
|
40 |
|
41 virtual QStm_GestureRecognitionState recognise(int numOfActiveStreams, QStm_GestureEngineIf* ge) ; |
|
42 virtual void release(QStm_GestureEngineIf* ge) ; |
|
43 virtual void enable(bool enabled) ; |
|
44 virtual bool isEnabled() ; |
|
45 virtual void setOwner(void* owner) ; |
|
46 |
|
47 virtual QStm_GestureUid gestureUid() const { return KUid; } |
|
48 |
|
49 void addTapListener(QStm_GestureListenerIf* listener, void* listenerOwner) ; |
|
50 void removeTapListener(QStm_GestureListenerIf* listener, void* listenerOwner) ; |
|
51 virtual void enableLogging(bool loggingOn) ; |
|
52 void setTapRange(int rangeInMillimetres); |
|
53 QStm_MaybeTapGestureRecogniser(QStm_GestureListenerIf* listener) ; |
|
54 |
|
55 private: |
|
56 bool m_loggingenabled ; |
|
57 bool isPointClose(const QPoint& firstPoint, const QPoint& secondPoint) ; |
|
58 private: |
|
59 void* m_powner ; // The owning control for this gesture |
|
60 |
|
61 QPoint m_firstTapXY ; |
|
62 void* m_firstTapTarget ; |
|
63 float m_firstTapSpeed ; |
|
64 bool m_gestureEnabled ; |
|
65 int m_rangesizeInPixels ; |
|
66 // use simple arrays to store the listeners and corresponding windows |
|
67 QList<QStm_GestureListenerIf*> m_tapListeners ; |
|
68 QList<void*> m_tapListenerWindows ; |
|
69 int m_numOfActiveStreams; |
|
70 }; |
|
71 |
|
72 } // namespace |
|
73 |
|
74 #endif /* QSTMTAPGESTURERECOGNISER_H_ */ |