/src/qtbase/src/gui/kernel/qwindow_p.h
Line | Count | Source |
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 | | // Qt-Security score:significant reason:default |
4 | | |
5 | | #ifndef QWINDOW_P_H |
6 | | #define QWINDOW_P_H |
7 | | |
8 | | // |
9 | | // W A R N I N G |
10 | | // ------------- |
11 | | // |
12 | | // This file is not part of the Qt API. It exists purely as an |
13 | | // implementation detail. This header file may change from version to |
14 | | // version without notice, or even be removed. |
15 | | // |
16 | | // We mean it. |
17 | | // |
18 | | |
19 | | #include <QtGui/private/qtguiglobal_p.h> |
20 | | #include <QtGui/qscreen.h> |
21 | | #include <QtGui/qwindow.h> |
22 | | #include <qpa/qplatformwindow.h> |
23 | | |
24 | | #include <QtCore/private/qobject_p.h> |
25 | | #include <QtCore/qelapsedtimer.h> |
26 | | #include <QtCore/qxpfunctional.h> |
27 | | #include <QtGui/qicon.h> |
28 | | #include <QtGui/qpalette.h> |
29 | | |
30 | | #include <QtCore/qpointer.h> |
31 | | |
32 | | QT_BEGIN_NAMESPACE |
33 | | |
34 | | class Q_GUI_EXPORT QWindowPrivate : public QObjectPrivate |
35 | | { |
36 | 0 | Q_DECLARE_PUBLIC(QWindow) Unexecuted instantiation: QWindowPrivate::q_func() Unexecuted instantiation: QWindowPrivate::q_func() const |
37 | 0 | Q_GADGET |
38 | 0 |
|
39 | 0 | public: |
40 | 0 | enum PositionPolicy |
41 | 0 | { |
42 | 0 | WindowFrameInclusive, |
43 | 0 | WindowFrameExclusive |
44 | 0 | }; |
45 | 0 | Q_ENUM(PositionPolicy) Unexecuted instantiation: qt_getEnumMetaObject(QWindowPrivate::PositionPolicy) Unexecuted instantiation: qt_getEnumName(QWindowPrivate::PositionPolicy) |
46 | 0 |
|
47 | 0 | QWindowPrivate(decltype(QObjectPrivateVersion) version = QObjectPrivateVersion); |
48 | 0 | ~QWindowPrivate() override; |
49 | 0 |
|
50 | 0 | void init(QWindow *parent, QScreen *targetScreen = nullptr); |
51 | 0 |
|
52 | 0 | #ifndef QT_NO_CURSOR |
53 | 0 | void setCursor(const QCursor *c = nullptr); |
54 | 0 | bool applyCursor(); |
55 | 0 | #endif |
56 | 0 |
|
57 | 0 | QPoint globalPosition() const; |
58 | 0 |
|
59 | 0 | QWindow *topLevelWindow(QWindow::AncestorMode mode = QWindow::IncludeTransients) const; |
60 | 0 |
|
61 | 0 | virtual QWindow *eventReceiver() { Q_Q(QWindow); return q; } |
62 | 0 | virtual QPalette windowPalette() const { return QPalette(); } |
63 | | |
64 | | virtual void setVisible(bool visible); |
65 | | void updateVisibility(); |
66 | | void _q_clearAlert(); |
67 | | |
68 | | enum SiblingPosition { PositionTop, PositionBottom }; |
69 | | void updateSiblingPosition(SiblingPosition); |
70 | | |
71 | | bool windowRecreationRequired(QScreen *newScreen) const; |
72 | | void create(bool recursive); |
73 | | void destroy(); |
74 | | void setTopLevelScreen(QScreen *newScreen, bool recreate); |
75 | | void connectToScreen(QScreen *topLevelScreen); |
76 | | void disconnectFromScreen(); |
77 | | void emitScreenChangedRecursion(QScreen *newScreen); |
78 | | QScreen *screenForGeometry(const QRect &rect) const; |
79 | | void setTransientParent(QWindow *parent); |
80 | | |
81 | | virtual void clearFocusObject(); |
82 | | |
83 | | enum class FocusTarget { |
84 | | First, |
85 | | Last, |
86 | | Current, |
87 | | Next, |
88 | | Prev |
89 | | }; |
90 | 0 | virtual void setFocusToTarget(FocusTarget, Qt::FocusReason) {} |
91 | | |
92 | | virtual QRectF closestAcceptableGeometry(const QRectF &rect) const; |
93 | | |
94 | | void setMinOrMaxSize(QSize *oldSizeMember, const QSize &size, |
95 | | qxp::function_ref<void()> funcWidthChanged, |
96 | | qxp::function_ref<void()> funcHeightChanged); |
97 | | |
98 | | virtual bool participatesInLastWindowClosed() const; |
99 | | virtual bool treatAsVisible() const; |
100 | | |
101 | | virtual void maybeSynthesizeContextMenuEvent(QMouseEvent *event); |
102 | | |
103 | | const QWindow *forwardToPopup(QEvent *event, const QWindow *activePopupOnPress); |
104 | | |
105 | 0 | bool isPopup() const { return (windowFlags & Qt::WindowType_Mask) == Qt::Popup; } |
106 | | void setAutomaticPositionAndResizeEnabled(bool a) |
107 | 0 | { positionAutomatic = resizeAutomatic = a; } |
108 | | |
109 | | bool updateDevicePixelRatio(); |
110 | | |
111 | 0 | static QWindowPrivate *get(QWindow *window) { return window->d_func(); } |
112 | | |
113 | | static Qt::WindowState effectiveState(Qt::WindowStates); |
114 | | |
115 | | QWindow::SurfaceType surfaceType = QWindow::RasterSurface; |
116 | | Qt::WindowFlags windowFlags = Qt::Window; |
117 | | QWindow *parentWindow = nullptr; |
118 | | QPlatformWindow *platformWindow = nullptr; |
119 | | bool visible= false; |
120 | | bool visibilityOnDestroy = false; |
121 | | bool exposed = false; |
122 | | bool inClose = false; |
123 | | QSurfaceFormat requestedFormat; |
124 | | QString windowTitle; |
125 | | QString windowFilePath; |
126 | | QIcon windowIcon; |
127 | | QRect geometry; |
128 | | qreal devicePixelRatio = 1.0; |
129 | | Qt::WindowStates windowState = Qt::WindowNoState; |
130 | | QWindow::Visibility visibility = QWindow::Hidden; |
131 | | bool resizeEventPending = true; |
132 | | bool receivedExpose = false; |
133 | | PositionPolicy positionPolicy = WindowFrameExclusive; |
134 | | bool positionAutomatic = true; |
135 | | // resizeAutomatic suppresses resizing by QPlatformWindow::initialGeometry(). |
136 | | // It also indicates that width/height=0 is acceptable (for example, for |
137 | | // the QRollEffect widget) and is thus not cleared in setGeometry(). |
138 | | // An alternative approach might be using -1,-1 as a default size. |
139 | | bool resizeAutomatic = true; |
140 | | Qt::ScreenOrientation contentOrientation = Qt::PrimaryOrientation; |
141 | | qreal opacity= 1; |
142 | | QRegion mask; |
143 | | |
144 | | QSize minimumSize = {0, 0}; |
145 | | QSize maximumSize = {QWINDOWSIZE_MAX, QWINDOWSIZE_MAX}; |
146 | | QSize baseSize; |
147 | | QSize sizeIncrement; |
148 | | |
149 | | Qt::WindowModality modality = Qt::NonModal; |
150 | | bool blockedByModalWindow = false; |
151 | | |
152 | | bool updateRequestPending = false; |
153 | | bool transientParentPropertySet = false; |
154 | | |
155 | | QPointer<QWindow> transientParent; |
156 | | QPointer<QScreen> topLevelScreen; |
157 | | |
158 | | #ifndef QT_NO_CURSOR |
159 | | QCursor cursor = {Qt::ArrowCursor}; |
160 | | bool hasCursor = false; |
161 | | #endif |
162 | | |
163 | | QElapsedTimer lastComposeTime; |
164 | | |
165 | | #if QT_CONFIG(vulkan) |
166 | | QVulkanInstance *vulkanInstance = nullptr; |
167 | | #endif |
168 | | }; |
169 | | |
170 | | |
171 | | QT_END_NAMESPACE |
172 | | |
173 | | #endif // QWINDOW_P_H |