forked from x90/IRC-Paint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Brush.h
21 lines (18 loc) · 983 Bytes
/
Brush.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#ifndef BRUSH_H
#define BRUSH_H
class MainWidget;
class QMouseEvent;
class QPaintEvent;
class QPainter;
class Brush {
protected:
MainWidget* widget;
public:
Brush(MainWidget* w) : widget(w) {} // the x and y coordinates below are ascii coordinates, [0,xasc) and [0,yasc)
virtual ~Brush() {}
virtual bool onMouseClick(QMouseEvent* event, int x, int y, bool insideWidget); // insideWidget is true if the event occurred in the paintable area
virtual bool onMouseRelease(QMouseEvent* event, int x, int y, bool insideWidget); // brush paint events are always called, but are not required to be implemented
virtual bool onMouseMove(QMouseEvent* event, int x, int y, bool insideWidget); // IMPORTANT: when insideWidget is true, the x and y values are INVALID and NOT SUPPOSED TO BE USED
virtual void onWidgetPaint(QPaintEvent* event, QPainter& painter); // if the mouse functions return true, the widget emits a somethingChanged() signal
};
#endif // BRUSH_H