tuikit/layout.py
changeset 9 7175ed629a76
parent 5 ae128c885d0f
child 15 c55b4749e562
--- a/tuikit/layout.py	Wed Apr 13 13:07:26 2011 +0200
+++ b/tuikit/layout.py	Sun Jul 31 13:04:39 2011 +0200
@@ -18,6 +18,8 @@
         v = 0
         c = self.container
         bl, bt, br, bb = c.borders
+
+        last = None
         for child in c.children:
             if not child.allowlayout:
                 continue
@@ -26,6 +28,29 @@
             child.y = bt + v
             v += child.height
             child.handle('resize')
+            last = child
+
+        if last and v < c.height - bt - bb:
+            last.height += c.height - bt - bb - v
+
+        c.redraw()
+
+
+class HorizontalLayout:
+    def resize(self):
+        v = 0
+        c = self.container
+        bl, bt, br, bb = c.borders
+
+        for child in c.children:
+            if not child.allowlayout:
+                continue
+            child.y = bt
+            child.height = c.height - bt - bb
+            child.x = bl + v
+            v += child.width
+            child.handle('resize')
+
         c.redraw()