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