tuikit/core/container.py
changeset 90 781774a8d568
parent 89 94f5baef19ac
child 91 de80e140b0ec
--- a/tuikit/core/container.py	Wed Mar 19 00:32:38 2014 +0100
+++ b/tuikit/core/container.py	Wed Mar 19 20:42:52 2014 +0100
@@ -1,30 +1,34 @@
-from tuikit.core.theme import default_theme
+from tuikit.core.widget import Widget
 
 
-class Container:
+class Container(Widget):
+
+    """Container widget.
 
-    """Container for widgets."""
+    Can contain other widgets to create hierarchical structure.
+
+    """
 
     def __init__(self):
+        Widget.__init__(self)
         #: List of child widgets.
         self.children = []
-        self.theme = default_theme
 
-    def add(self, widget, **kwargs):
+    def add(self, widget):
         """Add widget into container."""
         self.children.append(widget)
         widget.parent = self
-        widget.window = self.window if hasattr(self, 'window') else self
+        widget.window = self.window
         widget.set_theme(self.theme)
 
-    def set_theme(self, theme):
-        self.theme = theme
-        for child in self.children:
-            child.set_theme(theme)
-
     def draw(self, buffer, x=0, y=0):
         """Draw child widgets."""
         for child in self.children:
             child.draw(buffer,
                        x + child.x,
                        y + child.y)
+
+    def set_theme(self, theme):
+        Widget.set_theme(self, theme)
+        for child in self.children:
+            child.set_theme(theme)