pelican/internal/ui/column.go

42 lines
800 B
Go
Raw Normal View History

package ui
import (
"github.com/gdamore/tcell/v2"
"github.com/rivo/tview"
)
type column struct {
statusID int
statusName string
cards *tview.List
}
func (a *App) newColumn(statusID int, statusName string) column {
l := tview.NewList()
l.SetBorder(true)
l.ShowSecondaryText(false)
l.SetTitle(" " + statusName + " ")
l.SetHighlightFullLine(true)
l.SetSelectedFocusOnly(true)
l.SetWrapAround(false)
l.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
if event.Rune() == 'h' || event.Key() == tcell.KeyLeft {
a.shiftColumnFocus(shiftLeft)
} else if event.Rune() == 'l' || event.Key() == tcell.KeyRight {
a.shiftColumnFocus(shiftRight)
}
return event
})
c := column{
statusID: statusID,
statusName: statusName,
cards: l,
}
return c
}