mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:47:44 +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 dispatch_event(CEvent&, CObject* stay_within = nullptr);
|
||||||
|
|
||||||
|
void remove_from_parent()
|
||||||
|
{
|
||||||
|
if (m_parent)
|
||||||
|
m_parent->remove_child(*this);
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit CObject(CObject* parent = nullptr, bool is_widget = false);
|
explicit CObject(CObject* parent = nullptr, bool is_widget = false);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue