-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathapplet.h
63 lines (47 loc) · 1.22 KB
/
applet.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
#ifndef APPLET_H
#define APPLET_H
#include <QtCore/QObject>
#include <QtCore/QPoint>
#include <QtCore/QSize>
#include <QtGui/QGraphicsItem>
class PanelWindow;
class Applet: public QObject, public QGraphicsItem
{
Q_OBJECT
Q_INTERFACES(QGraphicsItem)
public:
Applet(PanelWindow* panelWindow);
~Applet();
virtual bool init();
void setPosition(const QPoint& position);
void setSize(const QSize& size);
const QSize& size() const
{
return m_size;
}
virtual QSize desiredSize() = 0;
PanelWindow* panelWindow()
{
return m_panelWindow;
}
void setInteractive(bool interactive);
QRectF boundingRect() const;
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
public slots:
void animateHighlight();
virtual void clicked();
protected:
virtual void layoutChanged();
QPoint localToScreen(const QPoint& point);
virtual bool isHighlighted();
void hoverEnterEvent(QGraphicsSceneHoverEvent* event);
void hoverLeaveEvent(QGraphicsSceneHoverEvent* event);
void mousePressEvent(QGraphicsSceneMouseEvent* event);
void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
PanelWindow* m_panelWindow;
QPoint m_position;
QSize m_size;
bool m_interactive;
qreal m_highlightIntensity;
};
#endif