diff --git a/src/Widget.cpp b/src/Widget.cpp index 578c41e..c69d08d 100644 --- a/src/Widget.cpp +++ b/src/Widget.cpp @@ -106,6 +106,11 @@ void Widget::remove_child(std::shared_ptr child) { reflow(); } +void Widget::clear_children() { + m_children.clear(); + reflow(); +} + void Widget::repaint() { if (m_window) m_window->repaint(this); diff --git a/src/Widget.hpp b/src/Widget.hpp index 4a43944..92d3f9a 100644 --- a/src/Widget.hpp +++ b/src/Widget.hpp @@ -55,6 +55,7 @@ public: std::vector> &children() { return m_children; } bool add_child(std::shared_ptr child); void remove_child(std::shared_ptr child); + void clear_children(); Box &rect() { return m_rect; } void set_rect(Box rect) { m_rect = rect; reflow(); }