Warning: That file was not part of the compilation database. It may have many parsing errors.
1 | /**************************************************************************** |
---|---|
2 | ** |
3 | ** Copyright (C) 2017 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the QtWaylandCompositor module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:GPL$ |
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 General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU |
19 | ** General Public License version 3 or (at your option) any later version |
20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by |
21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 |
22 | ** included in the packaging of this file. Please review the following |
23 | ** information to ensure the GNU General Public License requirements will |
24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
25 | ** |
26 | ** $QT_END_LICENSE$ |
27 | ** |
28 | ****************************************************************************/ |
29 | |
30 | #ifndef QWAYLANDEXTENSION_H |
31 | #define QWAYLANDEXTENSION_H |
32 | |
33 | #include <QtWaylandCompositor/qtwaylandcompositorglobal.h> |
34 | |
35 | #include <QtCore/QObject> |
36 | #include <QtCore/QVector> |
37 | |
38 | struct wl_interface; |
39 | |
40 | QT_BEGIN_NAMESPACE |
41 | |
42 | class QWaylandCompositor; |
43 | class QWaylandCompositorExtension; |
44 | class QWaylandCompositorExtensionPrivate; |
45 | |
46 | class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandObject : public QObject |
47 | { |
48 | Q_OBJECT |
49 | public: |
50 | ~QWaylandObject() override; |
51 | |
52 | QWaylandCompositorExtension *extension(const QByteArray &name); |
53 | QWaylandCompositorExtension *extension(const wl_interface *interface); |
54 | QList<QWaylandCompositorExtension *> extensions() const; |
55 | void addExtension(QWaylandCompositorExtension *extension); |
56 | void removeExtension(QWaylandCompositorExtension *extension); |
57 | |
58 | protected: |
59 | QWaylandObject(QObject *parent = nullptr); |
60 | QWaylandObject(QObjectPrivate &d, QObject *parent = nullptr); |
61 | QList<QWaylandCompositorExtension *> extension_vector; |
62 | }; |
63 | |
64 | class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandCompositorExtension : public QWaylandObject |
65 | { |
66 | Q_OBJECT |
67 | Q_DECLARE_PRIVATE(QWaylandCompositorExtension) |
68 | public: |
69 | QWaylandCompositorExtension(); |
70 | QWaylandCompositorExtension(QWaylandObject *container); |
71 | ~QWaylandCompositorExtension() override; |
72 | |
73 | QWaylandObject *extensionContainer() const; |
74 | void setExtensionContainer(QWaylandObject *container); |
75 | |
76 | virtual void initialize(); |
77 | bool isInitialized() const; |
78 | |
79 | virtual const struct wl_interface *extensionInterface() const = 0; |
80 | |
81 | protected: |
82 | QWaylandCompositorExtension(QWaylandCompositorExtensionPrivate &dd); |
83 | QWaylandCompositorExtension(QWaylandObject *container, QWaylandCompositorExtensionPrivate &dd); |
84 | |
85 | bool event(QEvent *event) override; |
86 | }; |
87 | |
88 | template <typename T> |
89 | class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandCompositorExtensionTemplate : public QWaylandCompositorExtension |
90 | { |
91 | public: |
92 | QWaylandCompositorExtensionTemplate() |
93 | : QWaylandCompositorExtension() |
94 | { } |
95 | |
96 | QWaylandCompositorExtensionTemplate(QWaylandObject *container) |
97 | : QWaylandCompositorExtension(container) |
98 | { } |
99 | |
100 | const struct wl_interface *extensionInterface() const override |
101 | { |
102 | return T::interface(); |
103 | } |
104 | |
105 | static T *findIn(QWaylandObject *container) |
106 | { |
107 | if (!container) return nullptr; |
108 | return qobject_cast<T *>(container->extension(T::interfaceName())); |
109 | } |
110 | |
111 | protected: |
112 | QWaylandCompositorExtensionTemplate(QWaylandCompositorExtensionPrivate &dd) |
113 | : QWaylandCompositorExtension(dd) |
114 | { } |
115 | |
116 | QWaylandCompositorExtensionTemplate(QWaylandObject *container, QWaylandCompositorExtensionPrivate &dd) |
117 | : QWaylandCompositorExtension(container,dd) |
118 | { } |
119 | }; |
120 | |
121 | QT_END_NAMESPACE |
122 | |
123 | #endif |
124 |
Warning: That file was not part of the compilation database. It may have many parsing errors.