mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 17:08:12 +00:00

Could do with some more tweaking no doubt, and it'd be nice to have a circular spray, but this is better than nothing.
22 lines
484 B
C++
22 lines
484 B
C++
#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;
|
|
};
|