package objects import "image" import "git.tebibyte.media/tomo/tomo" // TextView is an area for displaying a large amount of multi-line text. type TextView struct { tomo.TextBox } // NewTextView creates a new text view. func NewTextView (text string) *TextView { this := &TextView { TextBox: tomo.NewTextBox() } this.SetRole(tomo.R("objects", "TextView", "")) tomo.Apply(this) this.SetFocusable(true) this.SetSelectable(true) this.SetText(text) this.SetOverflow(false, true) this.SetWrap(true) this.OnScroll(this.handleScroll) return this } func (this *TextView) handleScroll (x, y float64) { this.ScrollTo(this.ContentBounds().Min.Add(image.Pt(int(x), int(y)))) }