]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/container.cpp
Improve comments of the Layout class
[libs/gltk.git] / source / container.cpp
index 9ad66482a15a2ad2503d7f0efcb12a6fe14383c4..bec206602a95248c72f53ad4de28f41444b71659 100644 (file)
@@ -1,10 +1,3 @@
-/* $Id$
-
-This file is part of libmspgltk
-Copyright © 2009-2011  Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
 #include "container.h"
 
 using namespace std;
@@ -12,6 +5,11 @@ using namespace std;
 namespace Msp {
 namespace GLtk {
 
+hierarchy_error::hierarchy_error(const string &w):
+       logic_error(w)
+{ }
+
+
 Container::Container():
        click_focus(0),
        click_button(0)
@@ -27,6 +25,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,10 +36,11 @@ void Container::remove(Widget &wdg)
                        wdg.set_parent(0);
                        delete *i;
                        children.erase(i);
+                       on_child_removed(wdg);
                        return;
                }
 
-       throw InvalidState("That Widget is not in this Container");
+       throw hierarchy_error("widget not in container");
 }
 
 Container::Child *Container::create_child(Widget *wdg)