summaryrefslogtreecommitdiff
path: root/stack.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-02-24 11:19:57 -0500
committerPietro Gagliardi <[email protected]>2014-02-24 11:19:57 -0500
commitf839192c8ff6d9805c2b63972467fdaa0bc4d3be (patch)
tree302c3c63c43402552d63f3e420f6222cdc8b1d0b /stack.go
parent8bf2b5cc76cf4904e844f6d10ff1bafd65e762db (diff)
Made sure Stack.SetStretchy() (like all other layout-changing functions) cannot be called once the parent Window has been opened.
Diffstat (limited to 'stack.go')
-rw-r--r--stack.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/stack.go b/stack.go
index b146c01..fd3a61a 100644
--- a/stack.go
+++ b/stack.go
@@ -37,11 +37,14 @@ func NewStack(o Orientation, controls ...Control) *Stack {
}
}
-// SetStretchy marks a control in a Stack as stretchy.
+// SetStretchy marks a control in a Stack as stretchy. This cannot be called once the Window containing the Stack has been opened.
func (s *Stack) SetStretchy(index int) {
s.lock.Lock()
defer s.lock.Unlock()
+ if s.created {
+ panic("call to Stack.SetStretchy() after Stack has been created")
+ }
s.stretchy[index] = true // TODO explicitly check for index out of bounds?
}