diff --git a/layouts/layout_border.go b/layouts/layout_border.go index fb30e75..a5970b9 100644 --- a/layouts/layout_border.go +++ b/layouts/layout_border.go @@ -138,6 +138,10 @@ func (g *BorderLayout) Layout() (prefWidth, prefHeight int) { } func (g *BorderLayout) OnKeyPressed(event *tui.KeyEvent) (consumed bool) { + if g.KeyPressed != nil { + return g.KeyPressed(event) + } + for _, view := range g.Views() { if consumed := view.OnKeyPressed(event); consumed { return true @@ -147,6 +151,10 @@ func (g *BorderLayout) OnKeyPressed(event *tui.KeyEvent) (consumed bool) { } func (g *BorderLayout) OnMouseEvent(event *tui.MouseEvent) (consumed bool) { + if g.MouseEvent != nil { + return g.MouseEvent(event) + } + for slot, dim := range g.viewDims { if event.Position.In(dim) { g.views[slot].OnMouseEvent(event) diff --git a/layouts/layout_coord.go b/layouts/layout_coord.go index 4287ed7..5c5180f 100644 --- a/layouts/layout_coord.go +++ b/layouts/layout_coord.go @@ -41,6 +41,10 @@ func (v *CoordLayout) Layout() (prefWidth, prefHeight int) { } func (g *CoordLayout) OnKeyPressed(event *tui.KeyEvent) (consumed bool) { + if g.KeyPressed != nil { + return g.KeyPressed(event) + } + for _, view := range g.Views() { if view.OnKeyPressed(event) { return true diff --git a/layouts/layout_flow.go b/layouts/layout_flow.go index 79daf21..457b0b8 100644 --- a/layouts/layout_flow.go +++ b/layouts/layout_flow.go @@ -141,6 +141,10 @@ func (g *FlowLayout) Layout() (prefWidth, prefHeight int) { } func (g *FlowLayout) OnKeyPressed(event *tui.KeyEvent) (consumed bool) { + if g.KeyPressed != nil { + return g.KeyPressed(event) + } + for _, view := range g.Views() { if view.OnKeyPressed(event) { return true diff --git a/layouts/layout_separator.go b/layouts/layout_separator.go index babe18a..0991647 100644 --- a/layouts/layout_separator.go +++ b/layouts/layout_separator.go @@ -102,6 +102,10 @@ func (g *SeperatorLayout) Layout() (prefWidth, prefHeight int) { } func (g *SeperatorLayout) OnKeyPressed(event *tui.KeyEvent) (consumed bool) { + if g.KeyPressed != nil { + return g.KeyPressed(event) + } + for _, view := range g.Views() { if view.OnKeyPressed(event) { return true