1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:38:11 +00:00

LibCore: Add CObject::remove_from_parent()

This is a convenient shorthand for:

    if (object.parent())
        object.parent()->remove_child(object);
This commit is contained in:
Andreas Kling 2019-09-22 00:41:01 +02:00
parent d6abfbdc5a
commit f614081b83

View file

@ -85,6 +85,12 @@ public:
void dispatch_event(CEvent&, CObject* stay_within = nullptr);
void remove_from_parent()
{
if (m_parent)
m_parent->remove_child(*this);
}
protected:
explicit CObject(CObject* parent = nullptr, bool is_widget = false);