summaryrefslogtreecommitdiff
path: root/toolkit/hello
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/hello')
-rw-r--r--toolkit/hello/Makefile8
-rw-r--r--toolkit/hello/greeter.go23
-rw-r--r--toolkit/hello/main.go44
3 files changed, 75 insertions, 0 deletions
diff --git a/toolkit/hello/Makefile b/toolkit/hello/Makefile
new file mode 100644
index 0000000..8271843
--- /dev/null
+++ b/toolkit/hello/Makefile
@@ -0,0 +1,8 @@
+all: plugin
+ ldd ../hello.so
+
+build:
+ GO111MODULE="off" go build
+
+plugin:
+ GO111MODULE="off" go build -buildmode=plugin -o ../hello.so
diff --git a/toolkit/hello/greeter.go b/toolkit/hello/greeter.go
new file mode 100644
index 0000000..1eb3307
--- /dev/null
+++ b/toolkit/hello/greeter.go
@@ -0,0 +1,23 @@
+package main
+
+import (
+// "errors"
+ "fmt"
+// "log"
+// "strings"
+
+// "github.com/awesome-gocui/gocui"
+)
+
+type greeting string
+
+
+// func main() {
+func (g greeting) Greet() {
+ fmt.Println("Hello Universe")
+ Init()
+ // ToolkitMain()
+}
+
+// this is exported
+var Greeter greeting
diff --git a/toolkit/hello/main.go b/toolkit/hello/main.go
new file mode 100644
index 0000000..3a72d1f
--- /dev/null
+++ b/toolkit/hello/main.go
@@ -0,0 +1,44 @@
+// This creates a simple hello world window
+package main
+
+import (
+ "os"
+ "log"
+ "git.wit.org/wit/gui"
+)
+
+func Init() {
+ gui.Main(myGUI)
+}
+
+// This initializes the first window
+func myGUI() {
+ var w *gui.Node
+ gui.Config.Title = "Hello World golang wit/gui Window"
+ gui.Config.Width = 640
+ gui.Config.Height = 480
+ gui.Config.Exit = myExit
+
+ w = gui.NewWindow()
+ addHelloWorld(w, "A Simple Tab")
+}
+
+func addHelloWorld(window *gui.Node, title string) {
+ var newNode, g, tb *gui.Node
+
+ newNode = window.NewTab(title)
+
+ g = newNode.NewGroup("hello")
+ tb = g.NewTextbox("hello world box") // when debugging, this string will be used
+ tb.OnChanged = func(*gui.Node) {
+ s := tb.GetText()
+ log.Println("text box =", s)
+ }
+ tb.SetText("world")
+}
+
+func myExit(n *gui.Node) {
+ log.Println("exit() here")
+ os.Exit(0)
+}
+