1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** All rights reserved.
|
---|
5 | ** Contact: Nokia Corporation ([email protected])
|
---|
6 | **
|
---|
7 | ** This file is part of the QtGui module of the Qt Toolkit.
|
---|
8 | **
|
---|
9 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
10 | ** Commercial Usage
|
---|
11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
13 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
14 | ** a written agreement between you and Nokia.
|
---|
15 | **
|
---|
16 | ** GNU Lesser General Public License Usage
|
---|
17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
18 | ** General Public License version 2.1 as published by the Free Software
|
---|
19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
20 | ** packaging of this file. Please review the following information to
|
---|
21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
23 | **
|
---|
24 | ** In addition, as a special exception, Nokia gives you certain additional
|
---|
25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
---|
26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
---|
27 | **
|
---|
28 | ** GNU General Public License Usage
|
---|
29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
30 | ** General Public License version 3.0 as published by the Free Software
|
---|
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
32 | ** packaging of this file. Please review the following information to
|
---|
33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
35 | **
|
---|
36 | ** If you have questions regarding the use of this file, please contact
|
---|
37 | ** Nokia at [email protected].
|
---|
38 | ** $QT_END_LICENSE$
|
---|
39 | **
|
---|
40 | ****************************************************************************/
|
---|
41 |
|
---|
42 | #ifndef QSYSTEMTRAYICON_H
|
---|
43 | #define QSYSTEMTRAYICON_H
|
---|
44 |
|
---|
45 | #include <QtCore/qobject.h>
|
---|
46 |
|
---|
47 | #ifndef QT_NO_SYSTEMTRAYICON
|
---|
48 |
|
---|
49 | #include <QtGui/qicon.h>
|
---|
50 |
|
---|
51 | QT_BEGIN_HEADER
|
---|
52 |
|
---|
53 | QT_BEGIN_NAMESPACE
|
---|
54 |
|
---|
55 | QT_MODULE(Gui)
|
---|
56 |
|
---|
57 | class QSystemTrayIconPrivate;
|
---|
58 |
|
---|
59 | class QMenu;
|
---|
60 | class QEvent;
|
---|
61 | class QWheelEvent;
|
---|
62 | class QMouseEvent;
|
---|
63 | class QPoint;
|
---|
64 |
|
---|
65 | class Q_GUI_EXPORT QSystemTrayIcon : public QObject
|
---|
66 | {
|
---|
67 | Q_OBJECT
|
---|
68 | Q_PROPERTY(QString toolTip READ toolTip WRITE setToolTip)
|
---|
69 | Q_PROPERTY(QIcon icon READ icon WRITE setIcon)
|
---|
70 | Q_PROPERTY(bool visible READ isVisible WRITE setVisible DESIGNABLE false)
|
---|
71 |
|
---|
72 | public:
|
---|
73 | QSystemTrayIcon(QObject *parent = 0);
|
---|
74 | QSystemTrayIcon(const QIcon &icon, QObject *parent = 0);
|
---|
75 | ~QSystemTrayIcon();
|
---|
76 |
|
---|
77 | enum ActivationReason {
|
---|
78 | Unknown,
|
---|
79 | Context,
|
---|
80 | DoubleClick,
|
---|
81 | Trigger,
|
---|
82 | MiddleClick
|
---|
83 | };
|
---|
84 |
|
---|
85 | #ifndef QT_NO_MENU
|
---|
86 | void setContextMenu(QMenu *menu);
|
---|
87 | QMenu *contextMenu() const;
|
---|
88 | #endif
|
---|
89 |
|
---|
90 | QIcon icon() const;
|
---|
91 | void setIcon(const QIcon &icon);
|
---|
92 |
|
---|
93 | QString toolTip() const;
|
---|
94 | void setToolTip(const QString &tip);
|
---|
95 |
|
---|
96 | static bool isSystemTrayAvailable();
|
---|
97 | static bool supportsMessages();
|
---|
98 |
|
---|
99 | enum MessageIcon { NoIcon, Information, Warning, Critical };
|
---|
100 | void showMessage(const QString &title, const QString &msg,
|
---|
101 | MessageIcon icon = Information, int msecs = 10000);
|
---|
102 |
|
---|
103 | QRect geometry() const;
|
---|
104 | bool isVisible() const;
|
---|
105 |
|
---|
106 | public Q_SLOTS:
|
---|
107 | void setVisible(bool visible);
|
---|
108 | inline void show() { setVisible(true); }
|
---|
109 | inline void hide() { setVisible(false); }
|
---|
110 |
|
---|
111 | Q_SIGNALS:
|
---|
112 | void activated(QSystemTrayIcon::ActivationReason reason);
|
---|
113 | void messageClicked();
|
---|
114 |
|
---|
115 | protected:
|
---|
116 | bool event(QEvent *event);
|
---|
117 |
|
---|
118 | private:
|
---|
119 | Q_DISABLE_COPY(QSystemTrayIcon)
|
---|
120 | Q_DECLARE_PRIVATE(QSystemTrayIcon)
|
---|
121 |
|
---|
122 | friend class QSystemTrayIconSys;
|
---|
123 | friend class QBalloonTip;
|
---|
124 | friend void qtsystray_sendActivated(QSystemTrayIcon *, int);
|
---|
125 | };
|
---|
126 |
|
---|
127 | QT_END_NAMESPACE
|
---|
128 |
|
---|
129 | QT_END_HEADER
|
---|
130 |
|
---|
131 | #endif // QT_NO_SYSTEMTRAYICON
|
---|
132 | #endif // QSYSTEMTRAYICON_H
|
---|