To do this, MENU and SUBMENU are split into two types (at last), and a Widget type is introduced. This should allow lots of code to be removed at some point.
74 lines
1.2 KiB
Go
74 lines
1.2 KiB
Go
package ui
|
|
|
|
type Widget struct {
|
|
Locator string
|
|
Children []*Widget
|
|
|
|
ownClickables []clickable
|
|
ownFreezables []freezable
|
|
ownHoverables []hoverable
|
|
ownMouseables []mouseable
|
|
ownPaintables []paintable
|
|
ownValueables []valueable
|
|
}
|
|
|
|
func (w *Widget) clickables() []clickable {
|
|
out := w.ownClickables
|
|
|
|
for _, widget := range w.Children {
|
|
out = append(out, widget.clickables()...)
|
|
}
|
|
|
|
return out
|
|
}
|
|
|
|
func (w *Widget) freezables() []freezable {
|
|
out := w.ownFreezables
|
|
|
|
for _, widget := range w.Children {
|
|
out = append(out, widget.freezables()...)
|
|
}
|
|
|
|
return out
|
|
}
|
|
|
|
func (w *Widget) hoverables() []hoverable {
|
|
out := w.ownHoverables
|
|
|
|
for _, widget := range w.Children {
|
|
out = append(out, widget.hoverables()...)
|
|
}
|
|
|
|
return out
|
|
}
|
|
|
|
func (w *Widget) mouseables() []mouseable {
|
|
out := w.ownMouseables
|
|
|
|
for _, widget := range w.Children {
|
|
out = append(out, widget.mouseables()...)
|
|
}
|
|
|
|
return out
|
|
}
|
|
|
|
func (w *Widget) paintables() []paintable {
|
|
out := w.ownPaintables
|
|
|
|
for _, widget := range w.Children {
|
|
out = append(out, widget.paintables()...)
|
|
}
|
|
|
|
return out
|
|
}
|
|
|
|
func (w *Widget) valueables() []valueable {
|
|
out := w.ownValueables
|
|
|
|
for _, widget := range w.Children {
|
|
out = append(out, widget.valueables()...)
|
|
}
|
|
|
|
return out
|
|
}
|