1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:18:11 +00:00
serenity/DevTools/HackStudio/Tool.h
Andreas Kling e87756424d HackStudio: Introduce a Tool class with subs CursorTool and WidgetTool
These will be used to draw out new widgets on a FormWidget, or in the
case of CursorTool, to select and manipulate existing widgets.
2019-11-10 21:45:32 +01:00

30 lines
575 B
C++

#pragma once
#include <AK/Noncopyable.h>
class FormEditorWidget;
class GMouseEvent;
class Tool {
AK_MAKE_NONCOPYABLE(Tool)
AK_MAKE_NONMOVABLE(Tool)
public:
virtual ~Tool() {}
virtual void on_mousedown(GMouseEvent&) = 0;
virtual void on_mouseup(GMouseEvent&) = 0;
virtual void on_mousemove(GMouseEvent&) = 0;
virtual const char* class_name() const = 0;
virtual void attach() {}
virtual void detach() {}
protected:
explicit Tool(FormEditorWidget& editor)
: m_editor(editor)
{
}
FormEditorWidget& m_editor;
};