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:
parent
d6abfbdc5a
commit
f614081b83
1 changed files with 6 additions and 0 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue