diff options
| author | Jeff Carr <[email protected]> | 2025-02-05 11:08:15 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-02-05 11:08:15 -0600 |
| commit | 38a08d66fc8b49a33c749c6baeb7cd2860630c73 (patch) | |
| tree | 9e00728d46d0e7b2ef93ad1bf75d05d331b765a0 | |
| parent | fb8d1d0940747e647fe48856d5a558ba333d8e90 (diff) | |
closer
| -rw-r--r-- | find.go | 40 |
1 files changed, 40 insertions, 0 deletions
@@ -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 |
