mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 02:12:09 -05:00
c6dd3377ee
This patch adds a GUI::TabWidget to the main UI and allows having multiple images open at the same time. Some of the changes here are a bit hackish and mechanical and there's still code around that needs more work to fit better in the new world. One nice side-effect of this change is that ImageEditor now always has one Image associated with it, and it never changes.
46 lines
1.2 KiB
C++
46 lines
1.2 KiB
C++
/*
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibGUI/Event.h>
|
|
#include <LibGUI/Forward.h>
|
|
|
|
namespace PixelPaint {
|
|
|
|
class ImageEditor;
|
|
class Layer;
|
|
|
|
class Tool {
|
|
public:
|
|
virtual ~Tool();
|
|
|
|
virtual void on_mousedown(Layer&, GUI::MouseEvent&, GUI::MouseEvent&) { }
|
|
virtual void on_mousemove(Layer&, GUI::MouseEvent&, GUI::MouseEvent&) { }
|
|
virtual void on_mouseup(Layer&, GUI::MouseEvent&, GUI::MouseEvent&) { }
|
|
virtual void on_context_menu(Layer&, GUI::ContextMenuEvent&) { }
|
|
virtual void on_tool_button_contextmenu(GUI::ContextMenuEvent&) { }
|
|
virtual void on_second_paint(Layer const&, GUI::PaintEvent&) { }
|
|
virtual void on_keydown(GUI::KeyEvent&) { }
|
|
virtual void on_keyup(GUI::KeyEvent&) { }
|
|
virtual GUI::Widget* get_properties_widget() { return nullptr; }
|
|
|
|
void clear() { m_editor = nullptr; }
|
|
void setup(ImageEditor&);
|
|
|
|
ImageEditor const* editor() const { return m_editor; }
|
|
ImageEditor* editor() { return m_editor; }
|
|
|
|
GUI::Action* action() { return m_action; }
|
|
void set_action(GUI::Action*);
|
|
|
|
protected:
|
|
Tool();
|
|
WeakPtr<ImageEditor> m_editor;
|
|
RefPtr<GUI::Action> m_action;
|
|
};
|
|
|
|
}
|