summaryrefslogtreecommitdiff
path: root/layout.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-08-30 23:01:08 -0400
committerPietro Gagliardi <[email protected]>2014-08-30 23:01:08 -0400
commit155899c65ed32245e2ccad4197a10c77017d835b (patch)
tree4c337130ff5d1640efc1e94258ab3b8a9eef0c55 /layout.go
parent3d4e54822dc6117306d5a4ac0e79017c4810b657 (diff)
Out with the old...
Diffstat (limited to 'layout.go')
-rw-r--r--layout.go36
1 files changed, 0 insertions, 36 deletions
diff --git a/layout.go b/layout.go
deleted file mode 100644
index e88cae4..0000000
--- a/layout.go
+++ /dev/null
@@ -1,36 +0,0 @@
-package ui
-
-// Recursively replaces nils with stretchy empty spaces and changes the orientation
-// of inner stack so they are perpenticular to each other.
-func resetControls(parent *Stack) {
- for i, control := range parent.controls {
- switch control.(type) {
- case *Stack:
- stack := control.(*Stack)
- stack.orientation = !parent.orientation
- resetControls(stack)
- case nil:
- emptySpace := newStack(horizontal)
- parent.controls[i] = emptySpace
- parent.stretchy[i] = true
- }
- }
-}
-
-// Creates a new Stack from the given controls. The topmost Stack will have
-// vertical orientation and margin borders, with each nested stack being
-// oriented oppositely. Controls are displayed with a default padding
-// between them.
-func Layout(controls ...Control) *Stack {
- stack := &Stack{
- orientation: vertical,
- controls: controls,
- stretchy: make([]bool, len(controls)),
- width: make([]int, len(controls)),
- height: make([]int, len(controls)),
- }
-
- resetControls(stack)
-
- return stack
-}