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