tins2020/content.go

37 lines
755 B
Go
Raw Normal View History

package tins2020
2020-05-17 08:56:56 +00:00
import (
"opslag.de/schobers/zntg/ui"
)
// import "github.com/veandco/go-sdl2/sdl"
// Content shortcuts events when a dialog is opened.
type Content struct {
2020-05-17 08:56:56 +00:00
ui.Proxy
2020-05-17 08:56:56 +00:00
content ui.ContainerBase
shortcut bool
}
func NewContent(dialogs *Dialogs) *Content {
content := &Content{}
2020-05-17 08:56:56 +00:00
content.Proxy.Content = &content.content
dialogs.DialogOpened().AddHandlerEmpty(func(ui.Context) {
content.shortcut = true
})
2020-05-17 08:56:56 +00:00
dialogs.DialogClosed().AddHandlerEmpty(func(ui.Context) {
content.shortcut = false
})
return content
}
2020-05-17 08:56:56 +00:00
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
}
2020-05-17 08:56:56 +00:00
return c.Proxy.Handle(ctx, event)
}