1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author James Turner <james.turner@kdab.com> |
5 | ** Contact: https://www.qt.io/licensing/ |
6 | ** |
7 | ** This file is part of the QtGui module of the Qt Toolkit. |
8 | ** |
9 | ** $QT_BEGIN_LICENSE:LGPL$ |
10 | ** Commercial License Usage |
11 | ** Licensees holding valid commercial Qt licenses may use this file in |
12 | ** accordance with the commercial license agreement provided with the |
13 | ** Software or, alternatively, in accordance with the terms contained in |
14 | ** a written agreement between you and The Qt Company. For licensing terms |
15 | ** and conditions see https://www.qt.io/terms-conditions. For further |
16 | ** information use the contact form at https://www.qt.io/contact-us. |
17 | ** |
18 | ** GNU Lesser General Public License Usage |
19 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
20 | ** General Public License version 3 as published by the Free Software |
21 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
22 | ** packaging of this file. Please review the following information to |
23 | ** ensure the GNU Lesser General Public License version 3 requirements |
24 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
25 | ** |
26 | ** GNU General Public License Usage |
27 | ** Alternatively, this file may be used under the terms of the GNU |
28 | ** General Public License version 2.0 or (at your option) the GNU General |
29 | ** Public license version 3 or any later version approved by the KDE Free |
30 | ** Qt Foundation. The licenses are as published by the Free Software |
31 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
32 | ** included in the packaging of this file. Please review the following |
33 | ** information to ensure the GNU General Public License requirements will |
34 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
35 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
36 | ** |
37 | ** $QT_END_LICENSE$ |
38 | ** |
39 | ****************************************************************************/ |
40 | |
41 | #ifndef QPLATFORMMENU_H |
42 | #define |
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 <QtCore/qpointer.h> |
54 | #include <QtGui/QFont> |
55 | #include <QtGui/QKeySequence> |
56 | #include <QtGui/QIcon> |
57 | |
58 | QT_BEGIN_NAMESPACE |
59 | |
60 | class QPlatformMenu; |
61 | class Q_GUI_EXPORT : public QObject |
62 | { |
63 | Q_OBJECT |
64 | public: |
65 | (); |
66 | |
67 | // copied from, and must stay in sync with, QAction menu roles. |
68 | enum { = 0, , , , |
69 | , , , |
70 | // However these roles are private, perhaps temporarily. |
71 | // They could be added as public QAction roles if necessary. |
72 | , , , , |
73 | }; |
74 | Q_ENUM(MenuRole) |
75 | |
76 | virtual void (quintptr tag); |
77 | virtual quintptr () const; |
78 | |
79 | virtual void (const QString &text) = 0; |
80 | virtual void (const QIcon &icon) = 0; |
81 | virtual void (QPlatformMenu *) = 0; |
82 | virtual void (bool isVisible) = 0; |
83 | virtual void (bool isSeparator) = 0; |
84 | virtual void (const QFont &font) = 0; |
85 | virtual void (MenuRole role) = 0; |
86 | virtual void (bool checkable) = 0; |
87 | virtual void (bool isChecked) = 0; |
88 | #ifndef QT_NO_SHORTCUT |
89 | virtual void (const QKeySequence& shortcut) = 0; |
90 | #endif |
91 | virtual void (bool enabled) = 0; |
92 | virtual void (int size) = 0; |
93 | virtual void (WId item) { Q_UNUSED(item); } |
94 | virtual void (bool hasExclusiveGroup) { Q_UNUSED(hasExclusiveGroup); } |
95 | |
96 | Q_SIGNALS: |
97 | void (); |
98 | void (); |
99 | |
100 | private: |
101 | quintptr ; |
102 | }; |
103 | |
104 | class Q_GUI_EXPORT : public QObject |
105 | { |
106 | Q_OBJECT |
107 | public: |
108 | (); |
109 | |
110 | enum { = 0, }; |
111 | Q_ENUM(MenuType) |
112 | |
113 | virtual void (QPlatformMenuItem *, QPlatformMenuItem *before) = 0; |
114 | virtual void (QPlatformMenuItem *) = 0; |
115 | virtual void (QPlatformMenuItem *) = 0; |
116 | virtual void (bool enable) = 0; |
117 | |
118 | virtual void (quintptr tag); |
119 | virtual quintptr () const; |
120 | |
121 | virtual void (const QString &text) = 0; |
122 | virtual void (const QIcon &icon) = 0; |
123 | virtual void (bool enabled) = 0; |
124 | virtual bool () const { return true; } |
125 | virtual void (bool visible) = 0; |
126 | virtual void (int width) { Q_UNUSED(width); } |
127 | virtual void (const QFont &font) { Q_UNUSED(font); } |
128 | virtual void (MenuType type) { Q_UNUSED(type); } |
129 | |
130 | virtual void (const QWindow *parentWindow, const QRect &targetRect, const QPlatformMenuItem *item) |
131 | { |
132 | Q_UNUSED(parentWindow); |
133 | Q_UNUSED(targetRect); |
134 | Q_UNUSED(item); |
135 | setVisible(true); |
136 | } |
137 | |
138 | virtual void () { } // Closes this and all its related menu popups |
139 | |
140 | virtual QPlatformMenuItem *(int position) const = 0; |
141 | virtual QPlatformMenuItem *(quintptr tag) const = 0; |
142 | |
143 | virtual QPlatformMenuItem *() const; |
144 | virtual QPlatformMenu *() const; |
145 | Q_SIGNALS: |
146 | void (); |
147 | void (); |
148 | |
149 | private: |
150 | quintptr ; |
151 | }; |
152 | |
153 | class Q_GUI_EXPORT : public QObject |
154 | { |
155 | Q_OBJECT |
156 | public: |
157 | virtual void (QPlatformMenu *, QPlatformMenu *before) = 0; |
158 | virtual void (QPlatformMenu *) = 0; |
159 | virtual void (QPlatformMenu *) = 0; |
160 | virtual void handleReparent(QWindow *newParentWindow) = 0; |
161 | virtual QWindow *() const { return nullptr; } |
162 | |
163 | virtual QPlatformMenu *(quintptr tag) const = 0; |
164 | virtual QPlatformMenu *() const; |
165 | }; |
166 | |
167 | QT_END_NAMESPACE |
168 | |
169 | #endif |
170 | |
171 | |