src/gui/kernel/qgesturemanager_p.h
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
--- a/src/gui/kernel/qgesturemanager_p.h	Tue Jan 26 12:42:25 2010 +0200
+++ b/src/gui/kernel/qgesturemanager_p.h	Tue Feb 02 00:43:10 2010 +0200
@@ -73,22 +73,27 @@
     void unregisterGestureRecognizer(Qt::GestureType type);
 
     bool filterEvent(QWidget *receiver, QEvent *event);
-    bool filterEvent(QGesture *receiver, QEvent *event);
+    bool filterEvent(QObject *receiver, QEvent *event);
+#ifndef QT_NO_GRAPHICSVIEW
     bool filterEvent(QGraphicsObject *receiver, QEvent *event);
+#endif //QT_NO_GRAPHICSVIEW
 
-    // declared in qapplication.cpp
     static QGestureManager* instance();
 
+    void cleanupCachedGestures(QObject *target, Qt::GestureType type);
+
+    void recycle(QGesture *gesture);
+
 protected:
     void timerEvent(QTimerEvent *event);
-    bool filterEventThroughContexts(const QMap<QObject *, Qt::GestureType> &contexts,
+    bool filterEventThroughContexts(const QMultiMap<QObject *, Qt::GestureType> &contexts,
                                     QEvent *event);
 
 private:
-    QMultiMap<Qt::GestureType, QGestureRecognizer *> recognizers;
+    QMultiMap<Qt::GestureType, QGestureRecognizer *> m_recognizers;
 
-    QSet<QGesture *> activeGestures;
-    QMap<QGesture *, QBasicTimer> maybeGestures;
+    QSet<QGesture *> m_activeGestures;
+    QHash<QGesture *, QBasicTimer> m_maybeGestures;
 
     enum State {
         Gesture,
@@ -104,7 +109,7 @@
         Qt::GestureType gesture;
 
         ObjectGesture(QObject *o, const Qt::GestureType &g) : object(o), gesture(g) { }
-        inline bool operator<(const ObjectGesture& rhs) const
+        inline bool operator<(const ObjectGesture &rhs) const
         {
             if (object.data() < rhs.object.data())
                 return true;
@@ -114,22 +119,31 @@
         }
     };
 
-    QMap<ObjectGesture, QGesture *> objectGestures;
-    QMap<QGesture *, QGestureRecognizer *> gestureToRecognizer;
-    QHash<QGesture *, QObject *> gestureOwners;
+    QMap<ObjectGesture, QList<QGesture *> > m_objectGestures;
+    QHash<QGesture *, QGestureRecognizer *> m_gestureToRecognizer;
+    QHash<QGesture *, QObject *> m_gestureOwners;
+
+    QHash<QGesture *, QWidget *> m_gestureTargets;
 
-    QHash<QGesture *, QWidget *> gestureTargets;
+    int m_lastCustomGestureId;
 
-    int lastCustomGestureId;
+    QHash<QGestureRecognizer *, QList<QGesture *> > m_obsoleteGestures;
+    QHash<QGesture *, QGestureRecognizer *> m_deletedRecognizers;
+    void cleanupGesturesForRemovedRecognizer(QGesture *gesture);
 
-    QGesture *getState(QObject *widget, Qt::GestureType gesture);
+    QGesture *getState(QObject *widget, QGestureRecognizer *recognizer,
+                       Qt::GestureType gesture);
     void deliverEvents(const QSet<QGesture *> &gestures,
                        QSet<QGesture *> *undeliveredGestures);
     void getGestureTargets(const QSet<QGesture*> &gestures,
                            QMap<QWidget *, QList<QGesture *> > *conflicts,
                            QMap<QWidget *, QList<QGesture *> > *normal);
+
+    void cancelGesturesForChildren(QGesture *originatingGesture);
 };
 
+extern QGestureManager *qt_gestureManager;
+
 QT_END_NAMESPACE
 
 #endif // QGESTUREMANAGER_P_H