1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:47:45 +00:00

IRCClient: Refactor window creation responsibilities.

IRCChannel and IRCQuery objects now create their own windows with the
help of an aid_create_window callback provided by IRCAppWindow.

There's still a bit of murk but this is already an improvement.
This commit is contained in:
Andreas Kling 2019-03-16 01:45:49 +01:00
parent fc7f700c20
commit 1394677528
10 changed files with 40 additions and 48 deletions

View file

@ -2,7 +2,9 @@
#include <LibGUI/GWidget.h>
class IRCChannel;
class IRCClient;
class IRCQuery;
class IRCLogBuffer;
class GTableView;
class GTextEditor;
@ -15,7 +17,7 @@ public:
Query,
};
explicit IRCWindow(IRCClient&, Type, const String& name, GWidget* parent);
IRCWindow(IRCClient&, void* owner, Type, const String& name, GWidget* parent);
virtual ~IRCWindow() override;
String name() const { return m_name; }
@ -25,8 +27,15 @@ public:
void set_log_buffer(const IRCLogBuffer&);
IRCChannel& channel() { return *(IRCChannel*)m_owner; }
const IRCChannel& channel() const { return *(const IRCChannel*)m_owner; }
IRCQuery& query() { return *(IRCQuery*)m_owner; }
const IRCQuery& query() const { return *(const IRCQuery*)m_owner; }
private:
IRCClient& m_client;
void* m_owner { nullptr };
Type m_type;
String m_name;
GTableView* m_table_view { nullptr };