summaryrefslogtreecommitdiff
path: root/prevlib/layout.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-07-02 22:53:03 -0400
committerPietro Gagliardi <[email protected]>2014-07-02 22:53:03 -0400
commit8a81650b3da7ce00725336df9e03b38e935c5a65 (patch)
tree08af843f0460e7226f305cf7162021ef54e8c3f7 /prevlib/layout.go
parent4dd5ceb11d62bd6b9af4847936314a9d8c45707f (diff)
Moved it all back; the preemptive multitaksing during an event handler kills us on all platforms. Going to have to restrict ALL GUI accss to happening from one t hread, so going to need to drop uitask entirely and have just a start() callback for startup code and a post() function for posting requests to windows (like channel sends but into a perpetual buffer).
Diffstat (limited to 'prevlib/layout.go')
-rw-r--r--prevlib/layout.go36
1 files changed, 0 insertions, 36 deletions
diff --git a/prevlib/layout.go b/prevlib/layout.go
deleted file mode 100644
index e88cae4..0000000
--- a/prevlib/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
-}