1
0
mirror of https://github.com/rivo/tview.git synced 2025-04-30 13:48:50 +08:00

Added navigation instructions to presentation demo. Resolves #14, resolves #10

This commit is contained in:
Oliver 2018-01-12 08:19:32 +01:00
parent 7dd0754cc6
commit 967b863aac

View File

@ -17,7 +17,10 @@ const logo = `
` `
const subtitle = `tview - Rich Widgets for Terminal UIs` const (
subtitle = `tview - Rich Widgets for Terminal UIs`
navigation = `Ctrl-N: Next slide Ctrl-P: Previous slide`
)
// Cover returns the cover page. // Cover returns the cover page.
func Cover(nextSlide func()) (title string, content tview.Primitive) { func Cover(nextSlide func()) (title string, content tview.Primitive) {
@ -37,10 +40,12 @@ func Cover(nextSlide func()) (title string, content tview.Primitive) {
}) })
fmt.Fprint(logoBox, logo) fmt.Fprint(logoBox, logo)
// Create a frame for the subtitle. // Create a frame for the subtitle and navigation infos.
frame := tview.NewFrame(tview.NewBox()). frame := tview.NewFrame(tview.NewBox()).
SetBorders(0, 0, 0, 0, 0, 0). SetBorders(0, 0, 0, 0, 0, 0).
AddText(subtitle, true, tview.AlignCenter, tcell.ColorWhite) AddText(subtitle, true, tview.AlignCenter, tcell.ColorWhite).
AddText("", true, tview.AlignCenter, tcell.ColorWhite).
AddText(navigation, true, tview.AlignCenter, tcell.ColorBlue)
// Create a Flex layout that centers the logo and subtitle. // Create a Flex layout that centers the logo and subtitle.
flex := tview.NewFlex(). flex := tview.NewFlex().