-
Notifications
You must be signed in to change notification settings - Fork 0
/
View.hpp
65 lines (60 loc) · 1.72 KB
/
View.hpp
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
#ifndef H_View
#define H_View
//----------------------------------------------------------------------------
#include <QWidget>
#include <QTimer>
//----------------------------------------------------------------------------
class Presenter;
//----------------------------------------------------------------------------
/// A viewer window. The renderering is done by the presenter class
class View : public QWidget
{
Q_OBJECT
private:
/// The presenter
Presenter& presenter;
/// The target rectangle
QRect target;
/// A timer for hiding the cursor
QTimer cursorTimeout;
/// Show full screen of next paint?
bool delayedFullScreen;
/// Is the cursor hidden
bool hiddenCursor;
/// Tablet down?
bool tabletDown;
/// Tablet position
QPoint tabletPos;
/// Tablet pressure sensitiveness
bool tabletPressureSensitiveness;
/// Mouse drawing
bool mouseDrawing,mouseDown;
/// Mouse position
QPoint mousePos;
friend class Presenter;
protected:
/// Paint the view
void paintEvent(QPaintEvent* event);
/// Handle input
void keyPressEvent(QKeyEvent* event);
/// Handle mouse movement
void mouseMoveEvent(QMouseEvent* event);
/// Handle mouse clicks
void mousePressEvent(QMouseEvent* event);
/// Handle mouse clicks
void mouseReleaseEvent(QMouseEvent* event);
/// Handle tablet events
void tabletEvent(QTabletEvent *event);
protected slots:
/// Show the cursor for a while
void showCursorTemporarily();
/// Hide the current cursor
void hideCursor();
public:
/// Constructor
View(Presenter& presenter,const QRect& target);
/// Destructor
~View();
};
//----------------------------------------------------------------------------
#endif