1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 01:58:12 +00:00
serenity/DevTools/HackStudio/Tool.h
Andreas Kling c8637e0206 HackStudio: Allow moving the selected widgets using the arrow keys
This is a nice complement to moving widgets with the mouse. :^)
2019-11-10 22:40:58 +01:00

32 lines
637 B
C++

#pragma once
#include <AK/Noncopyable.h>
class FormEditorWidget;
class GKeyEvent;
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 void on_keydown(GKeyEvent&) = 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;
};