1 | // Copyright (C) 2017 Robin Burchell <robin.burchell@viroteck.net> |
2 | // Copyright (C) 2019 The Qt Company Ltd. |
3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
4 | |
5 | #ifndef QWAYLANDABSTRACTDECORATION_H |
6 | #define QWAYLANDABSTRACTDECORATION_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 | #include <QtCore/QMargins> |
20 | #include <QtCore/QPointF> |
21 | #include <QtGui/QGuiApplication> |
22 | #include <QtGui/QCursor> |
23 | #include <QtGui/QColor> |
24 | #include <QtGui/QStaticText> |
25 | #include <QtGui/QImage> |
26 | #include <QtGui/QEventPoint> |
27 | #include <QtWaylandClient/qtwaylandclientglobal.h> |
28 | |
29 | #include <QtCore/QDebug> |
30 | #include <QtCore/private/qglobal_p.h> |
31 | |
32 | QT_BEGIN_NAMESPACE |
33 | |
34 | class QWindow; |
35 | class QPaintDevice; |
36 | class QPainter; |
37 | class QEvent; |
38 | |
39 | namespace QtWaylandClient { |
40 | |
41 | class QWaylandScreen; |
42 | class QWaylandWindow; |
43 | class QWaylandInputDevice; |
44 | class QWaylandAbstractDecorationPrivate; |
45 | |
46 | class Q_WAYLANDCLIENT_EXPORT QWaylandAbstractDecoration : public QObject |
47 | { |
48 | Q_OBJECT |
49 | Q_DECLARE_PRIVATE(QWaylandAbstractDecoration) |
50 | public: |
51 | enum MarginsType { |
52 | Full, |
53 | ShadowsExcluded, |
54 | ShadowsOnly |
55 | }; |
56 | |
57 | QWaylandAbstractDecoration(); |
58 | ~QWaylandAbstractDecoration() override; |
59 | |
60 | void setWaylandWindow(QWaylandWindow *window); |
61 | QWaylandWindow *waylandWindow() const; |
62 | |
63 | void update(); |
64 | bool isDirty() const; |
65 | |
66 | virtual QMargins margins(MarginsType marginsType = Full) const = 0; |
67 | |
68 | QWindow *window() const; |
69 | const QImage &contentImage(); |
70 | |
71 | virtual bool handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global,Qt::MouseButtons b,Qt::KeyboardModifiers mods) = 0; |
72 | virtual bool handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, QEventPoint::State state, Qt::KeyboardModifiers mods) = 0; |
73 | |
74 | protected: |
75 | virtual void paint(QPaintDevice *device) = 0; |
76 | |
77 | void setMouseButtons(Qt::MouseButtons mb); |
78 | |
79 | void startResize(QWaylandInputDevice *inputDevice, Qt::Edges edges, Qt::MouseButtons buttons); |
80 | void startMove(QWaylandInputDevice *inputDevice, Qt::MouseButtons buttons); |
81 | void showWindowMenu(QWaylandInputDevice *inputDevice); |
82 | |
83 | bool isLeftClicked(Qt::MouseButtons newMouseButtonState); |
84 | bool isRightClicked(Qt::MouseButtons newMouseButtonState); |
85 | bool isLeftReleased(Qt::MouseButtons newMouseButtonState); |
86 | }; |
87 | |
88 | } |
89 | |
90 | QT_END_NAMESPACE |
91 | |
92 | #endif // QWAYLANDABSTRACTDECORATION_H |
93 | |