]> git.tdb.fi Git - libs/gltk.git/commitdiff
Add child_added/removed events to Container
authorMikko Rasa <tdb@tdb.fi>
Mon, 28 Feb 2011 15:21:49 +0000 (15:21 +0000)
committerMikko Rasa <tdb@tdb.fi>
Mon, 28 Feb 2011 15:21:49 +0000 (15:21 +0000)
source/container.cpp
source/container.h

index 9ad66482a15a2ad2503d7f0efcb12a6fe14383c4..4c0ce93fa6fda1a5fca02860cc793e13e9bb2a03 100644 (file)
@@ -27,6 +27,7 @@ void Container::add(Widget &wdg)
 {
        wdg.set_parent(this);
        children.push_back(create_child(&wdg));
+       on_child_added(wdg);
 }
 
 void Container::remove(Widget &wdg)
@@ -37,6 +38,7 @@ void Container::remove(Widget &wdg)
                        wdg.set_parent(0);
                        delete *i;
                        children.erase(i);
+                       on_child_removed(wdg);
                        return;
                }
 
index ddccb06b7dd0e1f16faef7c34807e9444884d2b1..e41baab671de003911ca2980ad0febea816aa25d 100644 (file)
@@ -52,6 +52,8 @@ public:
        virtual void pointer_leave();
 protected:
        virtual void on_reparent();
+       virtual void on_child_added(Widget &) { }
+       virtual void on_child_removed(Widget &) { }
 };
 
 } // namespace GLtk