1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the QtGui module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | #ifndef QPLATFORMINTEGRATION_H |
41 | #define QPLATFORMINTEGRATION_H |
42 | |
43 | // |
44 | // W A R N I N G |
45 | // ------------- |
46 | // |
47 | // This file is part of the QPA API and is not meant to be used |
48 | // in applications. Usage of this API may make your code |
49 | // source and binary incompatible with future versions of Qt. |
50 | // |
51 | |
52 | #include <QtGui/qtguiglobal.h> |
53 | #include <QtGui/qwindowdefs.h> |
54 | #include <qpa/qplatformscreen.h> |
55 | #include <QtGui/qsurfaceformat.h> |
56 | #include <QtGui/qopenglcontext.h> |
57 | |
58 | QT_BEGIN_NAMESPACE |
59 | |
60 | |
61 | class QPlatformWindow; |
62 | class QWindow; |
63 | class QPlatformBackingStore; |
64 | class QPlatformFontDatabase; |
65 | class QPlatformClipboard; |
66 | class QPlatformNativeInterface; |
67 | class QPlatformDrag; |
68 | class QPlatformOpenGLContext; |
69 | class QGuiGLFormat; |
70 | class QAbstractEventDispatcher; |
71 | class QPlatformInputContext; |
72 | class QPlatformAccessibility; |
73 | class QPlatformTheme; |
74 | class QPlatformDialogHelper; |
75 | class QPlatformSharedGraphicsCache; |
76 | class QPlatformServices; |
77 | class QPlatformSessionManager; |
78 | class QKeyEvent; |
79 | class QPlatformOffscreenSurface; |
80 | class QOffscreenSurface; |
81 | class QPlatformVulkanInstance; |
82 | class QVulkanInstance; |
83 | |
84 | class Q_GUI_EXPORT QPlatformIntegration |
85 | { |
86 | public: |
87 | Q_DISABLE_COPY_MOVE(QPlatformIntegration) |
88 | |
89 | enum Capability { |
90 | ThreadedPixmaps = 1, |
91 | OpenGL, |
92 | ThreadedOpenGL, |
93 | SharedGraphicsCache, |
94 | BufferQueueingOpenGL, |
95 | WindowMasks, |
96 | MultipleWindows, |
97 | ApplicationState, |
98 | ForeignWindows, |
99 | NonFullScreenWindows, |
100 | NativeWidgets, |
101 | WindowManagement, |
102 | WindowActivation, // whether requestActivate is supported |
103 | SyncState, |
104 | RasterGLSurface, |
105 | AllGLFunctionsQueryable, |
106 | ApplicationIcon, |
107 | SwitchableWidgetComposition, |
108 | TopStackedNativeChildWindows, |
109 | OpenGLOnRasterSurface, |
110 | MaximizeUsingFullscreenGeometry |
111 | }; |
112 | |
113 | virtual ~QPlatformIntegration() { } |
114 | |
115 | virtual bool hasCapability(Capability cap) const; |
116 | |
117 | virtual QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const; |
118 | virtual QPlatformWindow *createPlatformWindow(QWindow *window) const = 0; |
119 | virtual QPlatformWindow *createForeignWindow(QWindow *, WId) const { return nullptr; } |
120 | virtual QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const = 0; |
121 | #ifndef QT_NO_OPENGL |
122 | virtual QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const; |
123 | #endif |
124 | virtual QPlatformSharedGraphicsCache *createPlatformSharedGraphicsCache(const char *cacheId) const; |
125 | virtual QPaintEngine *createImagePaintEngine(QPaintDevice *paintDevice) const; |
126 | |
127 | // Event dispatcher: |
128 | virtual QAbstractEventDispatcher *createEventDispatcher() const = 0; |
129 | virtual void initialize(); |
130 | virtual void destroy(); |
131 | |
132 | //Deeper window system integrations |
133 | virtual QPlatformFontDatabase *fontDatabase() const; |
134 | #ifndef QT_NO_CLIPBOARD |
135 | virtual QPlatformClipboard *clipboard() const; |
136 | #endif |
137 | #if QT_CONFIG(draganddrop) |
138 | virtual QPlatformDrag *drag() const; |
139 | #endif |
140 | virtual QPlatformInputContext *inputContext() const; |
141 | #ifndef QT_NO_ACCESSIBILITY |
142 | virtual QPlatformAccessibility *accessibility() const; |
143 | #endif |
144 | |
145 | // Access native handles. The window handle is already available from Wid; |
146 | virtual QPlatformNativeInterface *nativeInterface() const; |
147 | |
148 | virtual QPlatformServices *services() const; |
149 | |
150 | enum StyleHint { |
151 | CursorFlashTime, |
152 | KeyboardInputInterval, |
153 | MouseDoubleClickInterval, |
154 | StartDragDistance, |
155 | StartDragTime, |
156 | KeyboardAutoRepeatRate, |
157 | ShowIsFullScreen, |
158 | PasswordMaskDelay, |
159 | FontSmoothingGamma, |
160 | StartDragVelocity, |
161 | UseRtlExtensions, |
162 | PasswordMaskCharacter, |
163 | SetFocusOnTouchRelease, |
164 | ShowIsMaximized, |
165 | MousePressAndHoldInterval, |
166 | TabFocusBehavior, |
167 | , |
168 | ItemViewActivateItemOnSingleClick, |
169 | UiEffects, |
170 | WheelScrollLines, |
171 | , |
172 | MouseQuickSelectionThreshold |
173 | }; |
174 | |
175 | virtual QVariant styleHint(StyleHint hint) const; |
176 | virtual Qt::WindowState defaultWindowState(Qt::WindowFlags) const; |
177 | |
178 | virtual Qt::KeyboardModifiers queryKeyboardModifiers() const; |
179 | virtual QList<int> possibleKeys(const QKeyEvent *) const; |
180 | |
181 | virtual QStringList themeNames() const; |
182 | virtual QPlatformTheme *createPlatformTheme(const QString &name) const; |
183 | |
184 | virtual QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const; |
185 | |
186 | #ifndef QT_NO_SESSIONMANAGER |
187 | virtual QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const; |
188 | #endif |
189 | |
190 | virtual void sync(); |
191 | |
192 | #ifndef QT_NO_OPENGL |
193 | virtual QOpenGLContext::OpenGLModuleType openGLModuleType(); |
194 | #endif |
195 | virtual void setApplicationIcon(const QIcon &icon) const; |
196 | |
197 | virtual void beep() const; |
198 | |
199 | #if QT_CONFIG(vulkan) || defined(Q_CLANG_QDOC) |
200 | virtual QPlatformVulkanInstance *createPlatformVulkanInstance(QVulkanInstance *instance) const; |
201 | #endif |
202 | |
203 | protected: |
204 | QPlatformIntegration() = default; |
205 | }; |
206 | |
207 | QT_END_NAMESPACE |
208 | |
209 | #endif // QPLATFORMINTEGRATION_H |
210 | |