From 11263beaca8391ab21561c84824d5ec181a17f0a Mon Sep 17 00:00:00 2001 From: Mustafa Quraish Date: Sun, 12 Sep 2021 16:55:55 -0400 Subject: [PATCH] PixelPaint: Add `ImageEditor::update_tool_cursor()` method This just allows us to ask the image editor to update the tool's current cursor. This is useful in cases where a tool may want to change it's cursor for some operation, and wants to invalidate the active cursor cached in the ImageEditor. --- Userland/Applications/PixelPaint/ImageEditor.cpp | 8 ++++++++ Userland/Applications/PixelPaint/ImageEditor.h | 1 + 2 files changed, 9 insertions(+) diff --git a/Userland/Applications/PixelPaint/ImageEditor.cpp b/Userland/Applications/PixelPaint/ImageEditor.cpp index 3df1a87170..8f9dded147 100644 --- a/Userland/Applications/PixelPaint/ImageEditor.cpp +++ b/Userland/Applications/PixelPaint/ImageEditor.cpp @@ -442,6 +442,14 @@ void ImageEditor::set_active_tool(Tool* tool) } } +void ImageEditor::update_tool_cursor() +{ + if (m_active_tool) { + m_active_cursor = m_active_tool->cursor(); + set_override_cursor(m_active_cursor); + } +} + void ImageEditor::set_guide_visibility(bool show_guides) { if (m_show_guides == show_guides) diff --git a/Userland/Applications/PixelPaint/ImageEditor.h b/Userland/Applications/PixelPaint/ImageEditor.h index 85ffcf174d..f658203771 100644 --- a/Userland/Applications/PixelPaint/ImageEditor.h +++ b/Userland/Applications/PixelPaint/ImageEditor.h @@ -36,6 +36,7 @@ public: Tool* active_tool() { return m_active_tool; } void set_active_tool(Tool*); + void update_tool_cursor(); void did_complete_action(); bool undo();