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 | #if QT_CONFIG(shortcut) |
56 | # include <QtGui/QKeySequence> |
57 | #endif |
58 | #include <QtGui/QIcon> |
59 | |
60 | QT_BEGIN_NAMESPACE |
61 | |
62 | class QPlatformMenu; |
63 | class Q_GUI_EXPORT : public QObject |
64 | { |
65 | Q_OBJECT |
66 | public: |
67 | (); |
68 | |
69 | // copied from, and must stay in sync with, QAction menu roles. |
70 | enum { = 0, , , , |
71 | , , , |
72 | // However these roles are private, perhaps temporarily. |
73 | // They could be added as public QAction roles if necessary. |
74 | , , , , |
75 | }; |
76 | Q_ENUM(MenuRole) |
77 | |
78 | virtual void (quintptr tag); |
79 | virtual quintptr () const; |
80 | |
81 | virtual void (const QString &text) = 0; |
82 | virtual void (const QIcon &icon) = 0; |
83 | virtual void (QPlatformMenu *) = 0; |
84 | virtual void (bool isVisible) = 0; |
85 | virtual void (bool isSeparator) = 0; |
86 | virtual void (const QFont &font) = 0; |
87 | virtual void (MenuRole role) = 0; |
88 | virtual void (bool checkable) = 0; |
89 | virtual void (bool isChecked) = 0; |
90 | #if QT_CONFIG(shortcut) |
91 | virtual void (const QKeySequence& shortcut) = 0; |
92 | #endif |
93 | virtual void (bool enabled) = 0; |
94 | virtual void (int size) = 0; |
95 | virtual void (WId item) { Q_UNUSED(item); } |
96 | virtual void (bool hasExclusiveGroup) { Q_UNUSED(hasExclusiveGroup); } |
97 | |
98 | Q_SIGNALS: |
99 | void (); |
100 | void (); |
101 | |
102 | private: |
103 | quintptr ; |
104 | }; |
105 | |
106 | class Q_GUI_EXPORT : public QObject |
107 | { |
108 | Q_OBJECT |
109 | public: |
110 | (); |
111 | |
112 | enum { = 0, }; |
113 | Q_ENUM(MenuType) |
114 | |
115 | virtual void (QPlatformMenuItem *, QPlatformMenuItem *before) = 0; |
116 | virtual void (QPlatformMenuItem *) = 0; |
117 | virtual void (QPlatformMenuItem *) = 0; |
118 | virtual void (bool enable) = 0; |
119 | |
120 | virtual void (quintptr tag); |
121 | virtual quintptr () const; |
122 | |
123 | virtual void (const QString &text) = 0; |
124 | virtual void (const QIcon &icon) = 0; |
125 | virtual void (bool enabled) = 0; |
126 | virtual bool () const { return true; } |
127 | virtual void (bool visible) = 0; |
128 | virtual void (int width) { Q_UNUSED(width); } |
129 | virtual void (const QFont &font) { Q_UNUSED(font); } |
130 | virtual void (MenuType type) { Q_UNUSED(type); } |
131 | |
132 | virtual void (const QWindow *parentWindow, const QRect &targetRect, const QPlatformMenuItem *item) |
133 | { |
134 | Q_UNUSED(parentWindow); |
135 | Q_UNUSED(targetRect); |
136 | Q_UNUSED(item); |
137 | setVisible(true); |
138 | } |
139 | |
140 | virtual void () { } // Closes this and all its related menu popups |
141 | |
142 | virtual QPlatformMenuItem *(int position) const = 0; |
143 | virtual QPlatformMenuItem *(quintptr tag) const = 0; |
144 | |
145 | virtual QPlatformMenuItem *() const; |
146 | virtual QPlatformMenu *() const; |
147 | Q_SIGNALS: |
148 | void (); |
149 | void (); |
150 | |
151 | private: |
152 | quintptr ; |
153 | }; |
154 | |
155 | class Q_GUI_EXPORT : public QObject |
156 | { |
157 | Q_OBJECT |
158 | public: |
159 | virtual void (QPlatformMenu *, QPlatformMenu *before) = 0; |
160 | virtual void (QPlatformMenu *) = 0; |
161 | virtual void (QPlatformMenu *) = 0; |
162 | virtual void handleReparent(QWindow *newParentWindow) = 0; |
163 | virtual QWindow *() const { return nullptr; } |
164 | |
165 | virtual QPlatformMenu *(quintptr tag) const = 0; |
166 | virtual QPlatformMenu *() const; |
167 | }; |
168 | |
169 | QT_END_NAMESPACE |
170 | |
171 | #endif |
172 | |
173 | |