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
21QT_BEGIN_NAMESPACE
22
23namespace Qt3DInput {
24namespace Input {
25
26class InputHandler;
27
28class MouseHandler : public BackendNode
29{
30public:
31 MouseHandler();
32 ~MouseHandler();
33
34 Qt3DCore::QNodeId mouseDevice() const;
35 void setInputHandler(InputHandler *handler);
36
37protected:
38 void syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime) override;
39 void setDevice(Qt3DCore::QNodeId device);
40
41private:
42 Qt3DCore::QNodeId m_mouseDevice;
43 InputHandler *m_inputHandler;
44};
45
46class MouseHandlerFunctor : public Qt3DCore::QBackendNodeMapper
47{
48public:
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
55private:
56 InputHandler *m_handler;
57};
58
59} // namespace Input
60} // namespace Qt3DInput
61
62QT_END_NAMESPACE
63
64#endif // QT3DINPUT_INPUT_MOUSEHANDLER_H
65

source code of qt3d/src/input/backend/mousehandler_p.h