summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/qandroidplatformforeignwindow.h
blob: 503524ccedf3e1008f472435c73141bf5c372ee5 (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
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef QANDROIDPLATFORMFOREIGNWINDOW_H
#define QANDROIDPLATFORMFOREIGNWINDOW_H

#include "qandroidplatformwindow.h"

#include <QtCore/QJniObject>

QT_BEGIN_NAMESPACE

Q_DECLARE_JNI_CLASS(View, "android/view/View")

class QAndroidPlatformForeignWindow : public QAndroidPlatformWindow
{
public:
    explicit QAndroidPlatformForeignWindow(QWindow *window, WId nativeHandle);
    ~QAndroidPlatformForeignWindow();
    void setGeometry(const QRect &rect) override;
    void setVisible(bool visible) override;
    void applicationStateChanged(Qt::ApplicationState state) override;
    bool isForeignWindow() const override { return true; }

    WId winId() const override;

private:
    void addViewToWindow();

    QtJniTypes::View m_view;
    bool m_nativeViewInserted;
};

QT_END_NAMESPACE

#endif // QANDROIDPLATFORMFOREIGNWINDOW_H