X-Git-Url: http://git.tdb.fi/?p=libs%2Fgltk.git;a=blobdiff_plain;f=source%2Fpanel.cpp;h=36585c97716778431c96cdcf4285c2cbaedc1b5b;hp=529ec199183d20e1b31cdb3675b3025450fb4ca5;hb=2f1c7d6861c801e24a003ee5f6132032e04c9bbe;hpb=1fde94c15fc65e85f5931a9daf74dd8806e682e0 diff --git a/source/panel.cpp b/source/panel.cpp index 529ec19..36585c9 100644 --- a/source/panel.cpp +++ b/source/panel.cpp @@ -27,15 +27,26 @@ Panel::Panel(const Resources &r): Panel::~Panel() { - for(ChildSeq::iterator i=children.begin(); i!=children.end(); ++i) - delete *i; + while(!children.empty()) + delete children.front(); } void Panel::add(Widget &wdg) { + set_parent(wdg, this); children.push_back(&wdg); } +void Panel::remove(Widget &wdg) +{ + ChildSeq::iterator i=find(children.begin(), children.end(), &wdg); + if(i!=children.end()) + { + set_parent(wdg, 0); + children.erase(i); + } +} + void Panel::button_press(int x, int y, unsigned btn) { if(pointer_grab>0)