summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--find.go40
1 files changed, 40 insertions, 0 deletions
diff --git a/find.go b/find.go
index 666e11b..d423151 100644
--- a/find.go
+++ b/find.go
@@ -105,11 +105,51 @@ func (tk *guiWidget) setFullSize() bool {
return changed
}
+func (tk *guiWidget) gridFullSize() rectType {
+ var r rectType
+ var first bool = true
+ for _, child := range tk.children {
+ cr := child.getFullSize()
+ if cr.Width() == 0 && cr.Height() == 0 {
+ // ignore widgets of zero size?
+ continue
+ }
+ if first {
+ // use the lowest width and hight from children widgets
+ r.w0 = cr.w0
+ r.h0 = cr.h0
+ r.w1 = cr.w1
+ r.h1 = cr.h1
+ first = false
+ continue
+ }
+ // use the lowest width and hight from children widgets
+ if r.w0 > cr.w0 {
+ r.w0 = cr.w0
+ }
+ if r.h0 > cr.h0 {
+ r.h0 = cr.h0
+ }
+ // use the highest width and hight from children widgets
+ if r.w1 < cr.w1 {
+ r.w1 = cr.w1
+ }
+ if r.h1 < cr.h1 {
+ r.h1 = cr.h1
+ }
+ }
+ return r
+}
+
// this checks a widget to see if it is under (W,H), then checks the widget's children
// anything that matches is passed back as an array of widgets
func (tk *guiWidget) getFullSize() rectType {
var r rectType
+ if tk.node.WidgetType == widget.Grid {
+ return tk.gridFullSize()
+ }
+
if tk.v == nil {
r.w0 = tk.full.w0
r.w1 = tk.full.w1