| 1 | // Copyright (C) 2018 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | #include "qquickpointerhandler_p.h" |
| 4 | |
| 5 | #ifndef QQUICKPOINTERDEVICEHANDLER_H |
| 6 | #define QQUICKPOINTERDEVICEHANDLER_H |
| 7 | |
| 8 | // |
| 9 | // W A R N I N G |
| 10 | // ------------- |
| 11 | // |
| 12 | // This file is not part of the Qt API. It exists purely as an |
| 13 | // implementation detail. This header file may change from version to |
| 14 | // version without notice, or even be removed. |
| 15 | // |
| 16 | // We mean it. |
| 17 | // |
| 18 | |
| 19 | QT_BEGIN_NAMESPACE |
| 20 | |
| 21 | class QQuickPointerDeviceHandlerPrivate; |
| 22 | |
| 23 | class Q_QUICK_EXPORT QQuickPointerDeviceHandler : public QQuickPointerHandler |
| 24 | { |
| 25 | Q_OBJECT |
| 26 | Q_PROPERTY(QInputDevice::DeviceTypes acceptedDevices READ acceptedDevices WRITE |
| 27 | setAcceptedDevices NOTIFY acceptedDevicesChanged) |
| 28 | Q_PROPERTY(QPointingDevice::PointerTypes acceptedPointerTypes READ acceptedPointerTypes WRITE setAcceptedPointerTypes NOTIFY acceptedPointerTypesChanged) |
| 29 | Q_PROPERTY(Qt::MouseButtons acceptedButtons READ acceptedButtons WRITE setAcceptedButtons NOTIFY acceptedButtonsChanged) |
| 30 | Q_PROPERTY(Qt::KeyboardModifiers acceptedModifiers READ acceptedModifiers WRITE setAcceptedModifiers NOTIFY acceptedModifiersChanged) |
| 31 | |
| 32 | public: |
| 33 | explicit QQuickPointerDeviceHandler(QQuickItem *parent = nullptr); |
| 34 | |
| 35 | QInputDevice::DeviceTypes acceptedDevices() const; |
| 36 | QPointingDevice::PointerTypes acceptedPointerTypes() const; |
| 37 | Qt::MouseButtons acceptedButtons() const; |
| 38 | Qt::KeyboardModifiers acceptedModifiers() const; |
| 39 | |
| 40 | public Q_SLOTS: |
| 41 | void setAcceptedDevices(QInputDevice::DeviceTypes acceptedDevices); |
| 42 | void setAcceptedPointerTypes(QPointingDevice::PointerTypes acceptedPointerTypes); |
| 43 | void setAcceptedButtons(Qt::MouseButtons buttons); |
| 44 | void setAcceptedModifiers(Qt::KeyboardModifiers acceptedModifiers); |
| 45 | |
| 46 | Q_SIGNALS: |
| 47 | void acceptedDevicesChanged(); |
| 48 | void acceptedPointerTypesChanged(); |
| 49 | void acceptedButtonsChanged(); |
| 50 | void acceptedModifiersChanged(); |
| 51 | |
| 52 | protected: |
| 53 | QQuickPointerDeviceHandler(QQuickPointerDeviceHandlerPrivate &dd, QQuickItem *parent = nullptr); |
| 54 | |
| 55 | bool wantsPointerEvent(QPointerEvent *event) override; |
| 56 | |
| 57 | Q_DECLARE_PRIVATE(QQuickPointerDeviceHandler) |
| 58 | }; |
| 59 | |
| 60 | QT_END_NAMESPACE |
| 61 | |
| 62 | #endif // QQUICKPOINTERDEVICEHANDLER_H |
| 63 | |