2019-11-10 21:45:32 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "Tool.h"
|
2019-11-10 22:31:10 +01:00
|
|
|
#include <AK/HashMap.h>
|
|
|
|
|
#include <LibDraw/Point.h>
|
|
|
|
|
|
|
|
|
|
class GWidget;
|
2019-11-10 21:45:32 +01:00
|
|
|
|
|
|
|
|
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;
|
2019-11-10 22:31:10 +01:00
|
|
|
|
|
|
|
|
Point m_drag_origin;
|
|
|
|
|
HashMap<GWidget*, Point> m_positions_before_drag;
|
|
|
|
|
bool m_dragging { false };
|
2019-11-10 21:45:32 +01:00
|
|
|
};
|