aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsalaaad2 <arthurdurant263@gmail.com>2022-03-31 23:15:09 +0200
committersalaaad2 <arthurdurant263@gmail.com>2022-04-01 20:40:25 +0200
commitf95b0644d953cc04c22b2258fe36e870d7db5f0d (patch)
tree464b40cabf6a85180ac336b385ea4c2e680115a2
parentmrsmith_v0.0.1 (diff)
downloadsmith-f95b0644d953cc04c22b2258fe36e870d7db5f0d.tar.gz
smith-f95b0644d953cc04c22b2258fe36e870d7db5f0d.tar.bz2
smith-f95b0644d953cc04c22b2258fe36e870d7db5f0d.tar.xz
smith-f95b0644d953cc04c22b2258fe36e870d7db5f0d.tar.zst
smith-f95b0644d953cc04c22b2258fe36e870d7db5f0d.zip
0.0.1.1
-rw-r--r--.gitignore1
-rw-r--r--csrc/smith.h8
-rw-r--r--go.mod5
-rw-r--r--main.go27
4 files changed, 39 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index 4d7c973..1aea797 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,4 +4,5 @@
tmp/
csrc/obj
libsmith.a
+smith
go.sum
diff --git a/csrc/smith.h b/csrc/smith.h
index b342e54..04015ee 100644
--- a/csrc/smith.h
+++ b/csrc/smith.h
@@ -1,3 +1,11 @@
+/*********************************/
+/* SMITH ( // */
+/* smith ( )/ */
+/* by salade )(/ */
+/* ________________ ( /) */
+/* ()__)____________))))) :^} */
+/*********************************/
+
#ifndef SMITH_H_
#define SMITH_H_
diff --git a/go.mod b/go.mod
index 185d41c..be00a15 100644
--- a/go.mod
+++ b/go.mod
@@ -2,4 +2,7 @@ module smith
go 1.16
-require github.com/rivo/tview v0.0.0-20220307222120-9994674d60a8 // indirect
+require (
+ github.com/gdamore/tcell/v2 v2.4.1-0.20210905002822-f057f0a857a1 // indirect
+ github.com/rivo/tview v0.0.0-20220307222120-9994674d60a8
+)
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)
}
}