Allow dialogues to be hidden or shown

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.
This commit is contained in:
2020-04-14 03:14:49 +01:00
parent dc131939f4
commit 786d261f98
18 changed files with 1034 additions and 847 deletions

73
internal/ui/widget.go Normal file
View File

@@ -0,0 +1,73 @@
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
}