summaryrefslogtreecommitdiff
path: root/Applications/PaintBrush/Tool.h
blob: 62fa299ad882417337165a1176d6cdfc55fb539e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#pragma once

#include "PaintableWidget.h"
class GMouseEvent;

class Tool {
public:
    virtual ~Tool();

    virtual const char* class_name() const = 0;

    virtual void on_mousedown(GMouseEvent&) { }
    virtual void on_mousemove(GMouseEvent&) { }
    virtual void on_mouseup(GMouseEvent&) { }

    void clear() { m_widget = nullptr; }
    void setup(PaintableWidget& widget) { m_widget = widget.make_weak_ptr(); }

protected:
    Tool();
    WeakPtr<PaintableWidget> m_widget;
};