tins2020/content.go

37 lines
755 B
Go

package tins2020
import (
"opslag.de/schobers/zntg/ui"
)
// import "github.com/veandco/go-sdl2/sdl"
// Content shortcuts events when a dialog is opened.
type Content struct {
ui.Proxy
content ui.ContainerBase
shortcut bool
}
func NewContent(dialogs *Dialogs) *Content {
content := &Content{}
content.Proxy.Content = &content.content
dialogs.DialogOpened().AddHandlerEmpty(func(ui.Context) {
content.shortcut = true
})
dialogs.DialogClosed().AddHandlerEmpty(func(ui.Context) {
content.shortcut = false
})
return content
}
func (c *Content) AddChild(child ui.Control) { c.content.AddChild(child) }
func (c *Content) Handle(ctx ui.Context, event ui.Event) bool {
if c.shortcut {
return false
}
return c.Proxy.Handle(ctx, event)
}