forked from MadFishTheOne/qtpanel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrayapplet.h
69 lines (52 loc) · 1.33 KB
/
trayapplet.h
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
#ifndef TRAYAPPLET_H
#define TRAYAPPLET_H
#include <QtCore/QVector>
#include <QtCore/QSize>
#include "applet.h"
class TrayApplet;
class TrayItem: public QObject, public QGraphicsItem
{
Q_OBJECT
Q_INTERFACES(QGraphicsItem)
public:
TrayItem(TrayApplet* trayApplet, unsigned long window);
~TrayItem();
void setPosition(const QPoint& position);
void setSize(const QSize& size);
QRectF boundingRect() const;
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
unsigned long window() const
{
return m_window;
}
private:
QSize m_size;
TrayApplet* m_trayApplet;
unsigned long m_window;
};
class TrayApplet: public Applet
{
Q_OBJECT
public:
TrayApplet(PanelWindow* panelWindow);
~TrayApplet();
bool init();
QSize desiredSize();
void registerTrayItem(TrayItem* trayItem);
void unregisterTrayItem(TrayItem* trayItem);
int iconSize() const { return m_iconSize; }
protected:
void layoutChanged();
private slots:
void clientMessageReceived(unsigned long window, unsigned long atom, void* data);
void windowClosed(unsigned long window);
void windowReconfigured(unsigned long window, int x, int y, int width, int height);
void windowDamaged(unsigned long window);
private:
void updateLayout();
bool m_initialized;
QVector<TrayItem*> m_trayItems;
int m_iconSize;
int m_spacing;
};
#endif