summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm/qwasmdrag.h
blob: 146a69ebe890b4b9b0c73a8a5bcf5d01ae3555c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#ifndef QWINDOWSDRAG_H
#define QWINDOWSDRAG_H

#include <private/qstdweb_p.h>
#include <private/qsimpledrag_p.h>

#include <qpa/qplatformdrag.h>
#include <QtGui/qdrag.h>

#include <memory>

QT_BEGIN_NAMESPACE

struct DragEvent;

class QWasmDrag final : public QSimpleDrag
{
public:
    QWasmDrag();
    ~QWasmDrag() override;
    QWasmDrag(const QWasmDrag &other) = delete;
    QWasmDrag(QWasmDrag &&other) = delete;
    QWasmDrag &operator=(const QWasmDrag &other) = delete;
    QWasmDrag &operator=(QWasmDrag &&other) = delete;

    static QWasmDrag *instance();

    void onNativeDragOver(DragEvent *event);
    void onNativeDrop(DragEvent *event);
    void onNativeDragStarted(DragEvent *event);
    void onNativeDragFinished(DragEvent *event);

    // QPlatformDrag:
    Qt::DropAction drag(QDrag *drag) final;

private:
    struct DragState;

    std::unique_ptr<DragState> m_dragState;
};

QT_END_NAMESPACE

#endif // QWINDOWSDRAG_H