From: Mikko Rasa Date: Mon, 28 Feb 2011 15:21:49 +0000 (+0000) Subject: Add child_added/removed events to Container X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=9bfda3958f5b610c4513a912f4cd07d703d3d184;p=libs%2Fgltk.git Add child_added/removed events to Container --- diff --git a/source/container.cpp b/source/container.cpp index 9ad6648..4c0ce93 100644 --- a/source/container.cpp +++ b/source/container.cpp @@ -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; } diff --git a/source/container.h b/source/container.h index ddccb06..e41baab 100644 --- a/source/container.h +++ b/source/container.h @@ -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