/
textinput.go
39 lines (31 loc) · 1.03 KB
/
textinput.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package dos
import "github.com/gdamore/tcell/v2"
type TextInput struct {
Text string // User-entered content.
Placeholder string // Placeholder is visible when Text is empty.
IsHidden bool
HiddenChar rune
Scroll int // Number of runes skipped when viewing.
Width int // If Width is zero, then it is will be as wide as possible.
NormalStyle tcell.Style
FocusedStyle tcell.Style
PlaceholderStyle tcell.Style // If PlaceholderStyle is zero (or default style), then it inherits Normal/FocusedStyle.
OnTextEdited func(text string)
cursorPos int
focused bool
}
func (t *TextInput) HandleMouse(currentRect Rect, ev *tcell.EventMouse) bool {
panic("implement me")
}
func (t *TextInput) HandleKey(ev *tcell.EventKey) bool {
panic("implement me")
}
func (t *TextInput) SetFocused(b bool) {
t.focused = b
}
func (t *TextInput) DisplaySize(boundsW, boundsH int) (w, h int) {
panic("implement me")
}
func (t *TextInput) Draw(rect Rect, s tcell.Screen) {
panic("implement me")
}