summaryrefslogtreecommitdiff
path: root/Userland/Applications/PixelPaint/Selection.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-08-25 20:50:15 +0200
committerAndreas Kling <kling@serenityos.org>2022-08-26 01:04:52 +0200
commitd571159aebbf1e7442622efb8346d5c0657c1e03 (patch)
tree8786143c2d9cb3d0520b17aeaab742ded1f04c44 /Userland/Applications/PixelPaint/Selection.h
parent67596d9546fc2a08b5022dc60e5a30e3ea2c2f18 (diff)
downloadserenity-d571159aebbf1e7442622efb8346d5c0657c1e03.zip
PixelPaint: Move selection from ImageEditor to Image
This is preparation for making selection state undoable.
Diffstat (limited to 'Userland/Applications/PixelPaint/Selection.h')
-rw-r--r--Userland/Applications/PixelPaint/Selection.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/Userland/Applications/PixelPaint/Selection.h b/Userland/Applications/PixelPaint/Selection.h
index 7f269cc1e0..c47f87690e 100644
--- a/Userland/Applications/PixelPaint/Selection.h
+++ b/Userland/Applications/PixelPaint/Selection.h
@@ -13,7 +13,15 @@
namespace PixelPaint {
-class ImageEditor;
+class Image;
+
+class SelectionClient {
+public:
+ virtual void selection_did_change() = 0;
+
+protected:
+ virtual ~SelectionClient() = default;
+};
// Coordinates are image-relative.
class Selection {
@@ -26,7 +34,7 @@ public:
__Count,
};
- explicit Selection(ImageEditor&);
+ explicit Selection(Image&);
bool is_empty() const { return m_mask.is_null(); }
void clear();
@@ -47,9 +55,15 @@ public:
bool in_interactive_selection() { return m_in_interactive_selection; }
+ void add_client(SelectionClient&);
+ void remove_client(SelectionClient&);
+
private:
- ImageEditor& m_editor;
+ Image& m_image;
Mask m_mask;
+
+ HashTable<SelectionClient*> m_clients;
+
bool m_in_interactive_selection { false };
};