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

45 lines
795 B
Go

package tui
import "github.com/gdamore/tcell"
type ViewTmpl struct {
foreground *Color
background *Color
}
var _ View = &ViewTmpl{}
func (v *ViewTmpl) Draw(buf *ViewBuffer) {
buf.Fill(DefaultRune)
}
func (v *ViewTmpl) OnKeyPressed(event *KeyEvent) (consumed bool) {
return false
}
func (v *ViewTmpl) Style() Style {
return StyleDefault.Background(v.Background()).Foreground(v.Foreground())
}
func (v *ViewTmpl) Foreground() Color {
if v.foreground == nil {
return tcell.ColorDefault
}
return *v.foreground
}
func (v *ViewTmpl) SetForeground(color Color) {
v.foreground = &color
}
func (v *ViewTmpl) Background() Color {
if v.background == nil {
return tcell.ColorDefault
}
return *v.background
}
func (v *ViewTmpl) SetBackground(color Color) {
v.background = &color
}