func main() { window.model = &model{endx: 60, endy: 15} title := views.NewTextBar() title.SetStyle(tcell.StyleDefault. Background(tcell.ColorTeal). Foreground(tcell.ColorWhite)) title.SetCenter("CellView Test", tcell.StyleDefault) title.SetRight("Example v1.0", tcell.StyleDefault) window.keybar = views.NewSimpleStyledText() window.keybar.RegisterStyle('N', tcell.StyleDefault. Background(tcell.ColorSilver). Foreground(tcell.ColorBlack)) window.keybar.RegisterStyle('A', tcell.StyleDefault. Background(tcell.ColorSilver). Foreground(tcell.ColorRed)) window.keybar.SetMarkup("[%AQ%N] Quit") window.status = views.NewSimpleStyledTextBar() window.status.SetStyle(tcell.StyleDefault. Background(tcell.ColorBlue). Foreground(tcell.ColorYellow)) window.status.RegisterLeftStyle('N', tcell.StyleDefault. Background(tcell.ColorYellow). Foreground(tcell.ColorBlack)) window.status.SetLeft("My status is here.") window.status.SetRight("%UCellView%N demo!") window.status.SetCenter("Cen%ST%Ner") window.main = views.NewCellView() window.main.SetModel(window.model) window.main.SetStyle(tcell.StyleDefault. Background(tcell.ColorBlack)) window.SetMenu(window.keybar) window.SetTitle(title) window.SetContent(window.main) window.SetStatus(window.status) window.updateKeys() app.SetStyle(tcell.StyleDefault. Foreground(tcell.ColorWhite). Background(tcell.ColorBlack)) app.SetRootWidget(window) if e := app.Run(); e != nil { fmt.Fprintln(os.Stderr, e.Error()) os.Exit(1) } }
func NewMainPanel(app *App, server string) *MainPanel { m := &MainPanel{} m.Panel.Init(app) m.content = views.NewCellView() m.SetContent(m.content) m.content.SetModel(&mainModel{m}) m.content.SetStyle(StyleNormal) m.SetTitle(server) m.SetKeys([]string{"[Q] Quit"}) return m }