tui/views/eventview.go
2022-04-01 20:10:51 +02:00

28 lines
500 B
Go

package views
import (
"git.tordarus.net/Tordarus/tui"
)
type EventView struct {
tui.WrapperTmpl
View tui.View
KeyPressed func(event *tui.KeyEvent) (consumed bool)
}
func NewEventView(view tui.View) *EventView {
return &EventView{View: view}
}
func (v *EventView) OnKeyPressed(event *tui.KeyEvent) (consumed bool) {
if v.KeyPressed != nil {
return v.KeyPressed(event)
}
return v.ViewTmpl.OnKeyPressed(event)
}
func (v *EventView) Draw(buf *tui.ViewBuffer) {
v.View.Draw(buf)
}