| 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 QOFFSCREENWINDOW_H |
| 5 | #define QOFFSCREENWINDOW_H |
| 6 | |
| 7 | #include <qpa/qplatformbackingstore.h> |
| 8 | #include <qpa/qplatformwindow.h> |
| 9 | |
| 10 | #include <qhash.h> |
| 11 | |
| 12 | QT_BEGIN_NAMESPACE |
| 13 | |
| 14 | class QOffscreenWindow : public QPlatformWindow |
| 15 | { |
| 16 | public: |
| 17 | QOffscreenWindow(QWindow *window, bool frameMarginsEnabled); |
| 18 | ~QOffscreenWindow(); |
| 19 | |
| 20 | void setGeometry(const QRect &rect) override; |
| 21 | void setWindowState(Qt::WindowStates states) override; |
| 22 | |
| 23 | QMargins frameMargins() const override; |
| 24 | |
| 25 | void setVisible(bool visible) override; |
| 26 | void requestActivateWindow() override; |
| 27 | |
| 28 | WId winId() const override; |
| 29 | |
| 30 | static QOffscreenWindow *windowForWinId(WId id); |
| 31 | |
| 32 | private: |
| 33 | void setFrameMarginsEnabled(bool enabled); |
| 34 | void setGeometryImpl(const QRect &rect); |
| 35 | |
| 36 | QRect m_normalGeometry; |
| 37 | QMargins m_margins; |
| 38 | bool m_positionIncludesFrame; |
| 39 | bool m_visible; |
| 40 | bool m_pendingGeometryChangeOnShow; |
| 41 | bool m_frameMarginsRequested; |
| 42 | WId m_winId; |
| 43 | |
| 44 | Q_CONSTINIT static QHash<WId, QOffscreenWindow *> m_windowForWinIdHash; |
| 45 | }; |
| 46 | |
| 47 | QT_END_NAMESPACE |
| 48 | |
| 49 | #endif |
| 50 | |