diff options
| author | Jeff Carr <[email protected]> | 2025-02-04 14:27:32 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-02-04 14:27:32 -0600 |
| commit | bf8cbddf1ac6b65c1a77dae0b7ccd910a9e96a3d (patch) | |
| tree | bda3af3732978d0441ea46b91145fa0af85b0d09 /find.go | |
| parent | 4e5c6f25156318e7c05b847eca12bf200ce3dcf6 (diff) | |
add findWindows()
Diffstat (limited to 'find.go')
| -rw-r--r-- | find.go | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -58,6 +58,26 @@ func (tk *guiWidget) findByXYreal(w int, h int) []*guiWidget { return widgets } +// returns all the windows from the root of the binary tree +func findWindows() []*guiWidget { + rootW := me.treeRoot.TK.(*guiWidget) + return rootW.findWindows() +} + +// walk the binary tree looking for WidgetType == Window +func (tk *guiWidget) findWindows() []*guiWidget { + var found []*guiWidget + + if tk.node.WidgetType == widget.Window { + found = append(found, tk) + } + + for _, child := range tk.children { + found = append(found, child.findWindows()...) + } + return found +} + func (tk *guiWidget) setFullSize() rectType { r := tk.getFullSize() |
