1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // Copyright (C) 2012 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Christoph Schleifenbaum <christoph.schleifenbaum@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 QPLATFORMSYSTEMTRAYICON_H |
6 | #define QPLATFORMSYSTEMTRAYICON_H |
7 | |
8 | #include <QtGui/qtguiglobal.h> |
9 | #include "QtCore/qobject.h" |
10 | |
11 | #ifndef QT_NO_SYSTEMTRAYICON |
12 | |
13 | QT_BEGIN_NAMESPACE |
14 | |
15 | class ; |
16 | class QPlatformScreen; |
17 | class QIcon; |
18 | class QString; |
19 | class QRect; |
20 | |
21 | class Q_GUI_EXPORT QPlatformSystemTrayIcon : public QObject |
22 | { |
23 | Q_OBJECT |
24 | Q_MOC_INCLUDE(<qpa/qplatformscreen.h>) |
25 | public: |
26 | enum ActivationReason { |
27 | Unknown, |
28 | Context, |
29 | DoubleClick, |
30 | Trigger, |
31 | MiddleClick |
32 | }; |
33 | Q_ENUM(ActivationReason) |
34 | |
35 | enum MessageIcon { NoIcon, Information, Warning, Critical }; |
36 | Q_ENUM(MessageIcon) |
37 | |
38 | QPlatformSystemTrayIcon(); |
39 | ~QPlatformSystemTrayIcon(); |
40 | |
41 | virtual void init() = 0; |
42 | virtual void cleanup() = 0; |
43 | virtual void updateIcon(const QIcon &icon) = 0; |
44 | virtual void updateToolTip(const QString &tooltip) = 0; |
45 | virtual void (QPlatformMenu *) = 0; |
46 | virtual QRect geometry() const = 0; |
47 | virtual void showMessage(const QString &title, const QString &msg, |
48 | const QIcon &icon, MessageIcon iconType, int msecs) = 0; |
49 | |
50 | virtual bool isSystemTrayAvailable() const = 0; |
51 | virtual bool supportsMessages() const = 0; |
52 | |
53 | virtual QPlatformMenu *() const; |
54 | |
55 | Q_SIGNALS: |
56 | void activated(QPlatformSystemTrayIcon::ActivationReason reason); |
57 | void (QPoint globalPos, const QPlatformScreen *screen); |
58 | void messageClicked(); |
59 | }; |
60 | |
61 | QT_END_NAMESPACE |
62 | |
63 | #endif // QT_NO_SYSTEMTRAYICON |
64 | |
65 | #endif // QSYSTEMTRAYICON_P_H |
66 | |