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