summaryrefslogtreecommitdiff
path: root/stack.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-03-09 19:44:41 -0400
committerPietro Gagliardi <[email protected]>2014-03-09 19:44:41 -0400
commitce571bad52589008b8efe6cc0a6e3f76c7f88856 (patch)
treeee797fc408071f929d1a53ae52ba39595d3aab8a /stack.go
parentab11900d43b02ab2c01f5963b3cfaf8b623ebd58 (diff)
Removed error returns from Control.preferredSize() since errors are not going to be returned anymore.
Diffstat (limited to 'stack.go')
-rw-r--r--stack.go14
1 files changed, 4 insertions, 10 deletions
diff --git a/stack.go b/stack.go
index cfaf510..cb65bb5 100644
--- a/stack.go
+++ b/stack.go
@@ -91,10 +91,7 @@ func (s *Stack) setRect(x int, y int, width int, height int, winheight int) erro
nStretchy++
continue
}
- w, h, err := c.preferredSize()
- if err != nil {
- return fmt.Errorf("error getting preferred size of control %d in Stack.setRect(): %v", i, err)
- }
+ w, h := c.preferredSize()
if s.orientation == horizontal { // all controls have same height
s.width[i] = w
s.height[i] = height
@@ -136,7 +133,7 @@ func (s *Stack) setRect(x int, y int, width int, height int, winheight int) erro
}
// The preferred size of a Stack is the sum of the preferred sizes of non-stretchy controls + (the number of stretchy controls * the largest preferred size among all stretchy controls).
-func (s *Stack) preferredSize() (width int, height int, err error) {
+func (s *Stack) preferredSize() (width int, height int) {
s.lock.Lock()
defer s.lock.Unlock()
@@ -151,13 +148,10 @@ func (s *Stack) preferredSize() (width int, height int, err error) {
var maxswid, maxsht int
if len(s.controls) == 0 { // no controls, so return emptiness
- return 0, 0, nil
+ return 0, 0
}
for i, c := range s.controls {
- w, h, err := c.preferredSize()
- if err != nil {
- return 0, 0, fmt.Errorf("error getting preferred size of control %d in Stack.preferredSize(): %v", i, err)
- }
+ w, h := c.preferredSize()
if s.stretchy[i] {
nStretchy++
maxswid = max(maxswid, w)