--- a/tuikit/container.py Thu Sep 08 10:13:55 2011 +0200
+++ b/tuikit/container.py Thu Sep 08 11:37:27 2011 +0200
@@ -3,14 +3,24 @@
from .widget import Widget
import logging
+
class Container(Widget):
+
+ '''Container widget. Base for any widget which can contain other widgets.'''
+
def __init__(self, width = 10, height = 10):
+ '''Create container of requested size.'''
Widget.__init__(self, width, height)
+ #: List of child widgets.
self.children = []
+
self.mousechild = None
- self.borders = (0, 0, 0, 0) # left, top, right, bottom
+ #: Width of borders (left, top, right, bottom).
+ #: Child widgets are placed within borders.
+ self.borders = (0, 0, 0, 0)
+
self.widthrequest = (None, None)
self.heightrequest = (None, None)
@@ -20,6 +30,7 @@
def add(self, widget, **kw):
+ '''Add widget into this container.'''
self.children.append(widget)
widget.parent = self
widget.settop(self.top)
@@ -27,12 +38,14 @@
def layout(self, layout):
+ '''Set layout manager for placing child widgets.'''
self.layout = layout
layout.container = self
self.connect('resize', layout.resize)
def settop(self, top):
+ '''Set top widget.'''
self.top = top
for child in self.children:
child.settop(top)