summaryrefslogtreecommitdiff
path: root/find.go
diff options
context:
space:
mode:
Diffstat (limited to 'find.go')
-rw-r--r--find.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/find.go b/find.go
index f97a493..b8f4d4c 100644
--- a/find.go
+++ b/find.go
@@ -27,30 +27,31 @@ func findByXY(w int, h int) []*guiWidget {
rootW := me.treeRoot.TK.(*guiWidget)
// this searches the binary tree recursively (function is right below)
- return findByXYreal(rootW, w, h)
+ return rootW.findByXYreal(w, h)
}
// 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 findByXYreal(widget *guiWidget, w int, h int) []*guiWidget {
+func (tk *guiWidget) findByXYreal(w int, h int) []*guiWidget {
var widgets []*guiWidget
- if !widget.Visible() {
+ if !tk.Visible() {
// ignore widgets that are not visible
} else {
// check the location to see if this is under (W,H)
// if it is, return this widget
- if (widget.gocuiSize.w0 <= w) && (w <= widget.gocuiSize.w1) &&
- (widget.gocuiSize.h0 <= h) && (h <= widget.gocuiSize.h1) {
- widgets = append(widgets, widget)
+ if (tk.gocuiSize.w0 <= w) && (w <= tk.gocuiSize.w1) &&
+ (tk.gocuiSize.h0 <= h) && (h <= tk.gocuiSize.h1) {
+ widgets = append(widgets, tk)
// log.Log(GOCUI, "findByXY() found", widget.node.WidgetType, w, h)
}
}
+ tk.verifyRect()
// search through the children widgets in the binary tree
- for _, child := range widget.children {
- widgets = append(widgets, findByXYreal(child, w, h)...)
+ for _, child := range tk.children {
+ widgets = append(widgets, child.findByXYreal(w, h)...)
}
return widgets