aboutsummaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go27
1 files changed, 26 insertions, 1 deletions
diff --git a/main.go b/main.go
index fc21770..f01a58f 100644
--- a/main.go
+++ b/main.go
@@ -15,10 +15,35 @@ import (
import "C"
func main() {
+ smith := tview.NewApplication()
ctogo := C.mr_smith()
+
+ modal := func(p tview.Primitive, width, height int) tview.Primitive {
+ return tview.NewFlex().
+ AddItem(nil, 0, 1, false).
+ AddItem(tview.NewFlex().SetDirection(tview.FlexRow).
+ AddItem(nil, 0, 1, false).
+ AddItem(p, height, 1, false).
+ AddItem(nil, 0, 1, false), width, 1, false).
+ AddItem(nil, 0, 1, false)
+ }
+
box := tview.NewBox().SetBorder(true).SetTitle(C.GoString(ctogo))
- if err := tview.NewApplication().SetRoot(box, true).Run(); err != nil {
+
+ init_form := tview.NewForm().
+ AddDropDown("You are", []string{"Salad", "Salade", "Mr Smith"}, 0, nil).
+ AddInputField("First Name", "", 20, nil, nil).
+ AddButton("Save", nil).
+ AddButton("Quit", func() {
+ smith.Stop()
+ })
+
+ pages := tview.NewPages().
+ AddPage("box", box, true, true).
+ AddPage("form", modal(init_form, 40, 20), true, true)
+
+ if err := smith.SetRoot(pages, true).Run(); err != nil {
panic(err)
}
}