| 1 | // Copyright (C) 2023 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 QQUICKWINDOWCONTAINER_P_H |
| 5 | #define QQUICKWINDOWCONTAINER_P_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 <QtQuick/private/qtquickglobal_p.h> |
| 19 | |
| 20 | #include <QtCore/private/qobject_p.h> |
| 21 | |
| 22 | #include <QtQuick/private/qquickimplicitsizeitem_p.h> |
| 23 | #include <QtQuick/qquickwindow.h> |
| 24 | |
| 25 | QT_BEGIN_NAMESPACE |
| 26 | |
| 27 | class QQuickWindowContainerPrivate; |
| 28 | class Q_QUICK_EXPORT QQuickWindowContainer : public QQuickImplicitSizeItem |
| 29 | { |
| 30 | Q_OBJECT |
| 31 | QML_NAMED_ELEMENT(WindowContainer) |
| 32 | Q_PROPERTY(QWindow *window READ containedWindow WRITE setContainedWindow |
| 33 | NOTIFY containedWindowChanged DESIGNABLE false FINAL) |
| 34 | |
| 35 | QML_ADDED_IN_VERSION(6, 7) |
| 36 | |
| 37 | public: |
| 38 | enum ContainerMode { |
| 39 | WindowControlsItem, |
| 40 | ItemControlsWindow |
| 41 | }; |
| 42 | |
| 43 | explicit QQuickWindowContainer(QQuickItem *parent = nullptr, |
| 44 | ContainerMode containerMode = ItemControlsWindow); |
| 45 | ~QQuickWindowContainer(); |
| 46 | |
| 47 | QWindow *containedWindow() const; |
| 48 | void setContainedWindow(QWindow *window); |
| 49 | Q_SIGNAL void containedWindowChanged(QWindow *window); |
| 50 | |
| 51 | protected: |
| 52 | void classBegin() override; |
| 53 | void componentComplete() override; |
| 54 | |
| 55 | void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override; |
| 56 | void itemChange(QQuickItem::ItemChange, const QQuickItem::ItemChangeData &) override; |
| 57 | |
| 58 | void updatePolish() override; |
| 59 | |
| 60 | bool eventFilter(QObject *object, QEvent *event) override; |
| 61 | |
| 62 | QRectF clipRect() const override; |
| 63 | |
| 64 | void releaseResources() override; |
| 65 | |
| 66 | private: |
| 67 | Q_DECLARE_PRIVATE(QQuickWindowContainer) |
| 68 | friend class QQuickWindowQmlImpl; |
| 69 | |
| 70 | void initializeContainedWindow(); |
| 71 | void windowUpdated(); |
| 72 | void syncWindowToItem(); |
| 73 | void parentWindowChanged(QQuickWindow *window); |
| 74 | void windowDestroyed(); |
| 75 | }; |
| 76 | |
| 77 | QT_END_NAMESPACE |
| 78 | |
| 79 | #endif // QQUICKWINDOWCONTAINER_P_H |
| 80 |
