Commits

Henning Schröder committed 6d6a260

started working on layouts

Comments (0)

Files changed (1)

+from tcore import dispatch, TObject
+from tgui import TWidget
+
+
+class TLayout(TObject):
+
+    def __init__(self, parent=None):
+        TObject.__init__(parent)
+        self.parent = parent
+        self.items = []
+
+    @dispatch(TWidget)
+    def addWidget(self, widget):
+        self.items.append(widget)
+
+    def addLayout(self, layout):
+        assert isinstance(layout, TLayout)
+        self.items.append(layout)
+
+    def add(self, item):
+        if isinstance(item, TWidget):
+            self.addWidget(item)
+        else:
+            self.addLayout(item)
+
+    def calculate(self):
+        pass
+
+
+class TBoxLayout(TLayout):
+    pass
+
+
+class TVBoxLayout(TBoxLayout):
+    pass
+
+
+class THBoxLayout(TBoxLayout):
+    pass