1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 12:07:45 +00:00

PixelPaint: Have layers and images send out notifications on changes

We use this to automatically update the thumbnail in LayerListWidget
when you draw into a layer. We also use it to repaint the ImageEditor
when the image changes somehow. :^)
This commit is contained in:
Andreas Kling 2020-05-25 22:49:50 +02:00
parent de85cd0907
commit dc3de47b03
14 changed files with 53 additions and 12 deletions

View file

@ -44,7 +44,8 @@ class ImageClient {
public:
virtual void image_did_add_layer(size_t) { }
virtual void image_did_remove_layer(size_t) { }
virtual void image_did_update_layer(size_t) { }
virtual void image_did_modify_layer(size_t) { }
virtual void image_did_change() { }
};
class Image : public RefCounted<Image> {
@ -72,9 +73,13 @@ public:
void add_client(ImageClient&);
void remove_client(ImageClient&);
void layer_did_modify_bitmap(Badge<Layer>, const Layer&);
private:
explicit Image(const Gfx::Size&);
void did_change();
size_t index_of(const Layer&) const;
Gfx::Size m_size;