-
Notifications
You must be signed in to change notification settings - Fork 1
/
canvas.h
60 lines (46 loc) · 1.86 KB
/
canvas.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
#ifndef CANVAS_H
#define CANVAS_H
#include <QWidget>
#include "tools.h"
#include "canvasdelegate.h"
class ActionHandler; class FenchelNielsenUser; class MainWindow; class CanvasDelegateTests; class CanvasDelegateTests2;
class Canvas : public QWidget
{
Q_OBJECT
friend class MainWindow;
friend class FenchelNielsenUser;
friend class ActionHandler;
public:
Canvas(DelegateType delegateType, MainWindow* window = nullptr, bool leftCanvas = false, bool rightCanvas = false, ActionHandler *handler = nullptr);
explicit Canvas(FenchelNielsenUser *fenchelNielsenUser);
explicit Canvas(CanvasDelegateTests *delegate);
explicit Canvas(CanvasDelegateTests2 *delegate);
Canvas() = delete;
Canvas(const Canvas &) = delete;
Canvas & operator=(Canvas) = delete;
~Canvas();
DelegateType getDelegateType() const;
void resetView();
private:
void changeDelegate(DelegateType delegateType, bool leftCanvas, bool rightCanvas, ActionHandler *handler = nullptr);
void updateRefresh(bool back, bool top);
void paintEvent(QPaintEvent *event) override;
void resizeEvent(QResizeEvent *) override;
void moveEvent(QMoveEvent *) override;
void mousePressEvent(QMouseEvent *mouseEvent) override;
void mouseMoveEvent(QMouseEvent *mouseEvent) override;
void mouseReleaseEvent(QMouseEvent *mouseEvent) override;
void wheelEvent(QWheelEvent *wheelEvent) override;
void keyPressEvent(QKeyEvent *keyEvent) override;
void keyReleaseEvent(QKeyEvent *keyEvent) override;
void enterEvent(QEvent *) override;
void leaveEvent(QEvent *) override;
void initialize();
void rescale();
int imageFirstCornerX() const;
int imageFirstCornerY() const;
int imageMaxSize() const;
bool mouseEventOverImage(QMouseEvent *mouseEvent, int &xOut, int &yOut) const;
CanvasDelegate *delegate;
};
#endif // CANVAS_H