1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 22:05:06 +00:00
serenity/DevTools/HackStudio/CursorTool.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

27 lines
681 B
C++

#pragma once
#include "Tool.h"
#include <AK/HashMap.h>
#include <LibDraw/Point.h>
class GWidget;
class CursorTool final : public Tool {
public:
explicit CursorTool(FormEditorWidget& editor)
: Tool(editor)
{
}
virtual ~CursorTool() override {}
private:
virtual const char* class_name() const override { return "CursorTool"; }
virtual void on_mousedown(GMouseEvent&) override;
virtual void on_mouseup(GMouseEvent&) override;
virtual void on_mousemove(GMouseEvent&) override;
virtual void on_keydown(GKeyEvent&) override;
Point m_drag_origin;
HashMap<GWidget*, Point> m_positions_before_drag;
bool m_dragging { false };
};