1 | // Copyright (C) 2016 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 | |
4 | #ifndef QWAYLANDDATASOURCE_H |
5 | #define QWAYLANDDATASOURCE_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 purely as an |
12 | // implementation detail. 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 <QObject> |
19 | |
20 | #include <QtWaylandClient/private/qwayland-wayland.h> |
21 | #include <QtWaylandClient/private/qtwaylandclientglobal_p.h> |
22 | |
23 | QT_REQUIRE_CONFIG(wayland_datadevice); |
24 | |
25 | QT_BEGIN_NAMESPACE |
26 | |
27 | class QMimeData; |
28 | |
29 | namespace QtWaylandClient { |
30 | |
31 | class QWaylandDataDeviceManager; |
32 | class QWaylandDisplay; |
33 | |
34 | class Q_WAYLANDCLIENT_EXPORT QWaylandDataSource : public QObject, public QtWayland::wl_data_source |
35 | { |
36 | Q_OBJECT |
37 | public: |
38 | QWaylandDataSource(QWaylandDataDeviceManager *dataDeviceManager, QMimeData *mimeData); |
39 | ~QWaylandDataSource() override; |
40 | |
41 | Q_SIGNALS: |
42 | void cancelled(); |
43 | void finished(); |
44 | |
45 | void dndResponseUpdated(bool accepted, Qt::DropAction action); |
46 | void dndDropped(bool accepted, Qt::DropAction action); |
47 | |
48 | protected: |
49 | void data_source_cancelled() override; |
50 | void data_source_send(const QString &mime_type, int32_t fd) override; |
51 | void data_source_target(const QString &mime_type) override; |
52 | void data_source_dnd_drop_performed() override; |
53 | void data_source_dnd_finished() override; |
54 | void data_source_action(uint32_t action) override; |
55 | |
56 | private: |
57 | QMimeData *m_mime_data = nullptr; |
58 | bool m_accepted = false; |
59 | Qt::DropAction m_dropAction = Qt::IgnoreAction; |
60 | }; |
61 | |
62 | } |
63 | |
64 | QT_END_NAMESPACE |
65 | |
66 | #endif // QWAYLANDDATASOURCE_H |
67 | |