diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-03-15 23:24:40 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-03-15 23:24:40 +0100 |
commit | 3a3aa74b2e82e3589fd5db4e274951729b1bdfa2 (patch) | |
tree | 81401136090e7881e5dd8dbeabb225519960feef /LibGUI/GWidget.cpp | |
parent | b54ab065953e1642c0a1c3949a3536a46c9b0aba (diff) | |
download | serenity-3a3aa74b2e82e3589fd5db4e274951729b1bdfa2.zip |
IRCClient: Add a toolbar with some actions.
Diffstat (limited to 'LibGUI/GWidget.cpp')
-rw-r--r-- | LibGUI/GWidget.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/LibGUI/GWidget.cpp b/LibGUI/GWidget.cpp index 15ee45de32..8303aad9c8 100644 --- a/LibGUI/GWidget.cpp +++ b/LibGUI/GWidget.cpp @@ -15,15 +15,21 @@ GWidget::GWidget(GWidget* parent) set_font(nullptr); m_background_color = Color::LightGray; m_foreground_color = Color::Black; - - if (parent && parent->layout()) - parent->layout()->add_widget(*this); } GWidget::~GWidget() { } +void GWidget::child_event(GChildEvent& event) +{ + if (event.type() == GEvent::ChildAdded) { + if (event.child() && event.child()->is_widget() && layout()) + layout()->add_widget(static_cast<GWidget&>(*event.child())); + } + return GObject::child_event(event); +} + void GWidget::set_relative_rect(const Rect& rect) { if (rect == m_relative_rect) |