Add TextView, improved Scrollbar

This commit is contained in:
2023-09-15 16:11:59 -04:00
parent e45e391f6d
commit 02551987a4
4 changed files with 63 additions and 5 deletions

View File

@@ -20,6 +20,7 @@ type TextInput struct {
func NewTextInput (text string) *TextInput {
this := &TextInput { TextBox: tomo.NewTextBox() }
theme.Apply(this, theme.R("objects", "TextInput", ""))
this.SetAlign(tomo.AlignStart, tomo.AlignMiddle)
this.SetText(text)
this.SetFocusable(true)
this.SetSelectable(true)
@@ -53,6 +54,9 @@ func (this *TextInput) handleKeyDown (key input.Key, numpad bool) {
sel := modifiers.Shift
changed := false
// TODO all this (except editing stuff) really should be moved into the
// backend
switch {
case key == input.KeyEnter:
this.on.enter.Broadcast()