github.com/egonelbre/exp@v0.0.0-20240430123955-ed1d3aa93911/dos/ui/label.go (about) 1 package ui 2 3 type Label struct { 4 Caption string 5 } 6 7 func (label *Label) Focusable() bool { return false } 8 func (label *Label) Handle(form *Form, action Action) {} 9 10 func (label *Label) Unserialize(data []byte) error { 11 label.Caption = string(data) 12 return nil 13 } 14 func (label *Label) Serialize() ([]byte, error) { 15 return []byte(label.Caption), nil 16 } 17 18 func (label *Label) Render(form *Form, component *Component) { 19 form.DrawText(component.Rect, label.Caption, false) 20 }