func (l *Label) SetWordWrap(enabled bool) {
	l.wordWrap = enabled
}
SetWordWrap sets whether text content should be wrapped.
package tui
import (
	"image"
	"strings"
	wordwrap "github.com/mitchellh/go-wordwrap"
)
var _ Widget = &Label{}
type Label struct {
	WidgetBase
	text     string
	wordWrap bool
	cacheSizeHint *image.Point
	styleName string
}
func NewLabel(text string) *Label {
	return &Label{
		text: text,
	}
}
func (l *Label) Resize(size image.Point) {
	if l.Size() != size {
		l.cacheSizeHint = nil
	}
	l.WidgetBase.Resize(size)
}
func (l *Label) Draw(p *Painter) {
	lines := l.lines()
	style := "label"
	if l.styleName != "" {
		style += "." + l.styleName
	}
	p.WithStyle(style, func(p *Painter) {
		for i, line := range lines {
			p.DrawText(0, i, line)
		}
	})
}
func (l *Label) MinSizeHint() image.Point {
	return image.Point{1, 1}
}
func (l *Label) SizeHint() image.Point {
	if l.cacheSizeHint != nil {
		return *l.cacheSizeHint
	}
	var max int
	lines := l.lines()
	for _, line := range lines {
		if w := stringWidth(line); w > max {
			max = w
		}
	}
	sizeHint := image.Point{max, len(lines)}
	l.cacheSizeHint = &sizeHint
	return sizeHint
}
func (l *Label) lines() []string {
	txt := l.text
	if l.wordWrap {
		txt = wordwrap.WrapString(l.text, uint(l.Size().X))
	}
	return strings.Split(txt, "\n")
}
func (l *Label) Text() string {
	return l.text
}
func (l *Label) SetText(text string) {
	l.cacheSizeHint = nil
	l.text = text
}