add clear_children function for widget
This commit is contained in:
parent
32524f01e2
commit
cbbe90f57d
2 changed files with 6 additions and 0 deletions
|
@ -106,6 +106,11 @@ void Widget::remove_child(std::shared_ptr<Widget> child) {
|
||||||
reflow();
|
reflow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Widget::clear_children() {
|
||||||
|
m_children.clear();
|
||||||
|
reflow();
|
||||||
|
}
|
||||||
|
|
||||||
void Widget::repaint() {
|
void Widget::repaint() {
|
||||||
if (m_window)
|
if (m_window)
|
||||||
m_window->repaint(this);
|
m_window->repaint(this);
|
||||||
|
|
|
@ -55,6 +55,7 @@ public:
|
||||||
std::vector<std::shared_ptr<Widget>> &children() { return m_children; }
|
std::vector<std::shared_ptr<Widget>> &children() { return m_children; }
|
||||||
bool add_child(std::shared_ptr<Widget> child);
|
bool add_child(std::shared_ptr<Widget> child);
|
||||||
void remove_child(std::shared_ptr<Widget> child);
|
void remove_child(std::shared_ptr<Widget> child);
|
||||||
|
void clear_children();
|
||||||
|
|
||||||
Box &rect() { return m_rect; }
|
Box &rect() { return m_rect; }
|
||||||
void set_rect(Box rect) { m_rect = rect; reflow(); }
|
void set_rect(Box rect) { m_rect = rect; reflow(); }
|
||||||
|
|
Loading…
Reference in a new issue