1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:37:35 +00:00

LibGUI: Remove parent parameter to GUI::Widget constructor

This commit is contained in:
Andreas Kling 2020-02-23 12:07:13 +01:00
parent 4ce28c32d1
commit c5d913970a
114 changed files with 207 additions and 313 deletions

View file

@ -78,7 +78,7 @@ void IRCAppWindow::update_title()
void IRCAppWindow::setup_client()
{
m_client->aid_create_window = [this](void* owner, IRCWindow::Type type, const String& name) {
return &create_window(owner, type, name);
return create_window(owner, type, name);
};
m_client->aid_get_active_window = [this] {
return static_cast<IRCWindow*>(m_container->active_widget());
@ -237,7 +237,7 @@ void IRCAppWindow::update_part_action()
m_part_action->set_enabled(is_open_channel);
}
IRCWindow& IRCAppWindow::create_window(void* owner, IRCWindow::Type type, const String& name)
NonnullRefPtr<IRCWindow> IRCAppWindow::create_window(void* owner, IRCWindow::Type type, const String& name)
{
return *new IRCWindow(m_client, owner, type, name, m_container);
return m_container->add<IRCWindow>(m_client, owner, type, name);
}

View file

@ -50,7 +50,7 @@ private:
void update_title();
void update_part_action();
IRCWindow& create_window(void* owner, IRCWindow::Type, const String& name);
NonnullRefPtr<IRCWindow> create_window(void* owner, IRCWindow::Type, const String& name);
NonnullRefPtr<IRCClient> m_client;
RefPtr<GUI::StackWidget> m_container;
RefPtr<GUI::TableView> m_window_list;

View file

@ -70,7 +70,7 @@ public:
Function<void(const String&)> on_nickname_changed;
Function<void(IRCChannel&)> on_part_from_channel;
Function<IRCWindow*(void*, IRCWindow::Type, const String&)> aid_create_window;
Function<NonnullRefPtr<IRCWindow>(void*, IRCWindow::Type, const String&)> aid_create_window;
Function<IRCWindow*()> aid_get_active_window;
Function<void()> aid_update_window_list;

View file

@ -59,7 +59,7 @@ private:
IRCClient& m_client;
String m_name;
IRCWindow* m_window { nullptr };
RefPtr<IRCWindow> m_window;
NonnullRefPtr<IRCLogBuffer> m_log;
};

View file

@ -35,9 +35,8 @@
#include <LibGUI/TextEditor.h>
#include <LibHTML/HtmlView.h>
IRCWindow::IRCWindow(IRCClient& client, void* owner, Type type, const String& name, GUI::Widget* parent)
: GUI::Widget(parent)
, m_client(client)
IRCWindow::IRCWindow(IRCClient& client, void* owner, Type type, const String& name)
: m_client(client)
, m_owner(owner)
, m_type(type)
, m_name(name)

View file

@ -43,7 +43,6 @@ public:
Query,
};
IRCWindow(IRCClient&, void* owner, Type, const String& name, GUI::Widget* parent);
virtual ~IRCWindow() override;
String name() const { return m_name; }
@ -67,6 +66,8 @@ public:
const IRCQuery& query() const { return *(const IRCQuery*)m_owner; }
private:
IRCWindow(IRCClient&, void* owner, Type, const String& name);
IRCClient& m_client;
void* m_owner { nullptr };
Type m_type;