1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 20:15:07 +00:00
serenity/DevTools/HackStudio/CursorTool.h
Andreas Kling 567769eb2f HackStudio: Allow moving widgets around using the CursorTool
You can now move the widgets around, either by themselves or in group
selections, by dragging them with the cursor tool. :^)
2019-11-10 22:31:10 +01:00

26 lines
631 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;
Point m_drag_origin;
HashMap<GWidget*, Point> m_positions_before_drag;
bool m_dragging { false };
};