1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
/*
* Copyright (C) 2009 John Schember <john@nachtimwald.com>
* Copyright (C) 2004 Girish Ramakrishnan All Rights Reserved.
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#ifndef _TRAYITEM_H
#define _TRAYITEM_H
#include <QAction>
#include <QIcon>
#include <QMenu>
#include <QObject>
#include <QString>
#include <QSystemTrayIcon>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
class TrayItem : public QSystemTrayIcon {
Q_OBJECT
public:
TrayItem(Window window, QObject *parent = 0);
~TrayItem();
Window dockedWindow();
// Pass on all events through this interface
bool x11EventFilter(XEvent * event);
void setCustomIcon(QString path);
public slots:
void restoreWindow();
void iconifyWindow();
void skip_NET_WM_STATE(const char *type, bool set);
void skipTaskbar();
void skipPager();
void sticky();
void close(); // close the docked window
void setSkipTaskbar(bool value);
void setSkipPager(bool value);
void setSticky(bool value);
void setIconifyMinimized(bool value);
void setIconifyObscure(bool value);
void setIconifyFocusLost(bool value);
void setBalloonTimeout(int value);
void setBalloonTimeout(bool value);
private slots:
void toggleWindow(QSystemTrayIcon::ActivationReason reason=QSystemTrayIcon::Trigger);
void showOnAllDesktops();
void doAbout();
void doSelectAnother();
void doUndock();
void doUndockAll();
signals:
void selectAnother();
void undockAll();
void undock(TrayItem*);
private:
void minimizeEvent();
void destroyEvent();
void propertyChangeEvent(Atom property);
void obscureEvent();
void focusLostEvent();
void readDockedAppName();
void updateTitle();
void updateIcon();
void updateToggleAction();
void createContextMenu();
QIcon createIcon(Window window);
bool m_iconified;
bool m_customIcon;
bool m_skipTaskbar;
bool m_skipPager;
bool m_sticky;
bool m_iconifyMinimized;
bool m_iconifyObscure;
bool m_iconifyFocusLost;
int m_balloonTimeout;
XSizeHints m_sizeHint; // SizeHint of m_window
Window m_window; // The window that is associated with the tray icon.
long m_desktop;
QString m_dockedAppName;
QMenu *m_contextMenu;
QMenu *m_optionsMenu;
QAction *m_actionSkipTaskbar;
QAction *m_actionSkipPager;
QAction *m_actionSticky;
QAction *m_actionIconifyMinimized;
QAction *m_actionIconifyObscure;
QAction *m_actionIconifyFocusLost;
QAction *m_actionBalloonTitleChanges;
QAction *m_actionToggle;
};
#endif /* _TRAYITEM_H */
|