Set Nav styles while creating the Table

This commit is contained in:
aditya-K2
2023-04-19 08:54:41 +05:30
parent 9fe285e54a
commit 762c856574

View File

@@ -2,8 +2,8 @@ package ui
import (
"github.com/aditya-K2/gspt/spt"
"github.com/gdamore/tcell/v2"
"github.com/aditya-K2/tview"
"github.com/gdamore/tcell/v2"
)
type NavMenu struct {
@@ -20,6 +20,7 @@ type navItem struct {
func newNavMenu(m []navItem) *NavMenu {
T := tview.NewTable()
n := &NavMenu{&defView{}, T, m}
T.SetDrawFunc(func(tcell.Screen, int, int, int, int) (int, int, int, int) {
for k := range n.m {
T.SetCell(k, 0,
@@ -28,6 +29,10 @@ func newNavMenu(m []navItem) *NavMenu {
return T.GetInnerRect()
})
T.SetTitle("Library").SetTitleAlign(tview.AlignLeft)
T.SetBackgroundColor(tcell.ColorDefault)
T.SetBorder(true)
T.SetSelectable(true, false)
return n
}