From e55fb6675d692e3f44fa67b02b12661e476bd028 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 6 Nov 2022 12:59:24 -0600 Subject: start trying to make the tookits plugins totally minimize helloworld demo try to make a button plugin example debug changes final changes before attempting to use a golang plugin actually running gocui as a plugin add gocli-as-plugin example try to convert the go-cui toolkit into a plugin doc updates make a minimal console gui Signed-off-by: Jeff Carr --- cmds/buttonAsPlugin/Makefile | 14 ++++++++++++++ cmds/buttonAsPlugin/main.go | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 cmds/buttonAsPlugin/Makefile create mode 100644 cmds/buttonAsPlugin/main.go (limited to 'cmds/buttonAsPlugin') diff --git a/cmds/buttonAsPlugin/Makefile b/cmds/buttonAsPlugin/Makefile new file mode 100644 index 0000000..431d956 --- /dev/null +++ b/cmds/buttonAsPlugin/Makefile @@ -0,0 +1,14 @@ +run: build + ./buttonAsPlugin + +build-release: + go get -v -u -x . + go build + ./buttonAsPlugin + +build: + GO111MODULE="off" go get -v -x . + GO111MODULE="off" go build + +update: + GO111MODULE="off" go get -v -u -x . diff --git a/cmds/buttonAsPlugin/main.go b/cmds/buttonAsPlugin/main.go new file mode 100644 index 0000000..1c2eeaf --- /dev/null +++ b/cmds/buttonAsPlugin/main.go @@ -0,0 +1,33 @@ +// This is a simple example +package main + +import ( + "log" + "git.wit.org/wit/gui" +) + +func main() { + gui.Main(buttonWindow) +} + +// This creates a window +func buttonWindow() { + var w, g *gui.Node + gui.Config.Title = "Demo Plugin Window" + gui.Config.Width = 640 + gui.Config.Height = 480 + +// gui.Config.Exit = gui.StandardClose +// gui.SetDebug(true) + + w = gui.NewWindow() + g = w.NewGroup("buttonGroup") + + g.NewButton("hello", func () { + log.Println("world") + }) + + g.NewButton("foo", func () { + log.Println("bar") + }) +} -- cgit v1.2.3