mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:47:36 +00:00
Userspace: Use Core::Object::add() when building interfaces
This commit is contained in:
parent
7ec758773c
commit
3d20da9ee4
87 changed files with 403 additions and 438 deletions
|
@ -40,9 +40,8 @@
|
|||
class ToolButton final : public GUI::Button {
|
||||
C_OBJECT(ToolButton)
|
||||
public:
|
||||
ToolButton(const String& name, GUI::Widget* parent, OwnPtr<Tool>&& tool)
|
||||
: GUI::Button(parent)
|
||||
, m_tool(move(tool))
|
||||
ToolButton(const String& name, OwnPtr<Tool>&& tool)
|
||||
: m_tool(move(tool))
|
||||
{
|
||||
set_tooltip(name);
|
||||
}
|
||||
|
@ -60,8 +59,7 @@ private:
|
|||
OwnPtr<Tool> m_tool;
|
||||
};
|
||||
|
||||
ToolboxWidget::ToolboxWidget(GUI::Widget* parent)
|
||||
: GUI::Frame(parent)
|
||||
ToolboxWidget::ToolboxWidget()
|
||||
{
|
||||
set_fill_with_background_color(true);
|
||||
|
||||
|
@ -76,7 +74,7 @@ ToolboxWidget::ToolboxWidget(GUI::Widget* parent)
|
|||
layout()->set_margins({ 4, 4, 4, 4 });
|
||||
|
||||
auto add_tool = [&](const StringView& name, const StringView& icon_name, OwnPtr<Tool>&& tool) {
|
||||
auto button = ToolButton::construct(name, this, move(tool));
|
||||
auto button = add<ToolButton>(name, move(tool));
|
||||
button->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
|
||||
button->set_preferred_size(0, 32);
|
||||
button->set_checkable(true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue