1 | // Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QT3DINPUT_INPUT_MOUSEHANDLER_H |
5 | #define QT3DINPUT_INPUT_MOUSEHANDLER_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists for the convenience |
12 | // of other Qt classes. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <Qt3DInput/qmouseevent.h> |
19 | #include <Qt3DInput/private/backendnode_p.h> |
20 | |
21 | QT_BEGIN_NAMESPACE |
22 | |
23 | namespace Qt3DInput { |
24 | namespace Input { |
25 | |
26 | class InputHandler; |
27 | |
28 | class MouseHandler : public BackendNode |
29 | { |
30 | public: |
31 | MouseHandler(); |
32 | ~MouseHandler(); |
33 | |
34 | Qt3DCore::QNodeId mouseDevice() const; |
35 | void setInputHandler(InputHandler *handler); |
36 | |
37 | protected: |
38 | void syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime) override; |
39 | void setDevice(Qt3DCore::QNodeId device); |
40 | |
41 | private: |
42 | Qt3DCore::QNodeId m_mouseDevice; |
43 | InputHandler *m_inputHandler; |
44 | }; |
45 | |
46 | class MouseHandlerFunctor : public Qt3DCore::QBackendNodeMapper |
47 | { |
48 | public: |
49 | explicit MouseHandlerFunctor(InputHandler *handler); |
50 | |
51 | Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const override; |
52 | Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const override; |
53 | void destroy(Qt3DCore::QNodeId id) const override; |
54 | |
55 | private: |
56 | InputHandler *m_handler; |
57 | }; |
58 | |
59 | } // namespace Input |
60 | } // namespace Qt3DInput |
61 | |
62 | QT_END_NAMESPACE |
63 | |
64 | #endif // QT3DINPUT_INPUT_MOUSEHANDLER_H |
65 | |