summaryrefslogtreecommitdiff
path: root/LibGUI/GWidget.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-03-15 23:24:40 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-03-15 23:24:40 +0100
commit3a3aa74b2e82e3589fd5db4e274951729b1bdfa2 (patch)
tree81401136090e7881e5dd8dbeabb225519960feef /LibGUI/GWidget.cpp
parentb54ab065953e1642c0a1c3949a3536a46c9b0aba (diff)
downloadserenity-3a3aa74b2e82e3589fd5db4e274951729b1bdfa2.zip
IRCClient: Add a toolbar with some actions.
Diffstat (limited to 'LibGUI/GWidget.cpp')
-rw-r--r--LibGUI/GWidget.cpp12
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)