mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
d3558b6137
When adding a widget to a parent, you don't always want to append it to the set of existing children, but instead insert it before one of them. This patch makes that possible by adding CObject::insert_child_before() which also produces a ChildAdded event with an additional before_child pointer. This pointer is then used by GWidget to make sure that any layout present maintains the correct order. (Without doing that, newly added children would still be appended into the layout order, despite having a different widget sibling order.)
13 lines
343 B
C++
13 lines
343 B
C++
#include <LibCore/CEvent.h>
|
|
#include <LibCore/CObject.h>
|
|
|
|
CChildEvent::CChildEvent(Type type, CObject& child, CObject* insertion_before_child)
|
|
: CEvent(type)
|
|
, m_child(child.make_weak_ptr())
|
|
, m_insertion_before_child(insertion_before_child ? insertion_before_child->make_weak_ptr() : nullptr)
|
|
{
|
|
}
|
|
|
|
CChildEvent::~CChildEvent()
|
|
{
|
|
}
|