mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:27:45 +00:00
PixelPaint: Extract common scope code into a generic ScopeWidget
When we add more scopes, this will facilitate code sharing.
This commit is contained in:
parent
8b60305698
commit
fe88fd22fa
5 changed files with 86 additions and 45 deletions
34
Userland/Applications/PixelPaint/ScopeWidget.h
Normal file
34
Userland/Applications/PixelPaint/ScopeWidget.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) 2022, kleines Filmröllchen <filmroellchen@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Image.h"
|
||||
#include <LibCore/Object.h>
|
||||
#include <LibGUI/Frame.h>
|
||||
|
||||
namespace PixelPaint {
|
||||
|
||||
class ScopeWidget
|
||||
: public GUI::Frame
|
||||
, public ImageClient {
|
||||
C_OBJECT_ABSTRACT(ScopeWidget);
|
||||
|
||||
public:
|
||||
virtual ~ScopeWidget() override;
|
||||
|
||||
void set_image(Image*);
|
||||
virtual void image_changed() = 0;
|
||||
void set_color_at_mouseposition(Color);
|
||||
|
||||
protected:
|
||||
virtual void paint_event(GUI::PaintEvent&) override = 0;
|
||||
|
||||
Color m_color_at_mouseposition = Color::Transparent;
|
||||
RefPtr<Image> m_image;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue