diff options
Diffstat (limited to 'plugingui/widget.cc')
-rw-r--r-- | plugingui/widget.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/plugingui/widget.cc b/plugingui/widget.cc index 3d9d47c..4b1d1f7 100644 --- a/plugingui/widget.cc +++ b/plugingui/widget.cc @@ -92,6 +92,26 @@ void Widget::removeChild(Widget* widget) } } +void Widget::reparent(Widget* parent) +{ + if(parent == this->parent) + { + return; // Already at the right parent. + } + + if(this->parent) + { + this->parent->removeChild(this); + } + + if(parent) + { + parent->addChild(this); + } + + this->parent = parent; +} + void Widget::resize(int width, int height) { if((width < 1) || (height < 1) || |