23 #define WEBGESTUREHELPER_H_ |
23 #define WEBGESTUREHELPER_H_ |
24 #include "qstmgestureapi.h" |
24 #include "qstmgestureapi.h" |
25 #include "qstmgestureevent.h" |
25 #include "qstmgestureevent.h" |
26 #include <QApplication> |
26 #include <QApplication> |
27 //#include "BWFGlobal.h" |
27 //#include "BWFGlobal.h" |
|
28 #if defined(ORBIT_UI) |
|
29 #include <hbapplication.h> |
|
30 #endif |
28 |
31 |
29 #if !defined(Q_WS_X11) |
32 #if !defined(Q_WS_X11) |
30 #define XEvent void |
33 #define XEvent void |
31 #endif |
34 #endif |
32 |
35 |
33 |
36 |
34 class QStm_QtDummyGestureRecognizer; |
37 class QStm_QtDummyGestureRecognizer; |
35 |
38 |
36 class WebGestureHelper |
39 class WebGestureHelper |
37 { |
40 { |
38 public: |
41 public: |
39 WebGestureHelper(QWidget* ctrl); |
42 WebGestureHelper(QWidget* ctrl); |
40 |
43 |
41 virtual ~WebGestureHelper(); |
44 virtual ~WebGestureHelper(); |
42 |
45 |
43 QStm_GestureEngineApi* gestureEngine() { return m_gestureEngine; } |
46 QStm_GestureEngineApi* gestureEngine() { return m_gestureEngine; } |
44 QStm_GestureContext* gestureContext(){ return m_gestures; } |
47 QStm_GestureContext* gestureContext(){ return m_gestures; } |
45 bool symbianEventFilter(const QSymbianEvent *event); |
48 bool symbianEventFilter(const QSymbianEvent *event); |
46 bool x11EventFilter (XEvent* event); |
49 bool x11EventFilter (XEvent* event); |
|
50 bool winEventFilter(void* event); |
47 void setupGestureEngine(QWidget* ctrl); |
51 void setupGestureEngine(QWidget* ctrl); |
48 |
52 bool shouldHandleGesture(); |
|
53 bool isFilteredByGestureEngine(); |
49 private: |
54 private: |
50 QStm_GestureEngineApi* m_gestureEngine; |
55 QStm_GestureEngineApi* m_gestureEngine; |
51 QStm_GestureContext* m_gestures; |
56 QStm_GestureContext* m_gestures; |
52 QStm_GestureParameters* m_parameters; |
57 QStm_GestureParameters* m_parameters; |
53 QWidget* m_ctrl; |
58 QWidget* m_ctrl; |
59 |
64 |
60 |
65 |
61 |
66 |
62 #define browserApp (static_cast<BrowserApp*>(QApplication::instance())) |
67 #define browserApp (static_cast<BrowserApp*>(QApplication::instance())) |
63 |
68 |
64 class BrowserApp : public QApplication |
69 |
|
70 #if defined(ORBIT_UI) |
|
71 #define ParentApp HbApplication |
|
72 #else |
|
73 #define ParentApp QApplication |
|
74 #endif |
|
75 |
|
76 #ifndef Q_OS_WIN |
|
77 typedef void* MSG; |
|
78 #endif |
|
79 |
|
80 class BrowserApp : public ParentApp |
65 { |
81 { |
66 Q_OBJECT |
82 Q_OBJECT |
67 public: |
83 public: |
68 BrowserApp(int argc, char** argv); |
84 |
|
85 #if defined(ORBIT_UI) |
|
86 BrowserApp(QS60MainApplicationFactory appfactory, int & argc, char** argv); |
|
87 #endif |
|
88 BrowserApp(int & argc, char** argv); |
69 virtual bool symbianEventFilter(const QSymbianEvent *event); |
89 virtual bool symbianEventFilter(const QSymbianEvent *event); |
70 virtual bool x11EventFilter (XEvent* event); |
90 virtual bool x11EventFilter (XEvent* event); |
|
91 virtual bool winEventFilter(MSG* message, long* result); |
71 void setGestureHelper(WebGestureHelper* gh); |
92 void setGestureHelper(WebGestureHelper* gh); |
72 WebGestureHelper* gestureHelper() { return m_gestureHelper; } |
93 WebGestureHelper* gestureHelper() { return m_gestureHelper; } |
73 |
94 |
74 void setMainWindow(QWidget* mw) { m_mainWindow = mw; } |
95 void setMainWindow(QWidget* mw) { m_mainWindow = mw; } |
75 QWidget* mainWindow() { return m_mainWindow; } |
96 QWidget* mainWindow() { return m_mainWindow; } |
76 QStm_GestureEngineApi* gestureEngine() { return m_gestureEngine; } |
97 QStm_GestureEngineApi* gestureEngine() { return m_gestureEngine; } |
|
98 // bool event(QEvent* event); |
77 |
99 |
78 private: |
100 private: |
79 WebGestureHelper* m_gestureHelper; |
101 WebGestureHelper* m_gestureHelper; |
80 QWidget* m_mainWindow; |
102 QWidget* m_mainWindow; |
81 QStm_GestureEngineApi* m_gestureEngine; |
103 QStm_GestureEngineApi* m_gestureEngine; |
82 }; |
104 }; |
83 |
105 |
84 |
106 |
85 |
107 |
86 class WebGestureHelperEventFilter : public QObject |
|
87 { |
|
88 public: |
|
89 WebGestureHelperEventFilter() {} |
|
90 virtual ~WebGestureHelperEventFilter() {} |
|
91 static WebGestureHelperEventFilter* instance(); |
|
92 bool eventFilter(QObject* receiver, QEvent* event); |
|
93 |
|
94 private: |
|
95 static WebGestureHelperEventFilter* m_instance; |
|
96 }; |
|
97 |
108 |
98 |
109 |
99 class QStm_QtDummyGestureRecognizer : public QGestureRecognizer, |
110 class QStm_QtDummyGestureRecognizer : public QObject, |
|
111 public QGestureRecognizer, |
100 public QStm_GestureListenerApiIf |
112 public QStm_GestureListenerApiIf |
101 { |
113 { |
|
114 Q_OBJECT |
102 public: |
115 public: |
103 QStm_QtDummyGestureRecognizer(QStm_GestureContext* ctx); |
116 QStm_QtDummyGestureRecognizer(QStm_GestureContext* ctx); |
104 ~QStm_QtDummyGestureRecognizer(); |
117 ~QStm_QtDummyGestureRecognizer(); |
105 QGesture* create(QObject* target); |
118 QGesture* create(QObject* target); |
106 QGestureRecognizer::Result recognize(QGesture *state, |
119 QGestureRecognizer::Result recognize(QGesture *state, |
109 void reset(QGesture *state); |
122 void reset(QGesture *state); |
110 |
123 |
111 //from QStm_GestureListenerApiIf |
124 //from QStm_GestureListenerApiIf |
112 QStm_ProcessingResult handleGestureEvent(qstmGesture::QStm_GestureUid uid, qstmGesture::QStm_GestureIf* gesture); |
125 QStm_ProcessingResult handleGestureEvent(qstmGesture::QStm_GestureUid uid, qstmGesture::QStm_GestureIf* gesture); |
113 |
126 |
|
127 public slots: |
|
128 void handleQStmUiEvent(const qstmUiEventEngine::QStm_UiEventIf&); |
|
129 |
114 private: |
130 private: |
115 QStm_GestureContext* m_context; |
131 QStm_GestureContext* m_context; |
116 QStm_Gesture* m_currentGesture; |
132 QStm_Gesture* m_currentGesture; |
117 }; |
133 }; |
118 |
134 |