package tui type Events interface { // OnKeyPressed is called every time a key or key-combination is pressed. // If OnKeyPressed returns true, the event will not be passed onto child views OnKeyPressed(event *KeyEvent) (consumed bool) // OnMouseEvent is called every time the mouse was used in any way. // That includes mouse movement, button presses and scroll wheel usage // If OnMouseClicked returns true, the event will not be passed onto child views OnMouseEvent(event *MouseEvent) (consumed bool) } type EventTmpl struct { KeyPressed func(event *KeyEvent) (consumed bool) MouseEvent func(event *MouseEvent) (consumed bool) } var _ Events = &EventTmpl{} func (e *EventTmpl) OnKeyPressed(event *KeyEvent) (consumed bool) { if e.KeyPressed == nil { return false } return e.KeyPressed(event) } func (e *EventTmpl) OnMouseEvent(event *MouseEvent) (consumed bool) { if e.MouseEvent == nil { return false } return e.MouseEvent(event) }