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 QPLATFORMDRAG_H |
5 | #define QPLATFORMDRAG_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is part of the QPA API and is not meant to be used |
12 | // in applications. Usage of this API may make your code |
13 | // source and binary incompatible with future versions of Qt. |
14 | // |
15 | |
16 | #include <QtGui/qtguiglobal.h> |
17 | #include <QtGui/QPixmap> |
18 | |
19 | QT_REQUIRE_CONFIG(draganddrop); |
20 | |
21 | QT_BEGIN_NAMESPACE |
22 | |
23 | class QMimeData; |
24 | class QMouseEvent; |
25 | class QDrag; |
26 | class QObject; |
27 | class QEvent; |
28 | class QPlatformDragPrivate; |
29 | |
30 | class Q_GUI_EXPORT QPlatformDropQtResponse |
31 | { |
32 | public: |
33 | QPlatformDropQtResponse(bool accepted, Qt::DropAction acceptedAction); |
34 | bool isAccepted() const; |
35 | Qt::DropAction acceptedAction() const; |
36 | |
37 | private: |
38 | bool m_accepted; |
39 | Qt::DropAction m_accepted_action; |
40 | |
41 | }; |
42 | |
43 | class Q_GUI_EXPORT QPlatformDragQtResponse : public QPlatformDropQtResponse |
44 | { |
45 | public: |
46 | QPlatformDragQtResponse(bool accepted, Qt::DropAction acceptedAction, QRect answerRect); |
47 | |
48 | QRect answerRect() const; |
49 | |
50 | private: |
51 | QRect m_answer_rect; |
52 | }; |
53 | |
54 | class Q_GUI_EXPORT QPlatformDrag |
55 | { |
56 | Q_DECLARE_PRIVATE(QPlatformDrag) |
57 | public: |
58 | Q_DISABLE_COPY_MOVE(QPlatformDrag) |
59 | |
60 | QPlatformDrag(); |
61 | virtual ~QPlatformDrag(); |
62 | |
63 | QDrag *currentDrag() const; |
64 | |
65 | virtual Qt::DropAction drag(QDrag *m_drag) = 0; |
66 | virtual void cancelDrag(); |
67 | void updateAction(Qt::DropAction action); |
68 | |
69 | virtual Qt::DropAction defaultAction(Qt::DropActions possibleActions, Qt::KeyboardModifiers modifiers) const; |
70 | |
71 | static QPixmap defaultPixmap(); |
72 | |
73 | virtual bool ownsDragObject() const; |
74 | |
75 | private: |
76 | QPlatformDragPrivate *d_ptr; |
77 | }; |
78 | |
79 | QT_END_NAMESPACE |
80 | |
81 | #endif |
82 | |