package ui type Widget struct { Locator string Children []*Widget Active bool ownClickables []clickable ownFreezables []freezable ownHoverables []hoverable ownMouseables []mouseable ownPaintables []paintable ownValueables []valueable } func (w *Widget) allClickables() []clickable { out := w.ownClickables for _, widget := range w.Children { out = append(out, widget.allClickables()...) } return out } func (w *Widget) allFreezables() []freezable { out := w.ownFreezables for _, widget := range w.Children { out = append(out, widget.allFreezables()...) } return out } func (w *Widget) allValueables() []valueable { out := w.ownValueables for _, widget := range w.Children { out = append(out, widget.allValueables()...) } return out } func (w *Widget) activeClickables() []clickable { if !w.Active { return nil } out := w.ownClickables for _, widget := range w.Children { out = append(out, widget.activeClickables()...) } return out } func (w *Widget) activeFreezables() []freezable { if !w.Active { return nil } out := w.ownFreezables for _, widget := range w.Children { out = append(out, widget.activeFreezables()...) } return out } func (w *Widget) activeHoverables() []hoverable { if !w.Active { return nil } out := w.ownHoverables for _, widget := range w.Children { out = append(out, widget.activeHoverables()...) } return out } func (w *Widget) activeMouseables() []mouseable { if !w.Active { return nil } out := w.ownMouseables for _, widget := range w.Children { out = append(out, widget.activeMouseables()...) } return out } func (w *Widget) activePaintables() []paintable { if !w.Active { return nil } out := w.ownPaintables for _, widget := range w.Children { out = append(out, widget.activePaintables()...) } return out } func (w *Widget) activeValueables() []valueable { if !w.Active { return nil } out := w.ownValueables for _, widget := range w.Children { out = append(out, widget.activeValueables()...) } return out } func (w *Widget) findWidget(locator string) *Widget { if w.Locator == locator { return w } for _, child := range w.Children { if found := child.findWidget(locator); found != nil { return found } } return nil }