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
13QT_BEGIN_NAMESPACE
14
15class QPlatformMenu;
16class QPlatformScreen;
17class QIcon;
18class QString;
19class QRect;
20
21class Q_GUI_EXPORT QPlatformSystemTrayIcon : public QObject
22{
23 Q_OBJECT
24 Q_MOC_INCLUDE(<qpa/qplatformscreen.h>)
25public:
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 updateMenu(QPlatformMenu *menu) = 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 *createMenu() const;
54
55Q_SIGNALS:
56 void activated(QPlatformSystemTrayIcon::ActivationReason reason);
57 void contextMenuRequested(QPoint globalPos, const QPlatformScreen *screen);
58 void messageClicked();
59};
60
61QT_END_NAMESPACE
62
63#endif // QT_NO_SYSTEMTRAYICON
64
65#endif // QSYSTEMTRAYICON_P_H
66

source code of qtbase/src/gui/kernel/qplatformsystemtrayicon.h