mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:57:46 +00:00
PixelPaint: Use GUI::Toolbar inside the toolbox widget
We don't need to implement our own toolbar and tool button classes when the ones from LibGUI work just fine. :^)
This commit is contained in:
parent
0ee7991dca
commit
ad2752276a
2 changed files with 29 additions and 65 deletions
|
@ -1,20 +1,22 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/NonnullOwnPtrVector.h>
|
||||
#include <LibGUI/ActionGroup.h>
|
||||
#include <LibGUI/Frame.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
|
||||
namespace PixelPaint {
|
||||
|
||||
class Tool;
|
||||
|
||||
class ToolboxWidget final : public GUI::Frame {
|
||||
C_OBJECT(ToolboxWidget)
|
||||
class ToolboxWidget final : public GUI::Widget {
|
||||
C_OBJECT(ToolboxWidget);
|
||||
|
||||
public:
|
||||
virtual ~ToolboxWidget() override;
|
||||
|
||||
|
@ -24,7 +26,7 @@ public:
|
|||
void for_each_tool(Callback callback)
|
||||
{
|
||||
for (auto& tool : m_tools)
|
||||
callback(*tool);
|
||||
callback(tool);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -33,8 +35,9 @@ private:
|
|||
void setup_tools();
|
||||
|
||||
explicit ToolboxWidget();
|
||||
RefPtr<GUI::Toolbar> m_toolbar;
|
||||
GUI::ActionGroup m_action_group;
|
||||
Vector<Tool*> m_tools;
|
||||
NonnullOwnPtrVector<Tool> m_tools;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue