-
Notifications
You must be signed in to change notification settings - Fork 2
/
hintcontrol.h
74 lines (51 loc) · 1.39 KB
/
hintcontrol.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
70
71
72
73
74
#ifndef HINTCONTROL_H
#define HINTCONTROL_H
#include <QGraphicsScene>
#include <QRect>
#include <QPixmap>
#include <QPoint>
#include "scaler.h"
////////////////////////////////////////////////////////////////////////////////
struct HintInfo
{
HintInfo() : active(true), blocking(false)
{
}
QPoint position;
QSize size;
QString content;
bool active, blocking;
};
////////////////////////////////////////////////////////////////////////////////
class HintPainter
{
public:
HintPainter(const HintInfo &hint);
virtual ~HintPainter() {}
virtual void paint(QPainter &p);
inline bool isBlocking() const { return myBlock; }
inline QRect rect() { return QRect(DPOINT(myPos), myPixmap.size()); }
protected:
QPixmap myPixmap;
QPoint myPos;
qreal myOpacity;
bool myBlock;
};
////////////////////////////////////////////////////////////////////////////////
class HintControl : public QObject
{
public:
HintControl(QGraphicsScene *parent);
virtual ~HintControl() {}
virtual void scheduleHint(const HintInfo &hint);
virtual bool execute();
virtual void init();
virtual void paint(QPainter &p);
virtual bool mouseClick(QPoint pos, int buttons);
protected:
QList<class HintPainter*> hints, activeHints;
bool block;
QGraphicsScene *scene;
};
////////////////////////////////////////////////////////////////////////////////
#endif // HINTCONTROL_H