forked from tslocum/cview
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
896 B
31 lines
896 B
package main |
|
|
|
import ( |
|
"github.com/gdamore/tcell" |
|
"git.sr.ht/~tslocum/cview" |
|
) |
|
|
|
const helloWorld = `[green]package[white] main |
|
|
|
[green]import[white] ( |
|
[red]"git.sr.ht/~tslocum/cview"[white] |
|
) |
|
|
|
[green]func[white] [yellow]main[white]() { |
|
box := cview.[yellow]NewBox[white](). |
|
[yellow]SetBorder[white](true). |
|
[yellow]SetTitle[white]([red]"Hello, world!"[white]) |
|
cview.[yellow]NewApplication[white](). |
|
[yellow]SetRoot[white](box, true). |
|
[yellow]Run[white]() |
|
}` |
|
|
|
// HelloWorld shows a simple "Hello world" example. |
|
func HelloWorld(nextSlide func()) (title string, content cview.Primitive) { |
|
// We use a text view because we want to capture keyboard input. |
|
textView := cview.NewTextView().SetDoneFunc(func(key tcell.Key) { |
|
nextSlide() |
|
}) |
|
textView.SetBorder(true).SetTitle("Hello, world!") |
|
return "Hello, world", Code(textView, 30, 10, helloWorld) |
|
}
|
|
|