diff options
Diffstat (limited to 'find.go')
| -rw-r--r-- | find.go | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -57,6 +57,36 @@ func (tk *guiWidget) findByXYreal(w int, h int) []*guiWidget { return widgets } +// 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 + + r.w0 = tk.gocuiSize.w0 + r.w1 = tk.gocuiSize.w1 + r.h0 = tk.gocuiSize.h0 + r.h1 = tk.gocuiSize.h1 + + // search through the children widgets in the binary tree + for _, child := range tk.children { + cr := child.getFullSize() + if r.w0 > cr.w0 { + r.w0 = cr.w0 + } + if r.h0 > cr.h0 { + r.h0 = cr.h0 + } + if r.w1 < cr.w1 { + r.w1 = cr.w1 + } + if r.h1 < cr.h1 { + r.h1 = cr.h1 + } + } + + return r +} + // returns the "highest priority widget under the mouse func findUnderMouse() *guiWidget { w, h := me.baseGui.MousePosition() |
