tui/tmpl_view.go

28 lines
400 B
Go
Raw Permalink Normal View History

2021-01-10 21:52:29 +01:00
package tui
type ViewTmpl struct {
2022-05-04 14:16:08 +02:00
EventTmpl
2022-04-02 13:01:41 +02:00
style *Style
2021-01-10 21:52:29 +01:00
}
var _ View = &ViewTmpl{}
2022-04-01 20:10:51 +02:00
func (v *ViewTmpl) Draw(buf *ViewBuffer) {
2022-04-02 13:01:41 +02:00
buf.Fill(Rune{' ', v.Style()})
2021-01-10 21:52:29 +01:00
}
2022-04-02 13:01:41 +02:00
func (v *ViewTmpl) Layout() (prefWidth, prefHeight int) {
return -1, -1
2021-01-10 21:52:29 +01:00
}
2022-04-02 13:01:41 +02:00
func (v *ViewTmpl) SetStyle(s Style) {
v.style = &s
2021-01-10 21:52:29 +01:00
}
2022-04-02 13:01:41 +02:00
func (v *ViewTmpl) Style() Style {
if v.style == nil {
return StyleDefault
2022-04-01 20:10:51 +02:00
}
2022-04-02 13:01:41 +02:00
return *v.style
2021-01-10 21:52:29 +01:00
}