summaryrefslogtreecommitdiff
path: root/src/window-lib/inprocesswindow.h
blob: bac5ead0716fd4322119a28cfe632a19b384d912 (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
48
49
50
51
52
53
54
55
// Copyright (C) 2021 The Qt Company Ltd.
// Copyright (C) 2019 Luxoft Sweden AB
// Copyright (C) 2018 Pelagicore AG
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#pragma once

#include <QObject>
#include <QSharedPointer>
#include <QScopedPointer>

#include <QtAppManWindow/window.h>
#include <QtAppManManager/inprocesssurfaceitem.h>

QT_BEGIN_NAMESPACE_AM

class InProcessWindow : public Window
{
    Q_OBJECT

public:
    InProcessWindow(Application *app, const QSharedPointer<InProcessSurfaceItem> &surfaceItem);
    virtual ~InProcessWindow();

    bool isInProcess() const override { return true; }

    bool isPopup() const override;
    QPoint requestedPopupPosition() const override;

    bool setWindowProperty(const QString &name, const QVariant &value) override;
    QVariant windowProperty(const QString &name) const override;
    QVariantMap windowProperties() const override;

    ContentState contentState() const override { return m_contentState; }
    QSize size() const override;
    void resize(const QSize &size) override;

    void close() override;

    InProcessSurfaceItem *rootItem() const { return m_surfaceItem.data(); }
    QSharedPointer<InProcessSurfaceItem> surfaceItem() { return m_surfaceItem; }

    // The content state is wholly emulated as there's no actual surface behind this window
    // So we let it be set at will (likely by WindowManager)
    void setContentState(ContentState);

private slots:
    void onVisibleClientSideChanged();

private:
    ContentState m_contentState = SurfaceWithContent;
    QSharedPointer<InProcessSurfaceItem> m_surfaceItem;
};

QT_END_NAMESPACE_AM