package layout import ( "github.com/sirupsen/logrus" "github.com/BeatGlow/beatglow/app" ) type base struct { name string widgets []app.Widget visible bool } func (l *base) log() *logrus.Entry { return logrus.WithField("layout", l.name) } func (l *base) String() string { return l.name } func (l *base) Widgets() []app.Widget { return l.widgets } func (l *base) IsVisible() bool { return l.visible } func (l *base) Hide(ctx app.Context) { log := l.log() log.Debug("hide") for _, widget := range l.widgets { log.WithField("widget", widget.String()).Debug("hide widget") _ = widget.Hide(ctx) } l.visible = false } func (l *base) Show(ctx app.Context) { log := l.log() log.Debug("show") ctx.Display().Clear() for _, widget := range l.widgets { log.WithField("widget", widget.String()).Debug("show widget") _ = widget.Show(ctx) } l.visible = true }