Line data Source code
1 :
2 : /* Copyright (c) 2014-2016, Daniel Nachbaur <danielnachbaur@gmail.com>
3 : *
4 : * This library is free software; you can redistribute it and/or modify it under
5 : * the terms of the GNU Lesser General Public License version 2.1 as published
6 : * by the Free Software Foundation.
7 : *
8 : * This library is distributed in the hope that it will be useful, but WITHOUT
9 : * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 : * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11 : * details.
12 : *
13 : * You should have received a copy of the GNU Lesser General Public License
14 : * along with this library; if not, write to the Free Software Foundation, Inc.,
15 : * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 : */
17 :
18 : #ifndef EQ_QT_EVENTHANDLER_H
19 : #define EQ_QT_EVENTHANDLER_H
20 :
21 : #include <QObject> // base class
22 : #include <eq/eventHandler.h> // base class
23 : #include <eq/qt/types.h>
24 :
25 : namespace eq
26 : {
27 : namespace qt
28 : {
29 : /** The event handler for Qt windows.
30 : *
31 : * If needed, reposts Qt events to the thread which called the constructor
32 : * before processing them.
33 : */
34 : class EventHandler : public QObject, public eq::EventHandler
35 : {
36 : public:
37 : /** Construct a new Qt event handler. @version 1.7.3 */
38 : explicit EventHandler(WindowIF& window);
39 :
40 : /** Destruct the Qt event handler. @version 1.7.3 */
41 : ~EventHandler() final;
42 :
43 : /** @return the handled parent window */
44 0 : WindowIF& getWindow() { return _window; }
45 : private:
46 : WindowIF& _window;
47 :
48 : bool event(QEvent* evt) override;
49 :
50 : bool _processEvent(QEvent* event);
51 : bool _processSizeEvent(EventType, QEvent*);
52 : bool _processPointerEvent(EventType, QEvent*);
53 : bool _processWheelEvent(QEvent*);
54 : bool _processKeyEvent(EventType, QEvent*);
55 : };
56 : }
57 : }
58 : #endif // EQ_QT_EVENTHANDLER_H
|