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 QPLATFORMWINDOW_P_H
5#define QPLATFORMWINDOW_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 <QtGui/private/qtguiglobal_p.h>
19#include <QtCore/qbasictimer.h>
20#include <QtCore/qrect.h>
21#include <QtCore/qnativeinterface.h>
22
23#if defined(Q_OS_UNIX)
24#include <any>
25
26struct wl_surface;
27#endif
28
29QT_BEGIN_NAMESPACE
30
31class QMargins;
32
33class QPlatformWindowPrivate
34{
35public:
36 QRect rect;
37 QBasicTimer updateTimer;
38};
39
40// ----------------- QNativeInterface -----------------
41
42namespace QNativeInterface::Private {
43
44#if defined(Q_OS_WASM) || defined(Q_QDOC)
45struct Q_GUI_EXPORT QWasmWindow
46{
47 QT_DECLARE_NATIVE_INTERFACE(QWasmWindow, 1, QWindow)
48 virtual emscripten::val document() const = 0;
49 virtual emscripten::val clientArea() const = 0;
50};
51#endif
52
53#if defined(Q_OS_MACOS) || defined(Q_QDOC)
54struct Q_GUI_EXPORT QCocoaWindow
55{
56 QT_DECLARE_NATIVE_INTERFACE(QCocoaWindow, 1, QWindow)
57 virtual void setContentBorderEnabled(bool enable) = 0;
58 virtual QPoint bottomLeftClippedByNSWindowOffset() const = 0;
59};
60#endif
61
62#if QT_CONFIG(xcb) || defined(Q_QDOC)
63struct Q_GUI_EXPORT QXcbWindow
64{
65 QT_DECLARE_NATIVE_INTERFACE(QXcbWindow, 1, QWindow)
66
67 enum WindowType {
68 None = 0x000000,
69 Normal = 0x000001,
70 Desktop = 0x000002,
71 Dock = 0x000004,
72 Toolbar = 0x000008,
73 Menu = 0x000010,
74 Utility = 0x000020,
75 Splash = 0x000040,
76 Dialog = 0x000080,
77 DropDownMenu = 0x000100,
78 PopupMenu = 0x000200,
79 Tooltip = 0x000400,
80 Notification = 0x000800,
81 Combo = 0x001000,
82 Dnd = 0x002000,
83 KdeOverride = 0x004000
84 };
85 Q_DECLARE_FLAGS(WindowTypes, WindowType)
86
87 virtual void setWindowType(WindowTypes type) = 0;
88 virtual void setWindowRole(const QString &role) = 0;
89 virtual void setWindowIconText(const QString &text) = 0;
90 virtual uint visualId() const = 0;
91};
92#endif // xcb
93
94#if defined(Q_OS_WIN) || defined(Q_QDOC)
95struct Q_GUI_EXPORT QWindowsWindow
96{
97 QT_DECLARE_NATIVE_INTERFACE(QWindowsWindow, 1, QWindow)
98
99 virtual void setHasBorderInFullScreen(bool border) = 0;
100 virtual bool hasBorderInFullScreen() const = 0;
101
102 virtual QMargins customMargins() const = 0;
103 virtual void setCustomMargins(const QMargins &margins) = 0;
104};
105#endif // Q_OS_WIN
106
107#if defined(Q_OS_UNIX)
108struct Q_GUI_EXPORT QWaylandWindow : public QObject
109{
110 Q_OBJECT
111public:
112 QT_DECLARE_NATIVE_INTERFACE(QWaylandWindow, 1, QWindow)
113
114 virtual wl_surface *surface() const = 0;
115 virtual void setCustomMargins(const QMargins &margins) = 0;
116 virtual void requestXdgActivationToken(uint serial) = 0;
117 template<typename T>
118 T *surfaceRole() const
119 {
120 std::any anyRole = _surfaceRole();
121 auto role = std::any_cast<T *>(&anyRole);
122 return role ? *role : nullptr;
123 }
124Q_SIGNALS:
125 void surfaceCreated();
126 void surfaceDestroyed();
127 void xdgActivationTokenCreated(const QString &token);
128
129protected:
130 virtual std::any _surfaceRole() const = 0;
131};
132#endif
133
134} // QNativeInterface::Private
135
136QT_END_NAMESPACE
137
138#endif // QPLATFORMWINDOW_P_H
139

source code of qtbase/src/gui/kernel/qplatformwindow_p.h