So much work
This commit is contained in:
45
list.go
45
list.go
@@ -33,6 +33,7 @@ type List struct {
|
||||
active bool
|
||||
visible bool
|
||||
focusable bool
|
||||
tabbable bool
|
||||
|
||||
x, y int
|
||||
w, h int
|
||||
@@ -83,6 +84,7 @@ func (w *List) Init(id string, style tcell.Style) {
|
||||
return false
|
||||
})
|
||||
w.itemsStyle = make(map[int]tcell.Style)
|
||||
w.tabbable = true
|
||||
}
|
||||
func (w *List) Id() string { return w.id }
|
||||
func (w *List) HandleResize(ev *tcell.EventResize) {}
|
||||
@@ -128,21 +130,24 @@ func (w *List) Draw(screen tcell.Screen) {
|
||||
y += 1
|
||||
}
|
||||
}
|
||||
func (w *List) Active() bool { return w.active }
|
||||
func (w *List) SetActive(a bool) { w.active = a }
|
||||
func (w *List) Visible() bool { return w.visible }
|
||||
func (w *List) SetVisible(a bool) { w.visible = a }
|
||||
func (w *List) SetX(x int) { w.x = x }
|
||||
func (w *List) SetY(y int) { w.y = y }
|
||||
func (w *List) GetX() int { return w.x }
|
||||
func (w *List) GetY() int { return w.y }
|
||||
func (w *List) SetPos(c Coord) { w.x, w.y = c.X, c.Y }
|
||||
func (w *List) SetW(x int) { w.w = x }
|
||||
func (w *List) SetH(y int) { w.h = y }
|
||||
func (w *List) GetW() int { return w.w }
|
||||
func (w *List) GetH() int { return w.y }
|
||||
func (w *List) SetSize(c Coord) { w.w, w.h = c.X, c.Y }
|
||||
func (w *List) Focusable() bool { return w.focusable }
|
||||
func (w *List) Active() bool { return w.active }
|
||||
func (w *List) SetActive(a bool) { w.active = a }
|
||||
func (w *List) Visible() bool { return w.visible }
|
||||
func (w *List) SetVisible(a bool) { w.visible = a }
|
||||
func (w *List) SetX(x int) { w.x = x }
|
||||
func (w *List) SetY(y int) { w.y = y }
|
||||
func (w *List) GetX() int { return w.x }
|
||||
func (w *List) GetY() int { return w.y }
|
||||
func (w *List) GetPos() Coord { return Coord{X: w.x, Y: w.y} }
|
||||
func (w *List) SetPos(c Coord) { w.x, w.y = c.X, c.Y }
|
||||
func (w *List) SetW(x int) { w.w = x }
|
||||
func (w *List) SetH(y int) { w.h = y }
|
||||
func (w *List) GetW() int { return w.w }
|
||||
func (w *List) GetH() int { return w.y }
|
||||
func (w *List) SetSize(c Coord) { w.w, w.h = c.X, c.Y }
|
||||
func (w *List) Focusable() bool { return w.focusable }
|
||||
func (w *List) SetTabbable(b bool) { w.tabbable = b }
|
||||
func (w *List) Tabbable() bool { return w.tabbable }
|
||||
func (w *List) WantW() int {
|
||||
lng := h.Longest(w.list)
|
||||
if len(w.border) > 0 {
|
||||
@@ -159,6 +164,16 @@ func (w *List) WantH() int {
|
||||
return lng
|
||||
}
|
||||
|
||||
func (w *List) MinW() int {
|
||||
lng := h.Longest(w.list)
|
||||
if lng > 80 {
|
||||
lng = 80
|
||||
}
|
||||
return 2 + lng
|
||||
}
|
||||
|
||||
func (w *List) MinH() int { return 4 }
|
||||
|
||||
func (w *List) SetFocusable(f bool) { w.focusable = f }
|
||||
|
||||
func (w *List) SetCursorWrap(b bool) { w.cursorWrap = b }
|
||||
|
||||
Reference in New Issue
Block a user