1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author James Turner <james.turner@kdab.com> |
3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
4 | |
5 | #ifndef QPLATFORMMENU_H |
6 | #define |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is part of the QPA API and is not meant to be used |
12 | // in applications. Usage of this API may make your code |
13 | // source and binary incompatible with future versions of Qt. |
14 | // |
15 | |
16 | #include <QtCore/qobject.h> |
17 | #include <QtGui/qtguiglobal.h> |
18 | #include <QtCore/qpointer.h> |
19 | #include <QtGui/qfont.h> |
20 | #if QT_CONFIG(shortcut) |
21 | # include <QtGui/qkeysequence.h> |
22 | #endif |
23 | #include <QtGui/qicon.h> |
24 | |
25 | QT_BEGIN_NAMESPACE |
26 | |
27 | class QPlatformMenu; |
28 | class Q_GUI_EXPORT : public QObject |
29 | { |
30 | Q_OBJECT |
31 | public: |
32 | (); |
33 | |
34 | // copied from, and must stay in sync with, QAction menu roles. |
35 | enum { = 0, , , , |
36 | , , , |
37 | // However these roles are private, perhaps temporarily. |
38 | // They could be added as public QAction roles if necessary. |
39 | , , , , |
40 | }; |
41 | Q_ENUM(MenuRole) |
42 | |
43 | virtual void (quintptr tag); |
44 | virtual quintptr () const; |
45 | |
46 | virtual void (const QString &text) = 0; |
47 | virtual void (const QIcon &icon) = 0; |
48 | virtual void (QPlatformMenu *) = 0; |
49 | virtual void (bool isVisible) = 0; |
50 | virtual void (bool isSeparator) = 0; |
51 | virtual void (const QFont &font) = 0; |
52 | virtual void (MenuRole role) = 0; |
53 | virtual void (bool checkable) = 0; |
54 | virtual void (bool isChecked) = 0; |
55 | #if QT_CONFIG(shortcut) |
56 | virtual void (const QKeySequence& shortcut) = 0; |
57 | #endif |
58 | virtual void (bool enabled) = 0; |
59 | virtual void (int size) = 0; |
60 | virtual void (WId item) { Q_UNUSED(item); } |
61 | virtual void (bool hasExclusiveGroup) { Q_UNUSED(hasExclusiveGroup); } |
62 | |
63 | Q_SIGNALS: |
64 | void (); |
65 | void (); |
66 | |
67 | private: |
68 | quintptr ; |
69 | }; |
70 | |
71 | class Q_GUI_EXPORT : public QObject |
72 | { |
73 | Q_OBJECT |
74 | public: |
75 | (); |
76 | |
77 | enum { = 0, }; |
78 | Q_ENUM(MenuType) |
79 | |
80 | virtual void (QPlatformMenuItem *, QPlatformMenuItem *before) = 0; |
81 | virtual void (QPlatformMenuItem *) = 0; |
82 | virtual void (QPlatformMenuItem *) = 0; |
83 | virtual void (bool enable) = 0; |
84 | |
85 | virtual void (quintptr tag); |
86 | virtual quintptr () const; |
87 | |
88 | virtual void (const QString &text) = 0; |
89 | virtual void (const QIcon &icon) = 0; |
90 | virtual void (bool enabled) = 0; |
91 | virtual bool () const { return true; } |
92 | virtual void (bool visible) = 0; |
93 | virtual void (int width) { Q_UNUSED(width); } |
94 | virtual void (const QFont &font) { Q_UNUSED(font); } |
95 | virtual void (MenuType type) { Q_UNUSED(type); } |
96 | |
97 | virtual void (const QWindow *parentWindow, const QRect &targetRect, const QPlatformMenuItem *item) |
98 | { |
99 | Q_UNUSED(parentWindow); |
100 | Q_UNUSED(targetRect); |
101 | Q_UNUSED(item); |
102 | setVisible(true); |
103 | } |
104 | |
105 | virtual void () { } // Closes this and all its related menu popups |
106 | |
107 | virtual QPlatformMenuItem *(int position) const = 0; |
108 | virtual QPlatformMenuItem *(quintptr tag) const = 0; |
109 | |
110 | virtual QPlatformMenuItem *() const; |
111 | virtual QPlatformMenu *() const; |
112 | Q_SIGNALS: |
113 | void (); |
114 | void (); |
115 | |
116 | private: |
117 | quintptr ; |
118 | }; |
119 | |
120 | class Q_GUI_EXPORT : public QObject |
121 | { |
122 | Q_OBJECT |
123 | public: |
124 | virtual void (QPlatformMenu *, QPlatformMenu *before) = 0; |
125 | virtual void (QPlatformMenu *) = 0; |
126 | virtual void (QPlatformMenu *) = 0; |
127 | virtual void handleReparent(QWindow *newParentWindow) = 0; |
128 | virtual QWindow *() const { return nullptr; } |
129 | |
130 | virtual QPlatformMenu *(quintptr tag) const = 0; |
131 | virtual QPlatformMenu *() const; |
132 | }; |
133 | |
134 | QT_END_NAMESPACE |
135 | |
136 | #endif |
137 | |
138 | |