2019-06-14 19:51:57 +03:00
|
|
|
#pragma once
|
|
|
|
|
2019-06-16 12:33:20 +03:00
|
|
|
#include "PaintableWidget.h"
|
2019-06-14 19:51:57 +03:00
|
|
|
class GMouseEvent;
|
|
|
|
|
|
|
|
class Tool {
|
|
|
|
public:
|
|
|
|
virtual ~Tool();
|
|
|
|
|
|
|
|
virtual const char* class_name() const = 0;
|
|
|
|
|
2019-06-16 12:33:20 +03:00
|
|
|
virtual void on_mousedown(GMouseEvent&) { }
|
|
|
|
virtual void on_mousemove(GMouseEvent&) { }
|
|
|
|
virtual void on_mouseup(GMouseEvent&) { }
|
2019-06-23 11:00:02 +03:00
|
|
|
virtual void on_contextmenu(GContextMenuEvent&) { }
|
2019-06-16 12:33:20 +03:00
|
|
|
|
|
|
|
void clear() { m_widget = nullptr; }
|
|
|
|
void setup(PaintableWidget& widget) { m_widget = widget.make_weak_ptr(); }
|
2019-06-14 19:51:57 +03:00
|
|
|
|
|
|
|
protected:
|
|
|
|
Tool();
|
2019-06-16 12:33:20 +03:00
|
|
|
WeakPtr<PaintableWidget> m_widget;
|
2019-06-14 19:51:57 +03:00
|
|
|
};
|