The class declaration should be the first header in the cc file for
[shopper.git] / src / ui / GestureWatcher.h
blob0bd65885786fcf474de18c91888d15eaefe3468c
1 /* Shopper
2 * Copyright (C) 2008 David Greaves
4 * This software is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public License
6 * as published by the Free Software Foundation; either version 2.1 of
7 * the License, or (at your option) any later version.
9 * This software is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this software; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17 * 02110-1301 USA
20 #ifndef GESTUREWATCHER_H
21 #define GESTUREWATCHER_H
23 #include "shopper.h" // automake, i8n, gettext
24 #include "Gesture.h"
25 #include "GestureReader.h"
26 #include <QWidget>
27 #include <QMouseEvent>
29 class GestureWatcher : public QObject
31 public:
32 static GestureWatcher* getGestureWatcher();
33 bool connect(QWidget *w, const Gesture &g,
34 QObject *receiver, const char * method);
35 bool disconnect(QWidget *w, const Gesture &g = Gesture(""),
36 QObject *receiver = 0, const char * method = 0);
37 // w disconnect all gestures from this widget
38 // w,g disconnect all target/methods for this gestures on this widget
39 // w,g,r disconnect all methods for this target for this gestures on this widget
40 // w,g,r,m disconnect this methods for this target for this gestures on this widget
42 protected:
43 GestureWatcher();
44 ~GestureWatcher();
46 // Manage the heirarchy of widgets
47 void registerHeirarchyForGestures(QObject *top);
48 void deregisterHeirarchyForGestures(QObject *top);
50 // manage incoming events
51 bool eventFilter( QObject *obj, QEvent *event );
52 void timerEvent(QTimerEvent *event);
53 void replayEvents();
55 // Helper
56 void clearEvents();
58 // Private data structure...
59 struct Private;
60 struct WidgetInfo;
61 struct Watched;
63 struct Private *p;
64 // The singleton
65 static GestureWatcher* theWatcher;
70 #endif //GESTUREWATCHER_H