diff options
Diffstat (limited to 'cmds/plugin-consoleonly')
| -rw-r--r-- | cmds/plugin-consoleonly/Makefile | 14 | ||||
| -rw-r--r-- | cmds/plugin-consoleonly/args.go | 31 | ||||
| -rw-r--r-- | cmds/plugin-consoleonly/main.go | 34 |
3 files changed, 79 insertions, 0 deletions
diff --git a/cmds/plugin-consoleonly/Makefile b/cmds/plugin-consoleonly/Makefile new file mode 100644 index 0000000..a8279f6 --- /dev/null +++ b/cmds/plugin-consoleonly/Makefile @@ -0,0 +1,14 @@ +run: build + ./helloconsole + +build-release: + go get -v -u -x . + go install -v -o helloconsole + helloconsole + +build: + GO111MODULE="off" go get -v -x . + GO111MODULE="off" go build -v -o helloconsole + +update: + GO111MODULE="off" go get -v -u -x . diff --git a/cmds/plugin-consoleonly/args.go b/cmds/plugin-consoleonly/args.go new file mode 100644 index 0000000..dc4a322 --- /dev/null +++ b/cmds/plugin-consoleonly/args.go @@ -0,0 +1,31 @@ +// This creates a simple hello world window +package main + +import ( + "log" + "git.wit.org/wit/gui" + arg "github.com/alexflint/go-arg" +) + +type LogOptions struct { + LogFile string + Verbose bool + User string `arg:"env:USER"` +} + +var args struct { + LogOptions + gui.GuiArgs +} + +func init() { + arg.MustParse(&args) + log.Println("Toolkit = ", args.Toolkit) + + if (args.GuiDebug) { + gui.DebugWindow() + } + if (args.GuiVerbose) { + gui.SetDebug(true) + } +} diff --git a/cmds/plugin-consoleonly/main.go b/cmds/plugin-consoleonly/main.go new file mode 100644 index 0000000..1003530 --- /dev/null +++ b/cmds/plugin-consoleonly/main.go @@ -0,0 +1,34 @@ +// This is a simple example +package main + +import ( + "log" + "git.wit.org/wit/gui" +) + +func main() { + gui.InitPlugins([]string{"gocui"}) + // gui.InitPlugins([]string{"democui"}) + gui.Main(helloworld) +} + +// This creates a window +func helloworld() { + var w *gui.Node + gui.Config.Title = "helloworld golang wit/gui window" + gui.Config.Width = 640 + gui.Config.Height = 480 + + w = gui.NewWindow() + w.NewButton("hello", func () { + log.Println("world") + }) + w.NewButton("Flags", func () { + log.Println("the debugging flags window") + w.DebugFlags(false) + }) + w.NewButton("Widgets", func () { + w.DebugWidgets(false) + log.Println("debug the widgets window") + }) +} |
