So much work
This commit is contained in:
52
chat.go
52
chat.go
@@ -33,10 +33,11 @@ type Chat struct {
|
||||
id string
|
||||
style tcell.Style
|
||||
|
||||
x, y int
|
||||
w, h int
|
||||
active bool
|
||||
visible bool
|
||||
x, y int
|
||||
w, h int
|
||||
active bool
|
||||
visible bool
|
||||
tabbable bool
|
||||
|
||||
title string
|
||||
rawLog []string
|
||||
@@ -62,10 +63,12 @@ func (w *Chat) Init(id string, s tcell.Style) {
|
||||
w.id, w.style = id, s
|
||||
w.visible = true
|
||||
w.initKeyMap()
|
||||
w.tabbable = true
|
||||
}
|
||||
|
||||
func (w *Chat) Id() string { return w.id }
|
||||
func (w *Chat) HandleResize(ev *tcell.EventResize) {}
|
||||
func (w *Chat) HandleResize(ev *tcell.EventResize) { w.w, w.h = ev.Size() }
|
||||
|
||||
func (w *Chat) HandleKey(ev *tcell.EventKey) bool {
|
||||
if !w.active {
|
||||
return false
|
||||
@@ -147,23 +150,28 @@ func (w *Chat) Draw(screen tcell.Screen) {
|
||||
// x += len(post) - 1
|
||||
}
|
||||
|
||||
func (w *Chat) Active() bool { return w.active }
|
||||
func (w *Chat) SetActive(a bool) { w.active = a }
|
||||
func (w *Chat) Visible() bool { return w.visible }
|
||||
func (w *Chat) SetVisible(a bool) { w.visible = a }
|
||||
func (w *Chat) Focusable() bool { return true }
|
||||
func (w *Chat) SetX(x int) { w.x = x }
|
||||
func (w *Chat) SetY(y int) { w.y = y }
|
||||
func (w *Chat) GetX() int { return w.x }
|
||||
func (w *Chat) GetY() int { return w.y }
|
||||
func (w *Chat) SetPos(c Coord) { w.x, w.y = c.X, c.Y }
|
||||
func (w *Chat) GetW() int { return w.w }
|
||||
func (w *Chat) GetH() int { return w.h }
|
||||
func (w *Chat) SetW(wd int) { w.w = wd }
|
||||
func (w *Chat) SetH(h int) { w.h = h }
|
||||
func (w *Chat) SetSize(c Coord) { w.w, w.h = c.X, c.Y }
|
||||
func (w *Chat) WantW() int { return w.w }
|
||||
func (w *Chat) WantH() int { return w.h }
|
||||
func (w *Chat) Active() bool { return w.active }
|
||||
func (w *Chat) SetActive(a bool) { w.active = a }
|
||||
func (w *Chat) Visible() bool { return w.visible }
|
||||
func (w *Chat) SetVisible(a bool) { w.visible = a }
|
||||
func (w *Chat) Focusable() bool { return true }
|
||||
func (w *Chat) SetTabbable(b bool) { w.tabbable = b }
|
||||
func (w *Chat) Tabbable() bool { return w.tabbable }
|
||||
func (w *Chat) SetX(x int) { w.x = x }
|
||||
func (w *Chat) SetY(y int) { w.y = y }
|
||||
func (w *Chat) GetX() int { return w.x }
|
||||
func (w *Chat) GetY() int { return w.y }
|
||||
func (w *Chat) GetPos() Coord { return Coord{X: w.x, Y: w.y} }
|
||||
func (w *Chat) SetPos(c Coord) { w.x, w.y = c.X, c.Y }
|
||||
func (w *Chat) GetW() int { return w.w }
|
||||
func (w *Chat) GetH() int { return w.h }
|
||||
func (w *Chat) SetW(wd int) { w.w = wd }
|
||||
func (w *Chat) SetH(h int) { w.h = h }
|
||||
func (w *Chat) SetSize(c Coord) { w.w, w.h = c.X, c.Y }
|
||||
func (w *Chat) WantW() int { return w.w }
|
||||
func (w *Chat) WantH() int { return w.h }
|
||||
func (w *Chat) MinW() int { return 2 + 20 }
|
||||
func (w *Chat) MinH() int { return 6 }
|
||||
|
||||
func (w *Chat) initKeyMap() {
|
||||
w.keyMap = NewKeyMap(map[tcell.Key]func(ev *tcell.EventKey) bool{
|
||||
|
||||
Reference in New Issue
Block a user