summaryrefslogtreecommitdiff
path: root/Userland/Applications/PixelPaint/Tools/GuideTool.h
diff options
context:
space:
mode:
authorMarcus Nilsson <brainbomb@gmail.com>2021-09-17 09:54:55 +0200
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-09-20 03:04:24 +0000
commitf9e0815c3b2588297ebdf08938859988bbe8a5b8 (patch)
tree62b3fdc18461be119a0b12ae73b9885e75c1e306 /Userland/Applications/PixelPaint/Tools/GuideTool.h
parent61ad239ee07c9c2db37df93ca43f0d168c973099 (diff)
downloadserenity-f9e0815c3b2588297ebdf08938859988bbe8a5b8.zip
PixelPaint: Move Tools to it's own subdirectory
The PixelPaint source directory was getting a bit large, let's move all the Tools to it's own subdirectory. Also remove some unused includes.
Diffstat (limited to 'Userland/Applications/PixelPaint/Tools/GuideTool.h')
-rw-r--r--Userland/Applications/PixelPaint/Tools/GuideTool.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/Userland/Applications/PixelPaint/Tools/GuideTool.h b/Userland/Applications/PixelPaint/Tools/GuideTool.h
new file mode 100644
index 0000000000..33faae84a4
--- /dev/null
+++ b/Userland/Applications/PixelPaint/Tools/GuideTool.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include "../Guide.h"
+#include "Tool.h"
+#include <AK/RefPtr.h>
+
+namespace PixelPaint {
+
+class GuideTool final : public Tool {
+public:
+ GuideTool();
+
+ virtual ~GuideTool() override;
+
+ virtual void on_mousedown(Layer*, MouseEvent&) override;
+ virtual void on_mousemove(Layer*, MouseEvent&) override;
+ virtual void on_mouseup(Layer*, MouseEvent&) override;
+ virtual void on_context_menu(Layer*, GUI::ContextMenuEvent&) override;
+
+ virtual void on_tool_activation() override;
+
+ virtual GUI::Widget* get_properties_widget() override;
+ virtual Gfx::StandardCursor cursor() override { return Gfx::StandardCursor::Crosshair; }
+
+private:
+ RefPtr<Guide> closest_guide(Gfx::IntPoint const&);
+
+ RefPtr<GUI::Widget> m_properties_widget;
+
+ RefPtr<Guide> m_selected_guide;
+ RefPtr<Guide> m_context_menu_guide;
+ Gfx::IntPoint m_event_origin;
+ float m_guide_origin { 0 };
+ RefPtr<GUI::Menu> m_context_menu;
+ int m_snap_size { 10 };
+};
+}